Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #include "v8.h" |
| 29 | |
| 30 | #include "disassembler.h" |
| 31 | #include "disasm.h" |
| 32 | #include "jsregexp.h" |
| 33 | #include "objects-visiting.h" |
| 34 | |
| 35 | namespace v8 { |
| 36 | namespace internal { |
| 37 | |
| 38 | #ifdef OBJECT_PRINT |
| 39 | |
| 40 | static const char* TypeToString(InstanceType type); |
| 41 | |
| 42 | |
| 43 | void MaybeObject::Print(FILE* out) { |
| 44 | Object* this_as_object; |
| 45 | if (ToObject(&this_as_object)) { |
| 46 | if (this_as_object->IsSmi()) { |
| 47 | Smi::cast(this_as_object)->SmiPrint(out); |
| 48 | } else { |
| 49 | HeapObject::cast(this_as_object)->HeapObjectPrint(out); |
| 50 | } |
| 51 | } else { |
| 52 | Failure::cast(this)->FailurePrint(out); |
| 53 | } |
| 54 | Flush(out); |
| 55 | } |
| 56 | |
| 57 | |
| 58 | void MaybeObject::PrintLn(FILE* out) { |
| 59 | Print(out); |
| 60 | PrintF(out, "\n"); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | void HeapObject::PrintHeader(FILE* out, const char* id) { |
| 65 | PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | void HeapObject::HeapObjectPrint(FILE* out) { |
| 70 | InstanceType instance_type = map()->instance_type(); |
| 71 | |
| 72 | HandleScope scope; |
| 73 | if (instance_type < FIRST_NONSTRING_TYPE) { |
| 74 | String::cast(this)->StringPrint(out); |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | switch (instance_type) { |
| 79 | case MAP_TYPE: |
| 80 | Map::cast(this)->MapPrint(out); |
| 81 | break; |
| 82 | case HEAP_NUMBER_TYPE: |
| 83 | HeapNumber::cast(this)->HeapNumberPrint(out); |
| 84 | break; |
| 85 | case FIXED_ARRAY_TYPE: |
| 86 | FixedArray::cast(this)->FixedArrayPrint(out); |
| 87 | break; |
| 88 | case BYTE_ARRAY_TYPE: |
| 89 | ByteArray::cast(this)->ByteArrayPrint(out); |
| 90 | break; |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 91 | case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 92 | ExternalPixelArray::cast(this)->ExternalPixelArrayPrint(out); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 93 | break; |
| 94 | case EXTERNAL_BYTE_ARRAY_TYPE: |
| 95 | ExternalByteArray::cast(this)->ExternalByteArrayPrint(out); |
| 96 | break; |
| 97 | case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 98 | ExternalUnsignedByteArray::cast(this) |
| 99 | ->ExternalUnsignedByteArrayPrint(out); |
| 100 | break; |
| 101 | case EXTERNAL_SHORT_ARRAY_TYPE: |
| 102 | ExternalShortArray::cast(this)->ExternalShortArrayPrint(out); |
| 103 | break; |
| 104 | case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 105 | ExternalUnsignedShortArray::cast(this) |
| 106 | ->ExternalUnsignedShortArrayPrint(out); |
| 107 | break; |
| 108 | case EXTERNAL_INT_ARRAY_TYPE: |
| 109 | ExternalIntArray::cast(this)->ExternalIntArrayPrint(out); |
| 110 | break; |
| 111 | case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 112 | ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out); |
| 113 | break; |
| 114 | case EXTERNAL_FLOAT_ARRAY_TYPE: |
| 115 | ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out); |
| 116 | break; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 117 | case EXTERNAL_DOUBLE_ARRAY_TYPE: |
| 118 | ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out); |
| 119 | break; |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 120 | case FILLER_TYPE: |
| 121 | PrintF(out, "filler"); |
| 122 | break; |
| 123 | case JS_OBJECT_TYPE: // fall through |
| 124 | case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
| 125 | case JS_ARRAY_TYPE: |
| 126 | case JS_REGEXP_TYPE: |
| 127 | JSObject::cast(this)->JSObjectPrint(out); |
| 128 | break; |
| 129 | case ODDBALL_TYPE: |
| 130 | Oddball::cast(this)->to_string()->Print(out); |
| 131 | break; |
| 132 | case JS_FUNCTION_TYPE: |
| 133 | JSFunction::cast(this)->JSFunctionPrint(out); |
| 134 | break; |
| 135 | case JS_GLOBAL_PROXY_TYPE: |
| 136 | JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out); |
| 137 | break; |
| 138 | case JS_GLOBAL_OBJECT_TYPE: |
| 139 | JSGlobalObject::cast(this)->JSGlobalObjectPrint(out); |
| 140 | break; |
| 141 | case JS_BUILTINS_OBJECT_TYPE: |
| 142 | JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out); |
| 143 | break; |
| 144 | case JS_VALUE_TYPE: |
| 145 | PrintF(out, "Value wrapper around:"); |
| 146 | JSValue::cast(this)->value()->Print(out); |
| 147 | break; |
| 148 | case CODE_TYPE: |
| 149 | Code::cast(this)->CodePrint(out); |
| 150 | break; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 151 | case JS_PROXY_TYPE: |
| 152 | JSProxy::cast(this)->JSProxyPrint(out); |
| 153 | break; |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 154 | case JS_WEAK_MAP_TYPE: |
| 155 | JSWeakMap::cast(this)->JSWeakMapPrint(out); |
| 156 | break; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 157 | case FOREIGN_TYPE: |
| 158 | Foreign::cast(this)->ForeignPrint(out); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 159 | break; |
| 160 | case SHARED_FUNCTION_INFO_TYPE: |
| 161 | SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out); |
| 162 | break; |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 163 | case JS_MESSAGE_OBJECT_TYPE: |
| 164 | JSMessageObject::cast(this)->JSMessageObjectPrint(out); |
| 165 | break; |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 166 | case JS_GLOBAL_PROPERTY_CELL_TYPE: |
| 167 | JSGlobalPropertyCell::cast(this)->JSGlobalPropertyCellPrint(out); |
| 168 | break; |
| 169 | #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
| 170 | case NAME##_TYPE: \ |
| 171 | Name::cast(this)->Name##Print(out); \ |
| 172 | break; |
| 173 | STRUCT_LIST(MAKE_STRUCT_CASE) |
| 174 | #undef MAKE_STRUCT_CASE |
| 175 | |
| 176 | default: |
| 177 | PrintF(out, "UNKNOWN TYPE %d", map()->instance_type()); |
| 178 | UNREACHABLE(); |
| 179 | break; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | |
| 184 | void ByteArray::ByteArrayPrint(FILE* out) { |
| 185 | PrintF(out, "byte array, data starts at %p", GetDataStartAddress()); |
| 186 | } |
| 187 | |
| 188 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 189 | void ExternalPixelArray::ExternalPixelArrayPrint(FILE* out) { |
| 190 | PrintF(out, "external pixel array"); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | |
| 194 | void ExternalByteArray::ExternalByteArrayPrint(FILE* out) { |
| 195 | PrintF(out, "external byte array"); |
| 196 | } |
| 197 | |
| 198 | |
| 199 | void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) { |
| 200 | PrintF(out, "external unsigned byte array"); |
| 201 | } |
| 202 | |
| 203 | |
| 204 | void ExternalShortArray::ExternalShortArrayPrint(FILE* out) { |
| 205 | PrintF(out, "external short array"); |
| 206 | } |
| 207 | |
| 208 | |
| 209 | void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) { |
| 210 | PrintF(out, "external unsigned short array"); |
| 211 | } |
| 212 | |
| 213 | |
| 214 | void ExternalIntArray::ExternalIntArrayPrint(FILE* out) { |
| 215 | PrintF(out, "external int array"); |
| 216 | } |
| 217 | |
| 218 | |
| 219 | void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) { |
| 220 | PrintF(out, "external unsigned int array"); |
| 221 | } |
| 222 | |
| 223 | |
| 224 | void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) { |
| 225 | PrintF(out, "external float array"); |
| 226 | } |
| 227 | |
| 228 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 229 | void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) { |
| 230 | PrintF(out, "external double array"); |
| 231 | } |
| 232 | |
| 233 | |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 234 | void JSObject::PrintProperties(FILE* out) { |
| 235 | if (HasFastProperties()) { |
| 236 | DescriptorArray* descs = map()->instance_descriptors(); |
| 237 | for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| 238 | PrintF(out, " "); |
| 239 | descs->GetKey(i)->StringPrint(out); |
| 240 | PrintF(out, ": "); |
| 241 | switch (descs->GetType(i)) { |
| 242 | case FIELD: { |
| 243 | int index = descs->GetFieldIndex(i); |
| 244 | FastPropertyAt(index)->ShortPrint(out); |
| 245 | PrintF(out, " (field at offset %d)\n", index); |
| 246 | break; |
| 247 | } |
| 248 | case CONSTANT_FUNCTION: |
| 249 | descs->GetConstantFunction(i)->ShortPrint(out); |
| 250 | PrintF(out, " (constant function)\n"); |
| 251 | break; |
| 252 | case CALLBACKS: |
| 253 | descs->GetCallbacksObject(i)->ShortPrint(out); |
| 254 | PrintF(out, " (callback)\n"); |
| 255 | break; |
| 256 | case MAP_TRANSITION: |
| 257 | PrintF(out, " (map transition)\n"); |
| 258 | break; |
| 259 | case CONSTANT_TRANSITION: |
| 260 | PrintF(out, " (constant transition)\n"); |
| 261 | break; |
| 262 | case NULL_DESCRIPTOR: |
| 263 | PrintF(out, " (null descriptor)\n"); |
| 264 | break; |
| 265 | default: |
| 266 | UNREACHABLE(); |
| 267 | break; |
| 268 | } |
| 269 | } |
| 270 | } else { |
| 271 | property_dictionary()->Print(out); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | |
| 276 | void JSObject::PrintElements(FILE* out) { |
| 277 | switch (GetElementsKind()) { |
| 278 | case FAST_ELEMENTS: { |
| 279 | // Print in array notation for non-sparse arrays. |
| 280 | FixedArray* p = FixedArray::cast(elements()); |
| 281 | for (int i = 0; i < p->length(); i++) { |
| 282 | PrintF(out, " %d: ", i); |
| 283 | p->get(i)->ShortPrint(out); |
| 284 | PrintF(out, "\n"); |
| 285 | } |
| 286 | break; |
| 287 | } |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 288 | case FAST_DOUBLE_ELEMENTS: { |
| 289 | // Print in array notation for non-sparse arrays. |
| 290 | FixedDoubleArray* p = FixedDoubleArray::cast(elements()); |
| 291 | for (int i = 0; i < p->length(); i++) { |
| 292 | if (p->is_the_hole(i)) { |
| 293 | PrintF(out, " %d: <the hole>", i); |
| 294 | } else { |
| 295 | PrintF(out, " %d: %g", i, p->get_scalar(i)); |
| 296 | } |
| 297 | PrintF(out, "\n"); |
| 298 | } |
| 299 | break; |
| 300 | } |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 301 | case EXTERNAL_PIXEL_ELEMENTS: { |
| 302 | ExternalPixelArray* p = ExternalPixelArray::cast(elements()); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 303 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 304 | PrintF(out, " %d: %d\n", i, p->get_scalar(i)); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 305 | } |
| 306 | break; |
| 307 | } |
| 308 | case EXTERNAL_BYTE_ELEMENTS: { |
| 309 | ExternalByteArray* p = ExternalByteArray::cast(elements()); |
| 310 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 311 | PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 312 | } |
| 313 | break; |
| 314 | } |
| 315 | case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { |
| 316 | ExternalUnsignedByteArray* p = |
| 317 | ExternalUnsignedByteArray::cast(elements()); |
| 318 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 319 | PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 320 | } |
| 321 | break; |
| 322 | } |
| 323 | case EXTERNAL_SHORT_ELEMENTS: { |
| 324 | ExternalShortArray* p = ExternalShortArray::cast(elements()); |
| 325 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 326 | PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 327 | } |
| 328 | break; |
| 329 | } |
| 330 | case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { |
| 331 | ExternalUnsignedShortArray* p = |
| 332 | ExternalUnsignedShortArray::cast(elements()); |
| 333 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 334 | PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 335 | } |
| 336 | break; |
| 337 | } |
| 338 | case EXTERNAL_INT_ELEMENTS: { |
| 339 | ExternalIntArray* p = ExternalIntArray::cast(elements()); |
| 340 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 341 | PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 342 | } |
| 343 | break; |
| 344 | } |
| 345 | case EXTERNAL_UNSIGNED_INT_ELEMENTS: { |
| 346 | ExternalUnsignedIntArray* p = |
| 347 | ExternalUnsignedIntArray::cast(elements()); |
| 348 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 349 | PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 350 | } |
| 351 | break; |
| 352 | } |
| 353 | case EXTERNAL_FLOAT_ELEMENTS: { |
| 354 | ExternalFloatArray* p = ExternalFloatArray::cast(elements()); |
| 355 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 356 | PrintF(out, " %d: %f\n", i, p->get_scalar(i)); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 357 | } |
| 358 | break; |
| 359 | } |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 360 | case EXTERNAL_DOUBLE_ELEMENTS: { |
| 361 | ExternalDoubleArray* p = ExternalDoubleArray::cast(elements()); |
| 362 | for (int i = 0; i < p->length(); i++) { |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 363 | PrintF(out, " %d: %f\n", i, p->get_scalar(i)); |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 364 | } |
| 365 | break; |
| 366 | } |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 367 | case DICTIONARY_ELEMENTS: |
| 368 | elements()->Print(out); |
| 369 | break; |
Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 370 | case NON_STRICT_ARGUMENTS_ELEMENTS: { |
| 371 | FixedArray* p = FixedArray::cast(elements()); |
| 372 | for (int i = 2; i < p->length(); i++) { |
| 373 | PrintF(out, " %d: ", i); |
| 374 | p->get(i)->ShortPrint(out); |
| 375 | PrintF(out, "\n"); |
| 376 | } |
| 377 | break; |
| 378 | } |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 379 | } |
| 380 | } |
| 381 | |
| 382 | |
| 383 | void JSObject::JSObjectPrint(FILE* out) { |
| 384 | PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this)); |
| 385 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
| 386 | PrintF(out, " - prototype = %p\n", reinterpret_cast<void*>(GetPrototype())); |
| 387 | PrintF(out, " {\n"); |
| 388 | PrintProperties(out); |
| 389 | PrintElements(out); |
| 390 | PrintF(out, " }\n"); |
| 391 | } |
| 392 | |
| 393 | |
| 394 | static const char* TypeToString(InstanceType type) { |
| 395 | switch (type) { |
| 396 | case INVALID_TYPE: return "INVALID"; |
| 397 | case MAP_TYPE: return "MAP"; |
| 398 | case HEAP_NUMBER_TYPE: return "HEAP_NUMBER"; |
| 399 | case SYMBOL_TYPE: return "SYMBOL"; |
| 400 | case ASCII_SYMBOL_TYPE: return "ASCII_SYMBOL"; |
| 401 | case CONS_SYMBOL_TYPE: return "CONS_SYMBOL"; |
| 402 | case CONS_ASCII_SYMBOL_TYPE: return "CONS_ASCII_SYMBOL"; |
| 403 | case EXTERNAL_ASCII_SYMBOL_TYPE: |
| 404 | case EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE: |
| 405 | case EXTERNAL_SYMBOL_TYPE: return "EXTERNAL_SYMBOL"; |
| 406 | case ASCII_STRING_TYPE: return "ASCII_STRING"; |
| 407 | case STRING_TYPE: return "TWO_BYTE_STRING"; |
| 408 | case CONS_STRING_TYPE: |
| 409 | case CONS_ASCII_STRING_TYPE: return "CONS_STRING"; |
| 410 | case EXTERNAL_ASCII_STRING_TYPE: |
| 411 | case EXTERNAL_STRING_WITH_ASCII_DATA_TYPE: |
| 412 | case EXTERNAL_STRING_TYPE: return "EXTERNAL_STRING"; |
| 413 | case FIXED_ARRAY_TYPE: return "FIXED_ARRAY"; |
| 414 | case BYTE_ARRAY_TYPE: return "BYTE_ARRAY"; |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 415 | case EXTERNAL_PIXEL_ARRAY_TYPE: return "EXTERNAL_PIXEL_ARRAY"; |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 416 | case EXTERNAL_BYTE_ARRAY_TYPE: return "EXTERNAL_BYTE_ARRAY"; |
| 417 | case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 418 | return "EXTERNAL_UNSIGNED_BYTE_ARRAY"; |
| 419 | case EXTERNAL_SHORT_ARRAY_TYPE: return "EXTERNAL_SHORT_ARRAY"; |
| 420 | case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 421 | return "EXTERNAL_UNSIGNED_SHORT_ARRAY"; |
| 422 | case EXTERNAL_INT_ARRAY_TYPE: return "EXTERNAL_INT_ARRAY"; |
| 423 | case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 424 | return "EXTERNAL_UNSIGNED_INT_ARRAY"; |
| 425 | case EXTERNAL_FLOAT_ARRAY_TYPE: return "EXTERNAL_FLOAT_ARRAY"; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 426 | case EXTERNAL_DOUBLE_ARRAY_TYPE: return "EXTERNAL_DOUBLE_ARRAY"; |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 427 | case FILLER_TYPE: return "FILLER"; |
| 428 | case JS_OBJECT_TYPE: return "JS_OBJECT"; |
| 429 | case JS_CONTEXT_EXTENSION_OBJECT_TYPE: return "JS_CONTEXT_EXTENSION_OBJECT"; |
| 430 | case ODDBALL_TYPE: return "ODDBALL"; |
| 431 | case JS_GLOBAL_PROPERTY_CELL_TYPE: return "JS_GLOBAL_PROPERTY_CELL"; |
| 432 | case SHARED_FUNCTION_INFO_TYPE: return "SHARED_FUNCTION_INFO"; |
| 433 | case JS_FUNCTION_TYPE: return "JS_FUNCTION"; |
| 434 | case CODE_TYPE: return "CODE"; |
| 435 | case JS_ARRAY_TYPE: return "JS_ARRAY"; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 436 | case JS_PROXY_TYPE: return "JS_PROXY"; |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 437 | case JS_WEAK_MAP_TYPE: return "JS_WEAK_MAP"; |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 438 | case JS_REGEXP_TYPE: return "JS_REGEXP"; |
| 439 | case JS_VALUE_TYPE: return "JS_VALUE"; |
| 440 | case JS_GLOBAL_OBJECT_TYPE: return "JS_GLOBAL_OBJECT"; |
| 441 | case JS_BUILTINS_OBJECT_TYPE: return "JS_BUILTINS_OBJECT"; |
| 442 | case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY"; |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 443 | case FOREIGN_TYPE: return "FOREIGN"; |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 444 | case JS_MESSAGE_OBJECT_TYPE: return "JS_MESSAGE_OBJECT_TYPE"; |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 445 | #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME; |
| 446 | STRUCT_LIST(MAKE_STRUCT_CASE) |
| 447 | #undef MAKE_STRUCT_CASE |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 448 | default: return "UNKNOWN"; |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 449 | } |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | |
| 453 | void Map::MapPrint(FILE* out) { |
| 454 | HeapObject::PrintHeader(out, "Map"); |
| 455 | PrintF(out, " - type: %s\n", TypeToString(instance_type())); |
| 456 | PrintF(out, " - instance size: %d\n", instance_size()); |
| 457 | PrintF(out, " - inobject properties: %d\n", inobject_properties()); |
| 458 | PrintF(out, " - pre-allocated property fields: %d\n", |
| 459 | pre_allocated_property_fields()); |
| 460 | PrintF(out, " - unused property fields: %d\n", unused_property_fields()); |
| 461 | if (is_hidden_prototype()) { |
| 462 | PrintF(out, " - hidden_prototype\n"); |
| 463 | } |
| 464 | if (has_named_interceptor()) { |
| 465 | PrintF(out, " - named_interceptor\n"); |
| 466 | } |
| 467 | if (has_indexed_interceptor()) { |
| 468 | PrintF(out, " - indexed_interceptor\n"); |
| 469 | } |
| 470 | if (is_undetectable()) { |
| 471 | PrintF(out, " - undetectable\n"); |
| 472 | } |
| 473 | if (has_instance_call_handler()) { |
| 474 | PrintF(out, " - instance_call_handler\n"); |
| 475 | } |
| 476 | if (is_access_check_needed()) { |
| 477 | PrintF(out, " - access_check_needed\n"); |
| 478 | } |
| 479 | PrintF(out, " - instance descriptors: "); |
| 480 | instance_descriptors()->ShortPrint(out); |
| 481 | PrintF(out, "\n - prototype: "); |
| 482 | prototype()->ShortPrint(out); |
| 483 | PrintF(out, "\n - constructor: "); |
| 484 | constructor()->ShortPrint(out); |
| 485 | PrintF(out, "\n"); |
| 486 | } |
| 487 | |
| 488 | |
| 489 | void CodeCache::CodeCachePrint(FILE* out) { |
| 490 | HeapObject::PrintHeader(out, "CodeCache"); |
| 491 | PrintF(out, "\n - default_cache: "); |
| 492 | default_cache()->ShortPrint(out); |
| 493 | PrintF(out, "\n - normal_type_cache: "); |
| 494 | normal_type_cache()->ShortPrint(out); |
| 495 | } |
| 496 | |
| 497 | |
Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 498 | void PolymorphicCodeCache::PolymorphicCodeCachePrint(FILE* out) { |
| 499 | HeapObject::PrintHeader(out, "PolymorphicCodeCache"); |
| 500 | PrintF(out, "\n - cache: "); |
| 501 | cache()->ShortPrint(out); |
| 502 | } |
| 503 | |
| 504 | |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 505 | void FixedArray::FixedArrayPrint(FILE* out) { |
| 506 | HeapObject::PrintHeader(out, "FixedArray"); |
| 507 | PrintF(out, " - length: %d", length()); |
| 508 | for (int i = 0; i < length(); i++) { |
| 509 | PrintF(out, "\n [%d]: ", i); |
| 510 | get(i)->ShortPrint(out); |
| 511 | } |
| 512 | PrintF(out, "\n"); |
| 513 | } |
| 514 | |
| 515 | |
| 516 | void JSValue::JSValuePrint(FILE* out) { |
| 517 | HeapObject::PrintHeader(out, "ValueObject"); |
| 518 | value()->Print(out); |
| 519 | } |
| 520 | |
| 521 | |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 522 | void JSMessageObject::JSMessageObjectPrint(FILE* out) { |
| 523 | HeapObject::PrintHeader(out, "JSMessageObject"); |
| 524 | PrintF(out, " - type: "); |
| 525 | type()->ShortPrint(out); |
| 526 | PrintF(out, "\n - arguments: "); |
| 527 | arguments()->ShortPrint(out); |
| 528 | PrintF(out, "\n - start_position: %d", start_position()); |
| 529 | PrintF(out, "\n - end_position: %d", end_position()); |
| 530 | PrintF(out, "\n - script: "); |
| 531 | script()->ShortPrint(out); |
| 532 | PrintF(out, "\n - stack_trace: "); |
| 533 | stack_trace()->ShortPrint(out); |
| 534 | PrintF(out, "\n - stack_frames: "); |
| 535 | stack_frames()->ShortPrint(out); |
| 536 | PrintF(out, "\n"); |
| 537 | } |
| 538 | |
| 539 | |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 540 | void String::StringPrint(FILE* out) { |
| 541 | if (StringShape(this).IsSymbol()) { |
| 542 | PrintF(out, "#"); |
| 543 | } else if (StringShape(this).IsCons()) { |
| 544 | PrintF(out, "c\""); |
| 545 | } else { |
| 546 | PrintF(out, "\""); |
| 547 | } |
| 548 | |
| 549 | const char truncated_epilogue[] = "...<truncated>"; |
| 550 | int len = length(); |
| 551 | if (!FLAG_use_verbose_printer) { |
| 552 | if (len > 100) { |
| 553 | len = 100 - sizeof(truncated_epilogue); |
| 554 | } |
| 555 | } |
| 556 | for (int i = 0; i < len; i++) { |
| 557 | PrintF(out, "%c", Get(i)); |
| 558 | } |
| 559 | if (len != length()) { |
| 560 | PrintF(out, "%s", truncated_epilogue); |
| 561 | } |
| 562 | |
| 563 | if (!StringShape(this).IsSymbol()) PrintF(out, "\""); |
| 564 | } |
| 565 | |
| 566 | |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 567 | // This method is only meant to be called from gdb for debugging purposes. |
| 568 | // Since the string can also be in two-byte encoding, non-ascii characters |
| 569 | // will be ignored in the output. |
| 570 | char* String::ToAsciiArray() { |
| 571 | // Static so that subsequent calls frees previously allocated space. |
| 572 | // This also means that previous results will be overwritten. |
| 573 | static char* buffer = NULL; |
| 574 | if (buffer != NULL) free(buffer); |
| 575 | buffer = new char[length()+1]; |
| 576 | WriteToFlat(this, buffer, 0, length()); |
| 577 | buffer[length()] = 0; |
| 578 | return buffer; |
| 579 | } |
| 580 | |
| 581 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 582 | void JSProxy::JSProxyPrint(FILE* out) { |
| 583 | HeapObject::PrintHeader(out, "JSProxy"); |
| 584 | PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); |
| 585 | PrintF(out, " - handler = "); |
| 586 | handler()->Print(out); |
| 587 | PrintF(out, "\n"); |
| 588 | } |
| 589 | |
| 590 | |
Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame^] | 591 | void JSWeakMap::JSWeakMapPrint(FILE* out) { |
| 592 | HeapObject::PrintHeader(out, "JSWeakMap"); |
| 593 | PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); |
| 594 | PrintF(out, " - number of elements = %d\n", table()->NumberOfElements()); |
| 595 | PrintF(out, " - table = "); |
| 596 | table()->ShortPrint(out); |
| 597 | PrintF(out, "\n"); |
| 598 | } |
| 599 | |
| 600 | |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 601 | void JSFunction::JSFunctionPrint(FILE* out) { |
| 602 | HeapObject::PrintHeader(out, "Function"); |
| 603 | PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); |
| 604 | PrintF(out, " - initial_map = "); |
| 605 | if (has_initial_map()) { |
| 606 | initial_map()->ShortPrint(out); |
| 607 | } |
| 608 | PrintF(out, "\n - shared_info = "); |
| 609 | shared()->ShortPrint(out); |
| 610 | PrintF(out, "\n - name = "); |
| 611 | shared()->name()->Print(out); |
| 612 | PrintF(out, "\n - context = "); |
| 613 | unchecked_context()->ShortPrint(out); |
| 614 | PrintF(out, "\n - code = "); |
| 615 | code()->ShortPrint(out); |
| 616 | PrintF(out, "\n"); |
| 617 | |
| 618 | PrintProperties(out); |
| 619 | PrintElements(out); |
| 620 | |
| 621 | PrintF(out, "\n"); |
| 622 | } |
| 623 | |
| 624 | |
| 625 | void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) { |
| 626 | HeapObject::PrintHeader(out, "SharedFunctionInfo"); |
| 627 | PrintF(out, " - name: "); |
| 628 | name()->ShortPrint(out); |
| 629 | PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties()); |
| 630 | PrintF(out, "\n - instance class name = "); |
| 631 | instance_class_name()->Print(out); |
| 632 | PrintF(out, "\n - code = "); |
| 633 | code()->ShortPrint(out); |
| 634 | PrintF(out, "\n - source code = "); |
| 635 | GetSourceCode()->ShortPrint(out); |
| 636 | // Script files are often large, hard to read. |
| 637 | // PrintF(out, "\n - script ="); |
| 638 | // script()->Print(out); |
| 639 | PrintF(out, "\n - function token position = %d", function_token_position()); |
| 640 | PrintF(out, "\n - start position = %d", start_position()); |
| 641 | PrintF(out, "\n - end position = %d", end_position()); |
| 642 | PrintF(out, "\n - is expression = %d", is_expression()); |
| 643 | PrintF(out, "\n - debug info = "); |
| 644 | debug_info()->ShortPrint(out); |
| 645 | PrintF(out, "\n - length = %d", length()); |
| 646 | PrintF(out, "\n - has_only_simple_this_property_assignments = %d", |
| 647 | has_only_simple_this_property_assignments()); |
| 648 | PrintF(out, "\n - this_property_assignments = "); |
| 649 | this_property_assignments()->ShortPrint(out); |
| 650 | PrintF(out, "\n"); |
| 651 | } |
| 652 | |
| 653 | |
| 654 | void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) { |
| 655 | PrintF(out, "global_proxy"); |
| 656 | JSObjectPrint(out); |
| 657 | PrintF(out, "context : "); |
| 658 | context()->ShortPrint(out); |
| 659 | PrintF(out, "\n"); |
| 660 | } |
| 661 | |
| 662 | |
| 663 | void JSGlobalObject::JSGlobalObjectPrint(FILE* out) { |
| 664 | PrintF(out, "global "); |
| 665 | JSObjectPrint(out); |
| 666 | PrintF(out, "global context : "); |
| 667 | global_context()->ShortPrint(out); |
| 668 | PrintF(out, "\n"); |
| 669 | } |
| 670 | |
| 671 | |
| 672 | void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) { |
| 673 | PrintF(out, "builtins "); |
| 674 | JSObjectPrint(out); |
| 675 | } |
| 676 | |
| 677 | |
| 678 | void JSGlobalPropertyCell::JSGlobalPropertyCellPrint(FILE* out) { |
| 679 | HeapObject::PrintHeader(out, "JSGlobalPropertyCell"); |
| 680 | } |
| 681 | |
| 682 | |
| 683 | void Code::CodePrint(FILE* out) { |
| 684 | HeapObject::PrintHeader(out, "Code"); |
| 685 | #ifdef ENABLE_DISASSEMBLER |
| 686 | if (FLAG_use_verbose_printer) { |
| 687 | Disassemble(NULL, out); |
| 688 | } |
| 689 | #endif |
| 690 | } |
| 691 | |
| 692 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 693 | void Foreign::ForeignPrint(FILE* out) { |
| 694 | PrintF(out, "foreign address : %p", address()); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | |
| 698 | void AccessorInfo::AccessorInfoPrint(FILE* out) { |
| 699 | HeapObject::PrintHeader(out, "AccessorInfo"); |
| 700 | PrintF(out, "\n - getter: "); |
| 701 | getter()->ShortPrint(out); |
| 702 | PrintF(out, "\n - setter: "); |
| 703 | setter()->ShortPrint(out); |
| 704 | PrintF(out, "\n - name: "); |
| 705 | name()->ShortPrint(out); |
| 706 | PrintF(out, "\n - data: "); |
| 707 | data()->ShortPrint(out); |
| 708 | PrintF(out, "\n - flag: "); |
| 709 | flag()->ShortPrint(out); |
| 710 | } |
| 711 | |
| 712 | |
| 713 | void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) { |
| 714 | HeapObject::PrintHeader(out, "AccessCheckInfo"); |
| 715 | PrintF(out, "\n - named_callback: "); |
| 716 | named_callback()->ShortPrint(out); |
| 717 | PrintF(out, "\n - indexed_callback: "); |
| 718 | indexed_callback()->ShortPrint(out); |
| 719 | PrintF(out, "\n - data: "); |
| 720 | data()->ShortPrint(out); |
| 721 | } |
| 722 | |
| 723 | |
| 724 | void InterceptorInfo::InterceptorInfoPrint(FILE* out) { |
| 725 | HeapObject::PrintHeader(out, "InterceptorInfo"); |
| 726 | PrintF(out, "\n - getter: "); |
| 727 | getter()->ShortPrint(out); |
| 728 | PrintF(out, "\n - setter: "); |
| 729 | setter()->ShortPrint(out); |
| 730 | PrintF(out, "\n - query: "); |
| 731 | query()->ShortPrint(out); |
| 732 | PrintF(out, "\n - deleter: "); |
| 733 | deleter()->ShortPrint(out); |
| 734 | PrintF(out, "\n - enumerator: "); |
| 735 | enumerator()->ShortPrint(out); |
| 736 | PrintF(out, "\n - data: "); |
| 737 | data()->ShortPrint(out); |
| 738 | } |
| 739 | |
| 740 | |
| 741 | void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) { |
| 742 | HeapObject::PrintHeader(out, "CallHandlerInfo"); |
| 743 | PrintF(out, "\n - callback: "); |
| 744 | callback()->ShortPrint(out); |
| 745 | PrintF(out, "\n - data: "); |
| 746 | data()->ShortPrint(out); |
| 747 | PrintF(out, "\n - call_stub_cache: "); |
| 748 | } |
| 749 | |
| 750 | |
| 751 | void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) { |
| 752 | HeapObject::PrintHeader(out, "FunctionTemplateInfo"); |
| 753 | PrintF(out, "\n - class name: "); |
| 754 | class_name()->ShortPrint(out); |
| 755 | PrintF(out, "\n - tag: "); |
| 756 | tag()->ShortPrint(out); |
| 757 | PrintF(out, "\n - property_list: "); |
| 758 | property_list()->ShortPrint(out); |
| 759 | PrintF(out, "\n - serial_number: "); |
| 760 | serial_number()->ShortPrint(out); |
| 761 | PrintF(out, "\n - call_code: "); |
| 762 | call_code()->ShortPrint(out); |
| 763 | PrintF(out, "\n - property_accessors: "); |
| 764 | property_accessors()->ShortPrint(out); |
| 765 | PrintF(out, "\n - prototype_template: "); |
| 766 | prototype_template()->ShortPrint(out); |
| 767 | PrintF(out, "\n - parent_template: "); |
| 768 | parent_template()->ShortPrint(out); |
| 769 | PrintF(out, "\n - named_property_handler: "); |
| 770 | named_property_handler()->ShortPrint(out); |
| 771 | PrintF(out, "\n - indexed_property_handler: "); |
| 772 | indexed_property_handler()->ShortPrint(out); |
| 773 | PrintF(out, "\n - instance_template: "); |
| 774 | instance_template()->ShortPrint(out); |
| 775 | PrintF(out, "\n - signature: "); |
| 776 | signature()->ShortPrint(out); |
| 777 | PrintF(out, "\n - access_check_info: "); |
| 778 | access_check_info()->ShortPrint(out); |
| 779 | PrintF(out, "\n - hidden_prototype: %s", |
| 780 | hidden_prototype() ? "true" : "false"); |
| 781 | PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false"); |
| 782 | PrintF(out, "\n - need_access_check: %s", |
| 783 | needs_access_check() ? "true" : "false"); |
| 784 | } |
| 785 | |
| 786 | |
| 787 | void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) { |
| 788 | HeapObject::PrintHeader(out, "ObjectTemplateInfo"); |
| 789 | PrintF(out, "\n - constructor: "); |
| 790 | constructor()->ShortPrint(out); |
| 791 | PrintF(out, "\n - internal_field_count: "); |
| 792 | internal_field_count()->ShortPrint(out); |
| 793 | } |
| 794 | |
| 795 | |
| 796 | void SignatureInfo::SignatureInfoPrint(FILE* out) { |
| 797 | HeapObject::PrintHeader(out, "SignatureInfo"); |
| 798 | PrintF(out, "\n - receiver: "); |
| 799 | receiver()->ShortPrint(out); |
| 800 | PrintF(out, "\n - args: "); |
| 801 | args()->ShortPrint(out); |
| 802 | } |
| 803 | |
| 804 | |
| 805 | void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) { |
| 806 | HeapObject::PrintHeader(out, "TypeSwitchInfo"); |
| 807 | PrintF(out, "\n - types: "); |
| 808 | types()->ShortPrint(out); |
| 809 | } |
| 810 | |
| 811 | |
| 812 | void Script::ScriptPrint(FILE* out) { |
| 813 | HeapObject::PrintHeader(out, "Script"); |
| 814 | PrintF(out, "\n - source: "); |
| 815 | source()->ShortPrint(out); |
| 816 | PrintF(out, "\n - name: "); |
| 817 | name()->ShortPrint(out); |
| 818 | PrintF(out, "\n - line_offset: "); |
| 819 | line_offset()->ShortPrint(out); |
| 820 | PrintF(out, "\n - column_offset: "); |
| 821 | column_offset()->ShortPrint(out); |
| 822 | PrintF(out, "\n - type: "); |
| 823 | type()->ShortPrint(out); |
| 824 | PrintF(out, "\n - id: "); |
| 825 | id()->ShortPrint(out); |
| 826 | PrintF(out, "\n - data: "); |
| 827 | data()->ShortPrint(out); |
| 828 | PrintF(out, "\n - context data: "); |
| 829 | context_data()->ShortPrint(out); |
| 830 | PrintF(out, "\n - wrapper: "); |
| 831 | wrapper()->ShortPrint(out); |
| 832 | PrintF(out, "\n - compilation type: "); |
| 833 | compilation_type()->ShortPrint(out); |
| 834 | PrintF(out, "\n - line ends: "); |
| 835 | line_ends()->ShortPrint(out); |
| 836 | PrintF(out, "\n - eval from shared: "); |
| 837 | eval_from_shared()->ShortPrint(out); |
| 838 | PrintF(out, "\n - eval from instructions offset: "); |
| 839 | eval_from_instructions_offset()->ShortPrint(out); |
| 840 | PrintF(out, "\n"); |
| 841 | } |
| 842 | |
| 843 | |
| 844 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 845 | void DebugInfo::DebugInfoPrint(FILE* out) { |
| 846 | HeapObject::PrintHeader(out, "DebugInfo"); |
| 847 | PrintF(out, "\n - shared: "); |
| 848 | shared()->ShortPrint(out); |
| 849 | PrintF(out, "\n - original_code: "); |
| 850 | original_code()->ShortPrint(out); |
| 851 | PrintF(out, "\n - code: "); |
| 852 | code()->ShortPrint(out); |
| 853 | PrintF(out, "\n - break_points: "); |
| 854 | break_points()->Print(out); |
| 855 | } |
| 856 | |
| 857 | |
| 858 | void BreakPointInfo::BreakPointInfoPrint(FILE* out) { |
| 859 | HeapObject::PrintHeader(out, "BreakPointInfo"); |
| 860 | PrintF(out, "\n - code_position: %d", code_position()->value()); |
| 861 | PrintF(out, "\n - source_position: %d", source_position()->value()); |
| 862 | PrintF(out, "\n - statement_position: %d", statement_position()->value()); |
| 863 | PrintF(out, "\n - break_point_objects: "); |
| 864 | break_point_objects()->ShortPrint(out); |
| 865 | } |
| 866 | #endif // ENABLE_DEBUGGER_SUPPORT |
| 867 | |
| 868 | |
| 869 | void DescriptorArray::PrintDescriptors(FILE* out) { |
| 870 | PrintF(out, "Descriptor array %d\n", number_of_descriptors()); |
| 871 | for (int i = 0; i < number_of_descriptors(); i++) { |
| 872 | PrintF(out, " %d: ", i); |
| 873 | Descriptor desc; |
| 874 | Get(i, &desc); |
| 875 | desc.Print(out); |
| 876 | } |
| 877 | PrintF(out, "\n"); |
| 878 | } |
| 879 | |
| 880 | |
| 881 | #endif // OBJECT_PRINT |
| 882 | |
| 883 | |
| 884 | } } // namespace v8::internal |