| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "disassembler.h" | 30 #include "disassembler.h" |
| 31 #include "disasm.h" | 31 #include "disasm.h" |
| 32 #include "jsregexp.h" | 32 #include "jsregexp.h" |
| 33 #include "objects-visiting.h" | 33 #include "objects-visiting.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 #ifdef DEBUG | 38 #ifdef OBJECT_PRINT |
| 39 | 39 |
| 40 static const char* TypeToString(InstanceType type); | 40 static const char* TypeToString(InstanceType type); |
| 41 | 41 |
| 42 | 42 |
| 43 void MaybeObject::Print() { | 43 void MaybeObject::Print(FILE* out) { |
| 44 Object* this_as_object; | 44 Object* this_as_object; |
| 45 if (ToObject(&this_as_object)) { | 45 if (ToObject(&this_as_object)) { |
| 46 if (this_as_object->IsSmi()) { | 46 if (this_as_object->IsSmi()) { |
| 47 Smi::cast(this_as_object)->SmiPrint(); | 47 Smi::cast(this_as_object)->SmiPrint(out); |
| 48 } else { | 48 } else { |
| 49 HeapObject::cast(this_as_object)->HeapObjectPrint(); | 49 HeapObject::cast(this_as_object)->HeapObjectPrint(out); |
| 50 } | 50 } |
| 51 } else { | 51 } else { |
| 52 Failure::cast(this)->FailurePrint(); | 52 Failure::cast(this)->FailurePrint(out); |
| 53 } | 53 } |
| 54 Flush(); | 54 Flush(out); |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 void MaybeObject::PrintLn() { | 58 void MaybeObject::PrintLn(FILE* out) { |
| 59 Print(); | 59 Print(out); |
| 60 PrintF("\n"); | 60 PrintF(out, "\n"); |
| 61 } | 61 } |
| 62 #endif // OBJECT_PRINT |
| 62 | 63 |
| 63 | 64 |
| 65 #ifdef DEBUG |
| 64 void MaybeObject::Verify() { | 66 void MaybeObject::Verify() { |
| 65 Object* this_as_object; | 67 Object* this_as_object; |
| 66 if (ToObject(&this_as_object)) { | 68 if (ToObject(&this_as_object)) { |
| 67 if (this_as_object->IsSmi()) { | 69 if (this_as_object->IsSmi()) { |
| 68 Smi::cast(this_as_object)->SmiVerify(); | 70 Smi::cast(this_as_object)->SmiVerify(); |
| 69 } else { | 71 } else { |
| 70 HeapObject::cast(this_as_object)->HeapObjectVerify(); | 72 HeapObject::cast(this_as_object)->HeapObjectVerify(); |
| 71 } | 73 } |
| 72 } else { | 74 } else { |
| 73 Failure::cast(this)->FailureVerify(); | 75 Failure::cast(this)->FailureVerify(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 85 | 87 |
| 86 | 88 |
| 87 void Smi::SmiVerify() { | 89 void Smi::SmiVerify() { |
| 88 ASSERT(IsSmi()); | 90 ASSERT(IsSmi()); |
| 89 } | 91 } |
| 90 | 92 |
| 91 | 93 |
| 92 void Failure::FailureVerify() { | 94 void Failure::FailureVerify() { |
| 93 ASSERT(IsFailure()); | 95 ASSERT(IsFailure()); |
| 94 } | 96 } |
| 97 #endif // DEBUG |
| 95 | 98 |
| 96 | 99 |
| 97 void HeapObject::PrintHeader(const char* id) { | 100 #ifdef OBJECT_PRINT |
| 98 PrintF("%p: [%s]\n", reinterpret_cast<void*>(this), id); | 101 void HeapObject::PrintHeader(FILE* out, const char* id) { |
| 102 PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id); |
| 99 } | 103 } |
| 100 | 104 |
| 101 | 105 |
| 102 void HeapObject::HeapObjectPrint() { | 106 void HeapObject::HeapObjectPrint(FILE* out) { |
| 103 InstanceType instance_type = map()->instance_type(); | 107 InstanceType instance_type = map()->instance_type(); |
| 104 | 108 |
| 105 HandleScope scope; | 109 HandleScope scope; |
| 106 if (instance_type < FIRST_NONSTRING_TYPE) { | 110 if (instance_type < FIRST_NONSTRING_TYPE) { |
| 107 String::cast(this)->StringPrint(); | 111 String::cast(this)->StringPrint(out); |
| 108 return; | 112 return; |
| 109 } | 113 } |
| 110 | 114 |
| 111 switch (instance_type) { | 115 switch (instance_type) { |
| 112 case MAP_TYPE: | 116 case MAP_TYPE: |
| 113 Map::cast(this)->MapPrint(); | 117 Map::cast(this)->MapPrint(out); |
| 114 break; | 118 break; |
| 115 case HEAP_NUMBER_TYPE: | 119 case HEAP_NUMBER_TYPE: |
| 116 HeapNumber::cast(this)->HeapNumberPrint(); | 120 HeapNumber::cast(this)->HeapNumberPrint(out); |
| 117 break; | 121 break; |
| 118 case FIXED_ARRAY_TYPE: | 122 case FIXED_ARRAY_TYPE: |
| 119 FixedArray::cast(this)->FixedArrayPrint(); | 123 FixedArray::cast(this)->FixedArrayPrint(out); |
| 120 break; | 124 break; |
| 121 case BYTE_ARRAY_TYPE: | 125 case BYTE_ARRAY_TYPE: |
| 122 ByteArray::cast(this)->ByteArrayPrint(); | 126 ByteArray::cast(this)->ByteArrayPrint(out); |
| 123 break; | 127 break; |
| 124 case PIXEL_ARRAY_TYPE: | 128 case PIXEL_ARRAY_TYPE: |
| 125 PixelArray::cast(this)->PixelArrayPrint(); | 129 PixelArray::cast(this)->PixelArrayPrint(out); |
| 126 break; | 130 break; |
| 127 case EXTERNAL_BYTE_ARRAY_TYPE: | 131 case EXTERNAL_BYTE_ARRAY_TYPE: |
| 128 ExternalByteArray::cast(this)->ExternalByteArrayPrint(); | 132 ExternalByteArray::cast(this)->ExternalByteArrayPrint(out); |
| 129 break; | 133 break; |
| 130 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 134 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 131 ExternalUnsignedByteArray::cast(this)->ExternalUnsignedByteArrayPrint(); | 135 ExternalUnsignedByteArray::cast(this) |
| 136 ->ExternalUnsignedByteArrayPrint(out); |
| 132 break; | 137 break; |
| 133 case EXTERNAL_SHORT_ARRAY_TYPE: | 138 case EXTERNAL_SHORT_ARRAY_TYPE: |
| 134 ExternalShortArray::cast(this)->ExternalShortArrayPrint(); | 139 ExternalShortArray::cast(this)->ExternalShortArrayPrint(out); |
| 135 break; | 140 break; |
| 136 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 141 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 137 ExternalUnsignedShortArray::cast(this)->ExternalUnsignedShortArrayPrint(); | 142 ExternalUnsignedShortArray::cast(this) |
| 143 ->ExternalUnsignedShortArrayPrint(out); |
| 138 break; | 144 break; |
| 139 case EXTERNAL_INT_ARRAY_TYPE: | 145 case EXTERNAL_INT_ARRAY_TYPE: |
| 140 ExternalIntArray::cast(this)->ExternalIntArrayPrint(); | 146 ExternalIntArray::cast(this)->ExternalIntArrayPrint(out); |
| 141 break; | 147 break; |
| 142 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 148 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 143 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(); | 149 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out); |
| 144 break; | 150 break; |
| 145 case EXTERNAL_FLOAT_ARRAY_TYPE: | 151 case EXTERNAL_FLOAT_ARRAY_TYPE: |
| 146 ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(); | 152 ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out); |
| 147 break; | 153 break; |
| 148 case FILLER_TYPE: | 154 case FILLER_TYPE: |
| 149 PrintF("filler"); | 155 PrintF(out, "filler"); |
| 150 break; | 156 break; |
| 151 case JS_OBJECT_TYPE: // fall through | 157 case JS_OBJECT_TYPE: // fall through |
| 152 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 158 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
| 153 case JS_ARRAY_TYPE: | 159 case JS_ARRAY_TYPE: |
| 154 case JS_REGEXP_TYPE: | 160 case JS_REGEXP_TYPE: |
| 155 JSObject::cast(this)->JSObjectPrint(); | 161 JSObject::cast(this)->JSObjectPrint(out); |
| 156 break; | 162 break; |
| 157 case ODDBALL_TYPE: | 163 case ODDBALL_TYPE: |
| 158 Oddball::cast(this)->to_string()->Print(); | 164 Oddball::cast(this)->to_string()->Print(out); |
| 159 break; | 165 break; |
| 160 case JS_FUNCTION_TYPE: | 166 case JS_FUNCTION_TYPE: |
| 161 JSFunction::cast(this)->JSFunctionPrint(); | 167 JSFunction::cast(this)->JSFunctionPrint(out); |
| 162 break; | 168 break; |
| 163 case JS_GLOBAL_PROXY_TYPE: | 169 case JS_GLOBAL_PROXY_TYPE: |
| 164 JSGlobalProxy::cast(this)->JSGlobalProxyPrint(); | 170 JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out); |
| 165 break; | 171 break; |
| 166 case JS_GLOBAL_OBJECT_TYPE: | 172 case JS_GLOBAL_OBJECT_TYPE: |
| 167 JSGlobalObject::cast(this)->JSGlobalObjectPrint(); | 173 JSGlobalObject::cast(this)->JSGlobalObjectPrint(out); |
| 168 break; | 174 break; |
| 169 case JS_BUILTINS_OBJECT_TYPE: | 175 case JS_BUILTINS_OBJECT_TYPE: |
| 170 JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(); | 176 JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out); |
| 171 break; | 177 break; |
| 172 case JS_VALUE_TYPE: | 178 case JS_VALUE_TYPE: |
| 173 PrintF("Value wrapper around:"); | 179 PrintF(out, "Value wrapper around:"); |
| 174 JSValue::cast(this)->value()->Print(); | 180 JSValue::cast(this)->value()->Print(out); |
| 175 break; | 181 break; |
| 176 case CODE_TYPE: | 182 case CODE_TYPE: |
| 177 Code::cast(this)->CodePrint(); | 183 Code::cast(this)->CodePrint(out); |
| 178 break; | 184 break; |
| 179 case PROXY_TYPE: | 185 case PROXY_TYPE: |
| 180 Proxy::cast(this)->ProxyPrint(); | 186 Proxy::cast(this)->ProxyPrint(out); |
| 181 break; | 187 break; |
| 182 case SHARED_FUNCTION_INFO_TYPE: | 188 case SHARED_FUNCTION_INFO_TYPE: |
| 183 SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(); | 189 SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out); |
| 184 break; | 190 break; |
| 185 case JS_GLOBAL_PROPERTY_CELL_TYPE: | 191 case JS_GLOBAL_PROPERTY_CELL_TYPE: |
| 186 JSGlobalPropertyCell::cast(this)->JSGlobalPropertyCellPrint(); | 192 JSGlobalPropertyCell::cast(this)->JSGlobalPropertyCellPrint(out); |
| 187 break; | 193 break; |
| 188 #define MAKE_STRUCT_CASE(NAME, Name, name) \ | 194 #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
| 189 case NAME##_TYPE: \ | 195 case NAME##_TYPE: \ |
| 190 Name::cast(this)->Name##Print(); \ | 196 Name::cast(this)->Name##Print(out); \ |
| 191 break; | 197 break; |
| 192 STRUCT_LIST(MAKE_STRUCT_CASE) | 198 STRUCT_LIST(MAKE_STRUCT_CASE) |
| 193 #undef MAKE_STRUCT_CASE | 199 #undef MAKE_STRUCT_CASE |
| 194 | 200 |
| 195 default: | 201 default: |
| 196 PrintF("UNKNOWN TYPE %d", map()->instance_type()); | 202 PrintF(out, "UNKNOWN TYPE %d", map()->instance_type()); |
| 197 UNREACHABLE(); | 203 UNREACHABLE(); |
| 198 break; | 204 break; |
| 199 } | 205 } |
| 200 } | 206 } |
| 207 #endif // OBJECT_PRINT |
| 201 | 208 |
| 202 | 209 |
| 210 #ifdef DEBUG |
| 203 void HeapObject::HeapObjectVerify() { | 211 void HeapObject::HeapObjectVerify() { |
| 204 InstanceType instance_type = map()->instance_type(); | 212 InstanceType instance_type = map()->instance_type(); |
| 205 | 213 |
| 206 if (instance_type < FIRST_NONSTRING_TYPE) { | 214 if (instance_type < FIRST_NONSTRING_TYPE) { |
| 207 String::cast(this)->StringVerify(); | 215 String::cast(this)->StringVerify(); |
| 208 return; | 216 return; |
| 209 } | 217 } |
| 210 | 218 |
| 211 switch (instance_type) { | 219 switch (instance_type) { |
| 212 case MAP_TYPE: | 220 case MAP_TYPE: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 313 |
| 306 void HeapObject::VerifyHeapPointer(Object* p) { | 314 void HeapObject::VerifyHeapPointer(Object* p) { |
| 307 ASSERT(p->IsHeapObject()); | 315 ASSERT(p->IsHeapObject()); |
| 308 ASSERT(Heap::Contains(HeapObject::cast(p))); | 316 ASSERT(Heap::Contains(HeapObject::cast(p))); |
| 309 } | 317 } |
| 310 | 318 |
| 311 | 319 |
| 312 void HeapNumber::HeapNumberVerify() { | 320 void HeapNumber::HeapNumberVerify() { |
| 313 ASSERT(IsHeapNumber()); | 321 ASSERT(IsHeapNumber()); |
| 314 } | 322 } |
| 323 #endif // DEBUG |
| 315 | 324 |
| 316 | 325 |
| 317 void ByteArray::ByteArrayPrint() { | 326 #ifdef OBJECT_PRINT |
| 318 PrintF("byte array, data starts at %p", GetDataStartAddress()); | 327 void ByteArray::ByteArrayPrint(FILE* out) { |
| 328 PrintF(out, "byte array, data starts at %p", GetDataStartAddress()); |
| 319 } | 329 } |
| 320 | 330 |
| 321 | 331 |
| 322 void PixelArray::PixelArrayPrint() { | 332 void PixelArray::PixelArrayPrint(FILE* out) { |
| 323 PrintF("pixel array"); | 333 PrintF(out, "pixel array"); |
| 324 } | 334 } |
| 325 | 335 |
| 326 | 336 |
| 327 void ExternalByteArray::ExternalByteArrayPrint() { | 337 void ExternalByteArray::ExternalByteArrayPrint(FILE* out) { |
| 328 PrintF("external byte array"); | 338 PrintF(out, "external byte array"); |
| 329 } | 339 } |
| 330 | 340 |
| 331 | 341 |
| 332 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint() { | 342 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) { |
| 333 PrintF("external unsigned byte array"); | 343 PrintF(out, "external unsigned byte array"); |
| 334 } | 344 } |
| 335 | 345 |
| 336 | 346 |
| 337 void ExternalShortArray::ExternalShortArrayPrint() { | 347 void ExternalShortArray::ExternalShortArrayPrint(FILE* out) { |
| 338 PrintF("external short array"); | 348 PrintF(out, "external short array"); |
| 339 } | 349 } |
| 340 | 350 |
| 341 | 351 |
| 342 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint() { | 352 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) { |
| 343 PrintF("external unsigned short array"); | 353 PrintF(out, "external unsigned short array"); |
| 344 } | 354 } |
| 345 | 355 |
| 346 | 356 |
| 347 void ExternalIntArray::ExternalIntArrayPrint() { | 357 void ExternalIntArray::ExternalIntArrayPrint(FILE* out) { |
| 348 PrintF("external int array"); | 358 PrintF(out, "external int array"); |
| 349 } | 359 } |
| 350 | 360 |
| 351 | 361 |
| 352 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint() { | 362 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) { |
| 353 PrintF("external unsigned int array"); | 363 PrintF(out, "external unsigned int array"); |
| 354 } | 364 } |
| 355 | 365 |
| 356 | 366 |
| 357 void ExternalFloatArray::ExternalFloatArrayPrint() { | 367 void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) { |
| 358 PrintF("external float array"); | 368 PrintF(out, "external float array"); |
| 359 } | 369 } |
| 370 #endif // OBJECT_PRINT |
| 360 | 371 |
| 361 | 372 |
| 373 #ifdef DEBUG |
| 362 void ByteArray::ByteArrayVerify() { | 374 void ByteArray::ByteArrayVerify() { |
| 363 ASSERT(IsByteArray()); | 375 ASSERT(IsByteArray()); |
| 364 } | 376 } |
| 365 | 377 |
| 366 | 378 |
| 367 void PixelArray::PixelArrayVerify() { | 379 void PixelArray::PixelArrayVerify() { |
| 368 ASSERT(IsPixelArray()); | 380 ASSERT(IsPixelArray()); |
| 369 } | 381 } |
| 370 | 382 |
| 371 | 383 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 395 | 407 |
| 396 | 408 |
| 397 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() { | 409 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() { |
| 398 ASSERT(IsExternalUnsignedIntArray()); | 410 ASSERT(IsExternalUnsignedIntArray()); |
| 399 } | 411 } |
| 400 | 412 |
| 401 | 413 |
| 402 void ExternalFloatArray::ExternalFloatArrayVerify() { | 414 void ExternalFloatArray::ExternalFloatArrayVerify() { |
| 403 ASSERT(IsExternalFloatArray()); | 415 ASSERT(IsExternalFloatArray()); |
| 404 } | 416 } |
| 417 #endif // DEBUG |
| 405 | 418 |
| 406 | 419 |
| 407 void JSObject::PrintProperties() { | 420 #ifdef OBJECT_PRINT |
| 421 void JSObject::PrintProperties(FILE* out) { |
| 408 if (HasFastProperties()) { | 422 if (HasFastProperties()) { |
| 409 DescriptorArray* descs = map()->instance_descriptors(); | 423 DescriptorArray* descs = map()->instance_descriptors(); |
| 410 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 424 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| 411 PrintF(" "); | 425 PrintF(out, " "); |
| 412 descs->GetKey(i)->StringPrint(); | 426 descs->GetKey(i)->StringPrint(out); |
| 413 PrintF(": "); | 427 PrintF(out, ": "); |
| 414 switch (descs->GetType(i)) { | 428 switch (descs->GetType(i)) { |
| 415 case FIELD: { | 429 case FIELD: { |
| 416 int index = descs->GetFieldIndex(i); | 430 int index = descs->GetFieldIndex(i); |
| 417 FastPropertyAt(index)->ShortPrint(); | 431 FastPropertyAt(index)->ShortPrint(out); |
| 418 PrintF(" (field at offset %d)\n", index); | 432 PrintF(out, " (field at offset %d)\n", index); |
| 419 break; | 433 break; |
| 420 } | 434 } |
| 421 case CONSTANT_FUNCTION: | 435 case CONSTANT_FUNCTION: |
| 422 descs->GetConstantFunction(i)->ShortPrint(); | 436 descs->GetConstantFunction(i)->ShortPrint(out); |
| 423 PrintF(" (constant function)\n"); | 437 PrintF(out, " (constant function)\n"); |
| 424 break; | 438 break; |
| 425 case CALLBACKS: | 439 case CALLBACKS: |
| 426 descs->GetCallbacksObject(i)->ShortPrint(); | 440 descs->GetCallbacksObject(i)->ShortPrint(out); |
| 427 PrintF(" (callback)\n"); | 441 PrintF(out, " (callback)\n"); |
| 428 break; | 442 break; |
| 429 case MAP_TRANSITION: | 443 case MAP_TRANSITION: |
| 430 PrintF(" (map transition)\n"); | 444 PrintF(out, " (map transition)\n"); |
| 431 break; | 445 break; |
| 432 case CONSTANT_TRANSITION: | 446 case CONSTANT_TRANSITION: |
| 433 PrintF(" (constant transition)\n"); | 447 PrintF(out, " (constant transition)\n"); |
| 434 break; | 448 break; |
| 435 case NULL_DESCRIPTOR: | 449 case NULL_DESCRIPTOR: |
| 436 PrintF(" (null descriptor)\n"); | 450 PrintF(out, " (null descriptor)\n"); |
| 437 break; | 451 break; |
| 438 default: | 452 default: |
| 439 UNREACHABLE(); | 453 UNREACHABLE(); |
| 440 break; | 454 break; |
| 441 } | 455 } |
| 442 } | 456 } |
| 443 } else { | 457 } else { |
| 444 property_dictionary()->Print(); | 458 property_dictionary()->Print(out); |
| 445 } | 459 } |
| 446 } | 460 } |
| 447 | 461 |
| 448 | 462 |
| 449 void JSObject::PrintElements() { | 463 void JSObject::PrintElements(FILE* out) { |
| 450 switch (GetElementsKind()) { | 464 switch (GetElementsKind()) { |
| 451 case FAST_ELEMENTS: { | 465 case FAST_ELEMENTS: { |
| 452 // Print in array notation for non-sparse arrays. | 466 // Print in array notation for non-sparse arrays. |
| 453 FixedArray* p = FixedArray::cast(elements()); | 467 FixedArray* p = FixedArray::cast(elements()); |
| 454 for (int i = 0; i < p->length(); i++) { | 468 for (int i = 0; i < p->length(); i++) { |
| 455 PrintF(" %d: ", i); | 469 PrintF(out, " %d: ", i); |
| 456 p->get(i)->ShortPrint(); | 470 p->get(i)->ShortPrint(out); |
| 457 PrintF("\n"); | 471 PrintF(out, "\n"); |
| 458 } | 472 } |
| 459 break; | 473 break; |
| 460 } | 474 } |
| 461 case PIXEL_ELEMENTS: { | 475 case PIXEL_ELEMENTS: { |
| 462 PixelArray* p = PixelArray::cast(elements()); | 476 PixelArray* p = PixelArray::cast(elements()); |
| 463 for (int i = 0; i < p->length(); i++) { | 477 for (int i = 0; i < p->length(); i++) { |
| 464 PrintF(" %d: %d\n", i, p->get(i)); | 478 PrintF(out, " %d: %d\n", i, p->get(i)); |
| 465 } | 479 } |
| 466 break; | 480 break; |
| 467 } | 481 } |
| 468 case EXTERNAL_BYTE_ELEMENTS: { | 482 case EXTERNAL_BYTE_ELEMENTS: { |
| 469 ExternalByteArray* p = ExternalByteArray::cast(elements()); | 483 ExternalByteArray* p = ExternalByteArray::cast(elements()); |
| 470 for (int i = 0; i < p->length(); i++) { | 484 for (int i = 0; i < p->length(); i++) { |
| 471 PrintF(" %d: %d\n", i, static_cast<int>(p->get(i))); | 485 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); |
| 472 } | 486 } |
| 473 break; | 487 break; |
| 474 } | 488 } |
| 475 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { | 489 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { |
| 476 ExternalUnsignedByteArray* p = | 490 ExternalUnsignedByteArray* p = |
| 477 ExternalUnsignedByteArray::cast(elements()); | 491 ExternalUnsignedByteArray::cast(elements()); |
| 478 for (int i = 0; i < p->length(); i++) { | 492 for (int i = 0; i < p->length(); i++) { |
| 479 PrintF(" %d: %d\n", i, static_cast<int>(p->get(i))); | 493 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); |
| 480 } | 494 } |
| 481 break; | 495 break; |
| 482 } | 496 } |
| 483 case EXTERNAL_SHORT_ELEMENTS: { | 497 case EXTERNAL_SHORT_ELEMENTS: { |
| 484 ExternalShortArray* p = ExternalShortArray::cast(elements()); | 498 ExternalShortArray* p = ExternalShortArray::cast(elements()); |
| 485 for (int i = 0; i < p->length(); i++) { | 499 for (int i = 0; i < p->length(); i++) { |
| 486 PrintF(" %d: %d\n", i, static_cast<int>(p->get(i))); | 500 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); |
| 487 } | 501 } |
| 488 break; | 502 break; |
| 489 } | 503 } |
| 490 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { | 504 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { |
| 491 ExternalUnsignedShortArray* p = | 505 ExternalUnsignedShortArray* p = |
| 492 ExternalUnsignedShortArray::cast(elements()); | 506 ExternalUnsignedShortArray::cast(elements()); |
| 493 for (int i = 0; i < p->length(); i++) { | 507 for (int i = 0; i < p->length(); i++) { |
| 494 PrintF(" %d: %d\n", i, static_cast<int>(p->get(i))); | 508 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); |
| 495 } | 509 } |
| 496 break; | 510 break; |
| 497 } | 511 } |
| 498 case EXTERNAL_INT_ELEMENTS: { | 512 case EXTERNAL_INT_ELEMENTS: { |
| 499 ExternalIntArray* p = ExternalIntArray::cast(elements()); | 513 ExternalIntArray* p = ExternalIntArray::cast(elements()); |
| 500 for (int i = 0; i < p->length(); i++) { | 514 for (int i = 0; i < p->length(); i++) { |
| 501 PrintF(" %d: %d\n", i, static_cast<int>(p->get(i))); | 515 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); |
| 502 } | 516 } |
| 503 break; | 517 break; |
| 504 } | 518 } |
| 505 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { | 519 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { |
| 506 ExternalUnsignedIntArray* p = | 520 ExternalUnsignedIntArray* p = |
| 507 ExternalUnsignedIntArray::cast(elements()); | 521 ExternalUnsignedIntArray::cast(elements()); |
| 508 for (int i = 0; i < p->length(); i++) { | 522 for (int i = 0; i < p->length(); i++) { |
| 509 PrintF(" %d: %d\n", i, static_cast<int>(p->get(i))); | 523 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); |
| 510 } | 524 } |
| 511 break; | 525 break; |
| 512 } | 526 } |
| 513 case EXTERNAL_FLOAT_ELEMENTS: { | 527 case EXTERNAL_FLOAT_ELEMENTS: { |
| 514 ExternalFloatArray* p = ExternalFloatArray::cast(elements()); | 528 ExternalFloatArray* p = ExternalFloatArray::cast(elements()); |
| 515 for (int i = 0; i < p->length(); i++) { | 529 for (int i = 0; i < p->length(); i++) { |
| 516 PrintF(" %d: %f\n", i, p->get(i)); | 530 PrintF(out, " %d: %f\n", i, p->get(i)); |
| 517 } | 531 } |
| 518 break; | 532 break; |
| 519 } | 533 } |
| 520 case DICTIONARY_ELEMENTS: | 534 case DICTIONARY_ELEMENTS: |
| 521 elements()->Print(); | 535 elements()->Print(out); |
| 522 break; | 536 break; |
| 523 default: | 537 default: |
| 524 UNREACHABLE(); | 538 UNREACHABLE(); |
| 525 break; | 539 break; |
| 526 } | 540 } |
| 527 } | 541 } |
| 528 | 542 |
| 529 | 543 |
| 530 void JSObject::JSObjectPrint() { | 544 void JSObject::JSObjectPrint(FILE* out) { |
| 531 PrintF("%p: [JSObject]\n", reinterpret_cast<void*>(this)); | 545 PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this)); |
| 532 PrintF(" - map = %p\n", reinterpret_cast<void*>(map())); | 546 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
| 533 PrintF(" - prototype = %p\n", reinterpret_cast<void*>(GetPrototype())); | 547 PrintF(out, " - prototype = %p\n", reinterpret_cast<void*>(GetPrototype())); |
| 534 PrintF(" {\n"); | 548 PrintF(out, " {\n"); |
| 535 PrintProperties(); | 549 PrintProperties(out); |
| 536 PrintElements(); | 550 PrintElements(out); |
| 537 PrintF(" }\n"); | 551 PrintF(out, " }\n"); |
| 538 } | 552 } |
| 553 #endif // OBJECT_PRINT |
| 539 | 554 |
| 540 | 555 |
| 556 #ifdef DEBUG |
| 541 void JSObject::JSObjectVerify() { | 557 void JSObject::JSObjectVerify() { |
| 542 VerifyHeapPointer(properties()); | 558 VerifyHeapPointer(properties()); |
| 543 VerifyHeapPointer(elements()); | 559 VerifyHeapPointer(elements()); |
| 544 if (HasFastProperties()) { | 560 if (HasFastProperties()) { |
| 545 CHECK_EQ(map()->unused_property_fields(), | 561 CHECK_EQ(map()->unused_property_fields(), |
| 546 (map()->inobject_properties() + properties()->length() - | 562 (map()->inobject_properties() + properties()->length() - |
| 547 map()->NextFreePropertyIndex())); | 563 map()->NextFreePropertyIndex())); |
| 548 } | 564 } |
| 549 ASSERT(map()->has_fast_elements() == | 565 ASSERT(map()->has_fast_elements() == |
| 550 (elements()->map() == Heap::fixed_array_map() || | 566 (elements()->map() == Heap::fixed_array_map() || |
| 551 elements()->map() == Heap::fixed_cow_array_map())); | 567 elements()->map() == Heap::fixed_cow_array_map())); |
| 552 ASSERT(map()->has_fast_elements() == HasFastElements()); | 568 ASSERT(map()->has_fast_elements() == HasFastElements()); |
| 553 } | 569 } |
| 570 #endif // DEBUG |
| 554 | 571 |
| 555 | 572 |
| 573 #ifdef OBJECT_PRINT |
| 556 static const char* TypeToString(InstanceType type) { | 574 static const char* TypeToString(InstanceType type) { |
| 557 switch (type) { | 575 switch (type) { |
| 558 case INVALID_TYPE: return "INVALID"; | 576 case INVALID_TYPE: return "INVALID"; |
| 559 case MAP_TYPE: return "MAP"; | 577 case MAP_TYPE: return "MAP"; |
| 560 case HEAP_NUMBER_TYPE: return "HEAP_NUMBER"; | 578 case HEAP_NUMBER_TYPE: return "HEAP_NUMBER"; |
| 561 case SYMBOL_TYPE: return "SYMBOL"; | 579 case SYMBOL_TYPE: return "SYMBOL"; |
| 562 case ASCII_SYMBOL_TYPE: return "ASCII_SYMBOL"; | 580 case ASCII_SYMBOL_TYPE: return "ASCII_SYMBOL"; |
| 563 case CONS_SYMBOL_TYPE: return "CONS_SYMBOL"; | 581 case CONS_SYMBOL_TYPE: return "CONS_SYMBOL"; |
| 564 case CONS_ASCII_SYMBOL_TYPE: return "CONS_ASCII_SYMBOL"; | 582 case CONS_ASCII_SYMBOL_TYPE: return "CONS_ASCII_SYMBOL"; |
| 565 case EXTERNAL_ASCII_SYMBOL_TYPE: | 583 case EXTERNAL_ASCII_SYMBOL_TYPE: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY"; | 619 case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY"; |
| 602 case PROXY_TYPE: return "PROXY"; | 620 case PROXY_TYPE: return "PROXY"; |
| 603 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME; | 621 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME; |
| 604 STRUCT_LIST(MAKE_STRUCT_CASE) | 622 STRUCT_LIST(MAKE_STRUCT_CASE) |
| 605 #undef MAKE_STRUCT_CASE | 623 #undef MAKE_STRUCT_CASE |
| 606 } | 624 } |
| 607 return "UNKNOWN"; | 625 return "UNKNOWN"; |
| 608 } | 626 } |
| 609 | 627 |
| 610 | 628 |
| 611 void Map::MapPrint() { | 629 void Map::MapPrint(FILE* out) { |
| 612 HeapObject::PrintHeader("Map"); | 630 HeapObject::PrintHeader(out, "Map"); |
| 613 PrintF(" - type: %s\n", TypeToString(instance_type())); | 631 PrintF(out, " - type: %s\n", TypeToString(instance_type())); |
| 614 PrintF(" - instance size: %d\n", instance_size()); | 632 PrintF(out, " - instance size: %d\n", instance_size()); |
| 615 PrintF(" - inobject properties: %d\n", inobject_properties()); | 633 PrintF(out, " - inobject properties: %d\n", inobject_properties()); |
| 616 PrintF(" - pre-allocated property fields: %d\n", | 634 PrintF(out, " - pre-allocated property fields: %d\n", |
| 617 pre_allocated_property_fields()); | 635 pre_allocated_property_fields()); |
| 618 PrintF(" - unused property fields: %d\n", unused_property_fields()); | 636 PrintF(out, " - unused property fields: %d\n", unused_property_fields()); |
| 619 if (is_hidden_prototype()) { | 637 if (is_hidden_prototype()) { |
| 620 PrintF(" - hidden_prototype\n"); | 638 PrintF(out, " - hidden_prototype\n"); |
| 621 } | 639 } |
| 622 if (has_named_interceptor()) { | 640 if (has_named_interceptor()) { |
| 623 PrintF(" - named_interceptor\n"); | 641 PrintF(out, " - named_interceptor\n"); |
| 624 } | 642 } |
| 625 if (has_indexed_interceptor()) { | 643 if (has_indexed_interceptor()) { |
| 626 PrintF(" - indexed_interceptor\n"); | 644 PrintF(out, " - indexed_interceptor\n"); |
| 627 } | 645 } |
| 628 if (is_undetectable()) { | 646 if (is_undetectable()) { |
| 629 PrintF(" - undetectable\n"); | 647 PrintF(out, " - undetectable\n"); |
| 630 } | 648 } |
| 631 if (has_instance_call_handler()) { | 649 if (has_instance_call_handler()) { |
| 632 PrintF(" - instance_call_handler\n"); | 650 PrintF(out, " - instance_call_handler\n"); |
| 633 } | 651 } |
| 634 if (is_access_check_needed()) { | 652 if (is_access_check_needed()) { |
| 635 PrintF(" - access_check_needed\n"); | 653 PrintF(out, " - access_check_needed\n"); |
| 636 } | 654 } |
| 637 PrintF(" - instance descriptors: "); | 655 PrintF(out, " - instance descriptors: "); |
| 638 instance_descriptors()->ShortPrint(); | 656 instance_descriptors()->ShortPrint(out); |
| 639 PrintF("\n - prototype: "); | 657 PrintF(out, "\n - prototype: "); |
| 640 prototype()->ShortPrint(); | 658 prototype()->ShortPrint(out); |
| 641 PrintF("\n - constructor: "); | 659 PrintF(out, "\n - constructor: "); |
| 642 constructor()->ShortPrint(); | 660 constructor()->ShortPrint(out); |
| 643 PrintF("\n"); | 661 PrintF(out, "\n"); |
| 644 } | 662 } |
| 663 #endif // OBJECT_PRINT |
| 645 | 664 |
| 646 | 665 |
| 666 #ifdef DEBUG |
| 647 void Map::MapVerify() { | 667 void Map::MapVerify() { |
| 648 ASSERT(!Heap::InNewSpace(this)); | 668 ASSERT(!Heap::InNewSpace(this)); |
| 649 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 669 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
| 650 ASSERT(instance_size() == kVariableSizeSentinel || | 670 ASSERT(instance_size() == kVariableSizeSentinel || |
| 651 (kPointerSize <= instance_size() && | 671 (kPointerSize <= instance_size() && |
| 652 instance_size() < Heap::Capacity())); | 672 instance_size() < Heap::Capacity())); |
| 653 VerifyHeapPointer(prototype()); | 673 VerifyHeapPointer(prototype()); |
| 654 VerifyHeapPointer(instance_descriptors()); | 674 VerifyHeapPointer(instance_descriptors()); |
| 655 } | 675 } |
| 656 | 676 |
| 657 | 677 |
| 658 void Map::SharedMapVerify() { | 678 void Map::SharedMapVerify() { |
| 659 MapVerify(); | 679 MapVerify(); |
| 660 ASSERT(is_shared()); | 680 ASSERT(is_shared()); |
| 661 ASSERT_EQ(Heap::empty_descriptor_array(), instance_descriptors()); | 681 ASSERT_EQ(Heap::empty_descriptor_array(), instance_descriptors()); |
| 662 ASSERT_EQ(Heap::empty_fixed_array(), code_cache()); | 682 ASSERT_EQ(Heap::empty_fixed_array(), code_cache()); |
| 663 ASSERT_EQ(0, pre_allocated_property_fields()); | 683 ASSERT_EQ(0, pre_allocated_property_fields()); |
| 664 ASSERT_EQ(0, unused_property_fields()); | 684 ASSERT_EQ(0, unused_property_fields()); |
| 665 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), | 685 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), |
| 666 visitor_id()); | 686 visitor_id()); |
| 667 } | 687 } |
| 688 #endif // DEBUG |
| 668 | 689 |
| 669 | 690 |
| 670 void CodeCache::CodeCachePrint() { | 691 #ifdef OBJECT_PRINT |
| 671 HeapObject::PrintHeader("CodeCache"); | 692 void CodeCache::CodeCachePrint(FILE* out) { |
| 672 PrintF("\n - default_cache: "); | 693 HeapObject::PrintHeader(out, "CodeCache"); |
| 673 default_cache()->ShortPrint(); | 694 PrintF(out, "\n - default_cache: "); |
| 674 PrintF("\n - normal_type_cache: "); | 695 default_cache()->ShortPrint(out); |
| 675 normal_type_cache()->ShortPrint(); | 696 PrintF(out, "\n - normal_type_cache: "); |
| 697 normal_type_cache()->ShortPrint(out); |
| 676 } | 698 } |
| 699 #endif // OBJECT_PRINT |
| 677 | 700 |
| 678 | 701 |
| 702 #ifdef DEBUG |
| 679 void CodeCache::CodeCacheVerify() { | 703 void CodeCache::CodeCacheVerify() { |
| 680 VerifyHeapPointer(default_cache()); | 704 VerifyHeapPointer(default_cache()); |
| 681 VerifyHeapPointer(normal_type_cache()); | 705 VerifyHeapPointer(normal_type_cache()); |
| 682 ASSERT(default_cache()->IsFixedArray()); | 706 ASSERT(default_cache()->IsFixedArray()); |
| 683 ASSERT(normal_type_cache()->IsUndefined() | 707 ASSERT(normal_type_cache()->IsUndefined() |
| 684 || normal_type_cache()->IsCodeCacheHashTable()); | 708 || normal_type_cache()->IsCodeCacheHashTable()); |
| 685 } | 709 } |
| 710 #endif // DEBUG |
| 686 | 711 |
| 687 | 712 |
| 688 void FixedArray::FixedArrayPrint() { | 713 #ifdef OBJECT_PRINT |
| 689 HeapObject::PrintHeader("FixedArray"); | 714 void FixedArray::FixedArrayPrint(FILE* out) { |
| 690 PrintF(" - length: %d", length()); | 715 HeapObject::PrintHeader(out, "FixedArray"); |
| 716 PrintF(out, " - length: %d", length()); |
| 691 for (int i = 0; i < length(); i++) { | 717 for (int i = 0; i < length(); i++) { |
| 692 PrintF("\n [%d]: ", i); | 718 PrintF(out, "\n [%d]: ", i); |
| 693 get(i)->ShortPrint(); | 719 get(i)->ShortPrint(out); |
| 694 } | 720 } |
| 695 PrintF("\n"); | 721 PrintF(out, "\n"); |
| 696 } | 722 } |
| 723 #endif // OBJECT_PRINT |
| 697 | 724 |
| 698 | 725 |
| 726 #ifdef DEBUG |
| 699 void FixedArray::FixedArrayVerify() { | 727 void FixedArray::FixedArrayVerify() { |
| 700 for (int i = 0; i < length(); i++) { | 728 for (int i = 0; i < length(); i++) { |
| 701 Object* e = get(i); | 729 Object* e = get(i); |
| 702 if (e->IsHeapObject()) { | 730 if (e->IsHeapObject()) { |
| 703 VerifyHeapPointer(e); | 731 VerifyHeapPointer(e); |
| 704 } else { | 732 } else { |
| 705 e->Verify(); | 733 e->Verify(); |
| 706 } | 734 } |
| 707 } | 735 } |
| 708 } | 736 } |
| 737 #endif // DEBUG |
| 709 | 738 |
| 710 | 739 |
| 711 void JSValue::JSValuePrint() { | 740 #ifdef OBJECT_PRINT |
| 712 HeapObject::PrintHeader("ValueObject"); | 741 void JSValue::JSValuePrint(FILE* out) { |
| 713 value()->Print(); | 742 HeapObject::PrintHeader(out, "ValueObject"); |
| 743 value()->Print(out); |
| 714 } | 744 } |
| 745 #endif // OBJECT_PRINT |
| 715 | 746 |
| 716 | 747 |
| 748 #ifdef DEBUG |
| 717 void JSValue::JSValueVerify() { | 749 void JSValue::JSValueVerify() { |
| 718 Object* v = value(); | 750 Object* v = value(); |
| 719 if (v->IsHeapObject()) { | 751 if (v->IsHeapObject()) { |
| 720 VerifyHeapPointer(v); | 752 VerifyHeapPointer(v); |
| 721 } | 753 } |
| 722 } | 754 } |
| 755 #endif // DEBUG |
| 723 | 756 |
| 724 | 757 |
| 725 void String::StringPrint() { | 758 #ifdef OBJECT_PRINT |
| 759 void String::StringPrint(FILE* out) { |
| 726 if (StringShape(this).IsSymbol()) { | 760 if (StringShape(this).IsSymbol()) { |
| 727 PrintF("#"); | 761 PrintF(out, "#"); |
| 728 } else if (StringShape(this).IsCons()) { | 762 } else if (StringShape(this).IsCons()) { |
| 729 PrintF("c\""); | 763 PrintF(out, "c\""); |
| 730 } else { | 764 } else { |
| 731 PrintF("\""); | 765 PrintF(out, "\""); |
| 732 } | 766 } |
| 733 | 767 |
| 734 for (int i = 0; i < length(); i++) { | 768 const char truncated_epilogue[] = "...<truncated>"; |
| 735 PrintF("%c", Get(i)); | 769 int len = length(); |
| 770 if (!FLAG_use_verbose_printer) { |
| 771 if (len > 100) { |
| 772 len = 100 - sizeof(truncated_epilogue); |
| 773 } |
| 774 } |
| 775 for (int i = 0; i < len; i++) { |
| 776 PrintF(out, "%c", Get(i)); |
| 777 } |
| 778 if (len != length()) { |
| 779 PrintF(out, "%s", truncated_epilogue); |
| 736 } | 780 } |
| 737 | 781 |
| 738 if (!StringShape(this).IsSymbol()) PrintF("\""); | 782 if (!StringShape(this).IsSymbol()) PrintF(out, "\""); |
| 739 } | 783 } |
| 784 #endif // OBJECT_PRINT |
| 740 | 785 |
| 741 | 786 |
| 787 #ifdef DEBUG |
| 742 void String::StringVerify() { | 788 void String::StringVerify() { |
| 743 CHECK(IsString()); | 789 CHECK(IsString()); |
| 744 CHECK(length() >= 0 && length() <= Smi::kMaxValue); | 790 CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 745 if (IsSymbol()) { | 791 if (IsSymbol()) { |
| 746 CHECK(!Heap::InNewSpace(this)); | 792 CHECK(!Heap::InNewSpace(this)); |
| 747 } | 793 } |
| 748 } | 794 } |
| 795 #endif // DEBUG |
| 749 | 796 |
| 750 | 797 |
| 751 void JSFunction::JSFunctionPrint() { | 798 #ifdef OBJECT_PRINT |
| 752 HeapObject::PrintHeader("Function"); | 799 void JSFunction::JSFunctionPrint(FILE* out) { |
| 753 PrintF(" - map = 0x%p\n", reinterpret_cast<void*>(map())); | 800 HeapObject::PrintHeader(out, "Function"); |
| 754 PrintF(" - initial_map = "); | 801 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); |
| 802 PrintF(out, " - initial_map = "); |
| 755 if (has_initial_map()) { | 803 if (has_initial_map()) { |
| 756 initial_map()->ShortPrint(); | 804 initial_map()->ShortPrint(out); |
| 757 } | 805 } |
| 758 PrintF("\n - shared_info = "); | 806 PrintF(out, "\n - shared_info = "); |
| 759 shared()->ShortPrint(); | 807 shared()->ShortPrint(out); |
| 760 PrintF("\n - name = "); | 808 PrintF(out, "\n - name = "); |
| 761 shared()->name()->Print(); | 809 shared()->name()->Print(out); |
| 762 PrintF("\n - context = "); | 810 PrintF(out, "\n - context = "); |
| 763 unchecked_context()->ShortPrint(); | 811 unchecked_context()->ShortPrint(out); |
| 764 PrintF("\n - code = "); | 812 PrintF(out, "\n - code = "); |
| 765 code()->ShortPrint(); | 813 code()->ShortPrint(out); |
| 766 PrintF("\n"); | 814 PrintF(out, "\n"); |
| 767 | 815 |
| 768 PrintProperties(); | 816 PrintProperties(out); |
| 769 PrintElements(); | 817 PrintElements(out); |
| 770 | 818 |
| 771 PrintF("\n"); | 819 PrintF(out, "\n"); |
| 772 } | 820 } |
| 821 #endif // OBJECT_PRINT |
| 773 | 822 |
| 774 | 823 |
| 824 #ifdef DEBUG |
| 775 void JSFunction::JSFunctionVerify() { | 825 void JSFunction::JSFunctionVerify() { |
| 776 CHECK(IsJSFunction()); | 826 CHECK(IsJSFunction()); |
| 777 VerifyObjectField(kPrototypeOrInitialMapOffset); | 827 VerifyObjectField(kPrototypeOrInitialMapOffset); |
| 778 VerifyObjectField(kNextFunctionLinkOffset); | 828 VerifyObjectField(kNextFunctionLinkOffset); |
| 779 CHECK(next_function_link()->IsUndefined() || | 829 CHECK(next_function_link()->IsUndefined() || |
| 780 next_function_link()->IsJSFunction()); | 830 next_function_link()->IsJSFunction()); |
| 781 } | 831 } |
| 832 #endif // DEBUG |
| 782 | 833 |
| 783 | 834 |
| 784 void SharedFunctionInfo::SharedFunctionInfoPrint() { | 835 #ifdef OBJECT_PRINT |
| 785 HeapObject::PrintHeader("SharedFunctionInfo"); | 836 void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) { |
| 786 PrintF(" - name: "); | 837 HeapObject::PrintHeader(out, "SharedFunctionInfo"); |
| 787 name()->ShortPrint(); | 838 PrintF(out, " - name: "); |
| 788 PrintF("\n - expected_nof_properties: %d", expected_nof_properties()); | 839 name()->ShortPrint(out); |
| 789 PrintF("\n - instance class name = "); | 840 PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties()); |
| 790 instance_class_name()->Print(); | 841 PrintF(out, "\n - instance class name = "); |
| 791 PrintF("\n - code = "); | 842 instance_class_name()->Print(out); |
| 792 code()->ShortPrint(); | 843 PrintF(out, "\n - code = "); |
| 793 PrintF("\n - source code = "); | 844 code()->ShortPrint(out); |
| 794 GetSourceCode()->ShortPrint(); | 845 PrintF(out, "\n - source code = "); |
| 846 GetSourceCode()->ShortPrint(out); |
| 795 // Script files are often large, hard to read. | 847 // Script files are often large, hard to read. |
| 796 // PrintF("\n - script ="); | 848 // PrintF(out, "\n - script ="); |
| 797 // script()->Print(); | 849 // script()->Print(out); |
| 798 PrintF("\n - function token position = %d", function_token_position()); | 850 PrintF(out, "\n - function token position = %d", function_token_position()); |
| 799 PrintF("\n - start position = %d", start_position()); | 851 PrintF(out, "\n - start position = %d", start_position()); |
| 800 PrintF("\n - end position = %d", end_position()); | 852 PrintF(out, "\n - end position = %d", end_position()); |
| 801 PrintF("\n - is expression = %d", is_expression()); | 853 PrintF(out, "\n - is expression = %d", is_expression()); |
| 802 PrintF("\n - debug info = "); | 854 PrintF(out, "\n - debug info = "); |
| 803 debug_info()->ShortPrint(); | 855 debug_info()->ShortPrint(out); |
| 804 PrintF("\n - length = %d", length()); | 856 PrintF(out, "\n - length = %d", length()); |
| 805 PrintF("\n - has_only_simple_this_property_assignments = %d", | 857 PrintF(out, "\n - has_only_simple_this_property_assignments = %d", |
| 806 has_only_simple_this_property_assignments()); | 858 has_only_simple_this_property_assignments()); |
| 807 PrintF("\n - this_property_assignments = "); | 859 PrintF(out, "\n - this_property_assignments = "); |
| 808 this_property_assignments()->ShortPrint(); | 860 this_property_assignments()->ShortPrint(out); |
| 809 PrintF("\n"); | 861 PrintF(out, "\n"); |
| 810 } | 862 } |
| 863 #endif // OBJECT_PRINT |
| 811 | 864 |
| 865 |
| 866 #ifdef DEBUG |
| 812 void SharedFunctionInfo::SharedFunctionInfoVerify() { | 867 void SharedFunctionInfo::SharedFunctionInfoVerify() { |
| 813 CHECK(IsSharedFunctionInfo()); | 868 CHECK(IsSharedFunctionInfo()); |
| 814 VerifyObjectField(kNameOffset); | 869 VerifyObjectField(kNameOffset); |
| 815 VerifyObjectField(kCodeOffset); | 870 VerifyObjectField(kCodeOffset); |
| 816 VerifyObjectField(kScopeInfoOffset); | 871 VerifyObjectField(kScopeInfoOffset); |
| 817 VerifyObjectField(kInstanceClassNameOffset); | 872 VerifyObjectField(kInstanceClassNameOffset); |
| 818 VerifyObjectField(kFunctionDataOffset); | 873 VerifyObjectField(kFunctionDataOffset); |
| 819 VerifyObjectField(kScriptOffset); | 874 VerifyObjectField(kScriptOffset); |
| 820 VerifyObjectField(kDebugInfoOffset); | 875 VerifyObjectField(kDebugInfoOffset); |
| 821 } | 876 } |
| 877 #endif // DEBUG |
| 822 | 878 |
| 823 | 879 |
| 824 void JSGlobalProxy::JSGlobalProxyPrint() { | 880 #ifdef OBJECT_PRINT |
| 825 PrintF("global_proxy"); | 881 void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) { |
| 826 JSObjectPrint(); | 882 PrintF(out, "global_proxy"); |
| 827 PrintF("context : "); | 883 JSObjectPrint(out); |
| 828 context()->ShortPrint(); | 884 PrintF(out, "context : "); |
| 829 PrintF("\n"); | 885 context()->ShortPrint(out); |
| 886 PrintF(out, "\n"); |
| 830 } | 887 } |
| 888 #endif // OBJECT_PRINT |
| 831 | 889 |
| 832 | 890 |
| 891 #ifdef DEBUG |
| 833 void JSGlobalProxy::JSGlobalProxyVerify() { | 892 void JSGlobalProxy::JSGlobalProxyVerify() { |
| 834 CHECK(IsJSGlobalProxy()); | 893 CHECK(IsJSGlobalProxy()); |
| 835 JSObjectVerify(); | 894 JSObjectVerify(); |
| 836 VerifyObjectField(JSGlobalProxy::kContextOffset); | 895 VerifyObjectField(JSGlobalProxy::kContextOffset); |
| 837 // Make sure that this object has no properties, elements. | 896 // Make sure that this object has no properties, elements. |
| 838 CHECK_EQ(0, properties()->length()); | 897 CHECK_EQ(0, properties()->length()); |
| 839 CHECK(HasFastElements()); | 898 CHECK(HasFastElements()); |
| 840 CHECK_EQ(0, FixedArray::cast(elements())->length()); | 899 CHECK_EQ(0, FixedArray::cast(elements())->length()); |
| 841 } | 900 } |
| 901 #endif // DEBUG |
| 842 | 902 |
| 843 | 903 |
| 844 void JSGlobalObject::JSGlobalObjectPrint() { | 904 #ifdef OBJECT_PRINT |
| 845 PrintF("global "); | 905 void JSGlobalObject::JSGlobalObjectPrint(FILE* out) { |
| 846 JSObjectPrint(); | 906 PrintF(out, "global "); |
| 847 PrintF("global context : "); | 907 JSObjectPrint(out); |
| 848 global_context()->ShortPrint(); | 908 PrintF(out, "global context : "); |
| 849 PrintF("\n"); | 909 global_context()->ShortPrint(out); |
| 910 PrintF(out, "\n"); |
| 850 } | 911 } |
| 912 #endif // OBJECT_PRINT |
| 851 | 913 |
| 852 | 914 |
| 915 #ifdef DEBUG |
| 853 void JSGlobalObject::JSGlobalObjectVerify() { | 916 void JSGlobalObject::JSGlobalObjectVerify() { |
| 854 CHECK(IsJSGlobalObject()); | 917 CHECK(IsJSGlobalObject()); |
| 855 JSObjectVerify(); | 918 JSObjectVerify(); |
| 856 for (int i = GlobalObject::kBuiltinsOffset; | 919 for (int i = GlobalObject::kBuiltinsOffset; |
| 857 i < JSGlobalObject::kSize; | 920 i < JSGlobalObject::kSize; |
| 858 i += kPointerSize) { | 921 i += kPointerSize) { |
| 859 VerifyObjectField(i); | 922 VerifyObjectField(i); |
| 860 } | 923 } |
| 861 } | 924 } |
| 925 #endif // DEBUG |
| 862 | 926 |
| 863 | 927 |
| 864 void JSBuiltinsObject::JSBuiltinsObjectPrint() { | 928 #ifdef OBJECT_PRINT |
| 865 PrintF("builtins "); | 929 void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) { |
| 866 JSObjectPrint(); | 930 PrintF(out, "builtins "); |
| 931 JSObjectPrint(out); |
| 867 } | 932 } |
| 933 #endif // OBJECT_PRINT |
| 868 | 934 |
| 869 | 935 |
| 936 #ifdef DEBUG |
| 870 void JSBuiltinsObject::JSBuiltinsObjectVerify() { | 937 void JSBuiltinsObject::JSBuiltinsObjectVerify() { |
| 871 CHECK(IsJSBuiltinsObject()); | 938 CHECK(IsJSBuiltinsObject()); |
| 872 JSObjectVerify(); | 939 JSObjectVerify(); |
| 873 for (int i = GlobalObject::kBuiltinsOffset; | 940 for (int i = GlobalObject::kBuiltinsOffset; |
| 874 i < JSBuiltinsObject::kSize; | 941 i < JSBuiltinsObject::kSize; |
| 875 i += kPointerSize) { | 942 i += kPointerSize) { |
| 876 VerifyObjectField(i); | 943 VerifyObjectField(i); |
| 877 } | 944 } |
| 878 } | 945 } |
| 879 | 946 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 890 ASSERT(value == 0 || value == 1 || value == -1 || | 957 ASSERT(value == 0 || value == 1 || value == -1 || |
| 891 value == -2 || value == -3); | 958 value == -2 || value == -3); |
| 892 } | 959 } |
| 893 } | 960 } |
| 894 | 961 |
| 895 | 962 |
| 896 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { | 963 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { |
| 897 CHECK(IsJSGlobalPropertyCell()); | 964 CHECK(IsJSGlobalPropertyCell()); |
| 898 VerifyObjectField(kValueOffset); | 965 VerifyObjectField(kValueOffset); |
| 899 } | 966 } |
| 967 #endif // DEBUG |
| 900 | 968 |
| 901 | 969 |
| 902 void JSGlobalPropertyCell::JSGlobalPropertyCellPrint() { | 970 #ifdef OBJECT_PRINT |
| 903 HeapObject::PrintHeader("JSGlobalPropertyCell"); | 971 void JSGlobalPropertyCell::JSGlobalPropertyCellPrint(FILE* out) { |
| 972 HeapObject::PrintHeader(out, "JSGlobalPropertyCell"); |
| 904 } | 973 } |
| 905 | 974 |
| 906 | 975 |
| 907 void Code::CodePrint() { | 976 void Code::CodePrint(FILE* out) { |
| 908 HeapObject::PrintHeader("Code"); | 977 HeapObject::PrintHeader(out, "Code"); |
| 909 #ifdef ENABLE_DISASSEMBLER | 978 #ifdef ENABLE_DISASSEMBLER |
| 910 Disassemble(NULL); | 979 if (FLAG_use_verbose_printer) { |
| 980 Disassemble(NULL, out); |
| 981 } |
| 911 #endif | 982 #endif |
| 912 } | 983 } |
| 984 #endif // OBJECT_PRINT |
| 913 | 985 |
| 914 | 986 |
| 987 #ifdef DEBUG |
| 915 void Code::CodeVerify() { | 988 void Code::CodeVerify() { |
| 916 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), | 989 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), |
| 917 kCodeAlignment)); | 990 kCodeAlignment)); |
| 918 Address last_gc_pc = NULL; | 991 Address last_gc_pc = NULL; |
| 919 for (RelocIterator it(this); !it.done(); it.next()) { | 992 for (RelocIterator it(this); !it.done(); it.next()) { |
| 920 it.rinfo()->Verify(); | 993 it.rinfo()->Verify(); |
| 921 // Ensure that GC will not iterate twice over the same pointer. | 994 // Ensure that GC will not iterate twice over the same pointer. |
| 922 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { | 995 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { |
| 923 CHECK(it.rinfo()->pc() != last_gc_pc); | 996 CHECK(it.rinfo()->pc() != last_gc_pc); |
| 924 last_gc_pc = it.rinfo()->pc(); | 997 last_gc_pc = it.rinfo()->pc(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); | 1032 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); |
| 960 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); | 1033 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); |
| 961 break; | 1034 break; |
| 962 } | 1035 } |
| 963 default: | 1036 default: |
| 964 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); | 1037 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); |
| 965 ASSERT(data()->IsUndefined()); | 1038 ASSERT(data()->IsUndefined()); |
| 966 break; | 1039 break; |
| 967 } | 1040 } |
| 968 } | 1041 } |
| 1042 #endif // DEBUG |
| 969 | 1043 |
| 970 | 1044 |
| 971 void Proxy::ProxyPrint() { | 1045 #ifdef OBJECT_PRINT |
| 972 PrintF("proxy to %p", proxy()); | 1046 void Proxy::ProxyPrint(FILE* out) { |
| 1047 PrintF(out, "proxy to %p", proxy()); |
| 973 } | 1048 } |
| 1049 #endif // OBJECT_PRINT |
| 974 | 1050 |
| 975 | 1051 |
| 1052 #ifdef DEBUG |
| 976 void Proxy::ProxyVerify() { | 1053 void Proxy::ProxyVerify() { |
| 977 ASSERT(IsProxy()); | 1054 ASSERT(IsProxy()); |
| 978 } | 1055 } |
| 979 | 1056 |
| 980 | 1057 |
| 981 void AccessorInfo::AccessorInfoVerify() { | 1058 void AccessorInfo::AccessorInfoVerify() { |
| 982 CHECK(IsAccessorInfo()); | 1059 CHECK(IsAccessorInfo()); |
| 983 VerifyPointer(getter()); | 1060 VerifyPointer(getter()); |
| 984 VerifyPointer(setter()); | 1061 VerifyPointer(setter()); |
| 985 VerifyPointer(name()); | 1062 VerifyPointer(name()); |
| 986 VerifyPointer(data()); | 1063 VerifyPointer(data()); |
| 987 VerifyPointer(flag()); | 1064 VerifyPointer(flag()); |
| 988 } | 1065 } |
| 1066 #endif // DEBUG |
| 989 | 1067 |
| 990 void AccessorInfo::AccessorInfoPrint() { | 1068 |
| 991 HeapObject::PrintHeader("AccessorInfo"); | 1069 #ifdef OBJECT_PRINT |
| 992 PrintF("\n - getter: "); | 1070 void AccessorInfo::AccessorInfoPrint(FILE* out) { |
| 993 getter()->ShortPrint(); | 1071 HeapObject::PrintHeader(out, "AccessorInfo"); |
| 994 PrintF("\n - setter: "); | 1072 PrintF(out, "\n - getter: "); |
| 995 setter()->ShortPrint(); | 1073 getter()->ShortPrint(out); |
| 996 PrintF("\n - name: "); | 1074 PrintF(out, "\n - setter: "); |
| 997 name()->ShortPrint(); | 1075 setter()->ShortPrint(out); |
| 998 PrintF("\n - data: "); | 1076 PrintF(out, "\n - name: "); |
| 999 data()->ShortPrint(); | 1077 name()->ShortPrint(out); |
| 1000 PrintF("\n - flag: "); | 1078 PrintF(out, "\n - data: "); |
| 1001 flag()->ShortPrint(); | 1079 data()->ShortPrint(out); |
| 1080 PrintF(out, "\n - flag: "); |
| 1081 flag()->ShortPrint(out); |
| 1002 } | 1082 } |
| 1083 #endif // OBJECT_PRINT |
| 1003 | 1084 |
| 1085 |
| 1086 #ifdef DEBUG |
| 1004 void AccessCheckInfo::AccessCheckInfoVerify() { | 1087 void AccessCheckInfo::AccessCheckInfoVerify() { |
| 1005 CHECK(IsAccessCheckInfo()); | 1088 CHECK(IsAccessCheckInfo()); |
| 1006 VerifyPointer(named_callback()); | 1089 VerifyPointer(named_callback()); |
| 1007 VerifyPointer(indexed_callback()); | 1090 VerifyPointer(indexed_callback()); |
| 1008 VerifyPointer(data()); | 1091 VerifyPointer(data()); |
| 1009 } | 1092 } |
| 1093 #endif // DEBUG |
| 1010 | 1094 |
| 1011 void AccessCheckInfo::AccessCheckInfoPrint() { | 1095 |
| 1012 HeapObject::PrintHeader("AccessCheckInfo"); | 1096 #ifdef OBJECT_PRINT |
| 1013 PrintF("\n - named_callback: "); | 1097 void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) { |
| 1014 named_callback()->ShortPrint(); | 1098 HeapObject::PrintHeader(out, "AccessCheckInfo"); |
| 1015 PrintF("\n - indexed_callback: "); | 1099 PrintF(out, "\n - named_callback: "); |
| 1016 indexed_callback()->ShortPrint(); | 1100 named_callback()->ShortPrint(out); |
| 1017 PrintF("\n - data: "); | 1101 PrintF(out, "\n - indexed_callback: "); |
| 1018 data()->ShortPrint(); | 1102 indexed_callback()->ShortPrint(out); |
| 1103 PrintF(out, "\n - data: "); |
| 1104 data()->ShortPrint(out); |
| 1019 } | 1105 } |
| 1106 #endif // OBJECT_PRINT |
| 1020 | 1107 |
| 1108 |
| 1109 #ifdef DEBUG |
| 1021 void InterceptorInfo::InterceptorInfoVerify() { | 1110 void InterceptorInfo::InterceptorInfoVerify() { |
| 1022 CHECK(IsInterceptorInfo()); | 1111 CHECK(IsInterceptorInfo()); |
| 1023 VerifyPointer(getter()); | 1112 VerifyPointer(getter()); |
| 1024 VerifyPointer(setter()); | 1113 VerifyPointer(setter()); |
| 1025 VerifyPointer(query()); | 1114 VerifyPointer(query()); |
| 1026 VerifyPointer(deleter()); | 1115 VerifyPointer(deleter()); |
| 1027 VerifyPointer(enumerator()); | 1116 VerifyPointer(enumerator()); |
| 1028 VerifyPointer(data()); | 1117 VerifyPointer(data()); |
| 1029 } | 1118 } |
| 1119 #endif // DEBUG |
| 1030 | 1120 |
| 1031 void InterceptorInfo::InterceptorInfoPrint() { | 1121 |
| 1032 HeapObject::PrintHeader("InterceptorInfo"); | 1122 #ifdef OBJECT_PRINT |
| 1033 PrintF("\n - getter: "); | 1123 void InterceptorInfo::InterceptorInfoPrint(FILE* out) { |
| 1034 getter()->ShortPrint(); | 1124 HeapObject::PrintHeader(out, "InterceptorInfo"); |
| 1035 PrintF("\n - setter: "); | 1125 PrintF(out, "\n - getter: "); |
| 1036 setter()->ShortPrint(); | 1126 getter()->ShortPrint(out); |
| 1037 PrintF("\n - query: "); | 1127 PrintF(out, "\n - setter: "); |
| 1038 query()->ShortPrint(); | 1128 setter()->ShortPrint(out); |
| 1039 PrintF("\n - deleter: "); | 1129 PrintF(out, "\n - query: "); |
| 1040 deleter()->ShortPrint(); | 1130 query()->ShortPrint(out); |
| 1041 PrintF("\n - enumerator: "); | 1131 PrintF(out, "\n - deleter: "); |
| 1042 enumerator()->ShortPrint(); | 1132 deleter()->ShortPrint(out); |
| 1043 PrintF("\n - data: "); | 1133 PrintF(out, "\n - enumerator: "); |
| 1044 data()->ShortPrint(); | 1134 enumerator()->ShortPrint(out); |
| 1135 PrintF(out, "\n - data: "); |
| 1136 data()->ShortPrint(out); |
| 1045 } | 1137 } |
| 1138 #endif // OBJECT_PRINT |
| 1046 | 1139 |
| 1140 |
| 1141 #ifdef DEBUG |
| 1047 void CallHandlerInfo::CallHandlerInfoVerify() { | 1142 void CallHandlerInfo::CallHandlerInfoVerify() { |
| 1048 CHECK(IsCallHandlerInfo()); | 1143 CHECK(IsCallHandlerInfo()); |
| 1049 VerifyPointer(callback()); | 1144 VerifyPointer(callback()); |
| 1050 VerifyPointer(data()); | 1145 VerifyPointer(data()); |
| 1051 } | 1146 } |
| 1147 #endif // DEBUG |
| 1052 | 1148 |
| 1053 void CallHandlerInfo::CallHandlerInfoPrint() { | 1149 |
| 1054 HeapObject::PrintHeader("CallHandlerInfo"); | 1150 #ifdef OBJECT_PRINT |
| 1055 PrintF("\n - callback: "); | 1151 void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) { |
| 1056 callback()->ShortPrint(); | 1152 HeapObject::PrintHeader(out, "CallHandlerInfo"); |
| 1057 PrintF("\n - data: "); | 1153 PrintF(out, "\n - callback: "); |
| 1058 data()->ShortPrint(); | 1154 callback()->ShortPrint(out); |
| 1059 PrintF("\n - call_stub_cache: "); | 1155 PrintF(out, "\n - data: "); |
| 1156 data()->ShortPrint(out); |
| 1157 PrintF(out, "\n - call_stub_cache: "); |
| 1060 } | 1158 } |
| 1159 #endif // OBJECT_PRINT |
| 1061 | 1160 |
| 1161 |
| 1162 #ifdef DEBUG |
| 1062 void TemplateInfo::TemplateInfoVerify() { | 1163 void TemplateInfo::TemplateInfoVerify() { |
| 1063 VerifyPointer(tag()); | 1164 VerifyPointer(tag()); |
| 1064 VerifyPointer(property_list()); | 1165 VerifyPointer(property_list()); |
| 1065 } | 1166 } |
| 1066 | 1167 |
| 1067 void FunctionTemplateInfo::FunctionTemplateInfoVerify() { | 1168 void FunctionTemplateInfo::FunctionTemplateInfoVerify() { |
| 1068 CHECK(IsFunctionTemplateInfo()); | 1169 CHECK(IsFunctionTemplateInfo()); |
| 1069 TemplateInfoVerify(); | 1170 TemplateInfoVerify(); |
| 1070 VerifyPointer(serial_number()); | 1171 VerifyPointer(serial_number()); |
| 1071 VerifyPointer(call_code()); | 1172 VerifyPointer(call_code()); |
| 1072 VerifyPointer(property_accessors()); | 1173 VerifyPointer(property_accessors()); |
| 1073 VerifyPointer(prototype_template()); | 1174 VerifyPointer(prototype_template()); |
| 1074 VerifyPointer(parent_template()); | 1175 VerifyPointer(parent_template()); |
| 1075 VerifyPointer(named_property_handler()); | 1176 VerifyPointer(named_property_handler()); |
| 1076 VerifyPointer(indexed_property_handler()); | 1177 VerifyPointer(indexed_property_handler()); |
| 1077 VerifyPointer(instance_template()); | 1178 VerifyPointer(instance_template()); |
| 1078 VerifyPointer(signature()); | 1179 VerifyPointer(signature()); |
| 1079 VerifyPointer(access_check_info()); | 1180 VerifyPointer(access_check_info()); |
| 1080 } | 1181 } |
| 1182 #endif // DEBUG |
| 1081 | 1183 |
| 1082 void FunctionTemplateInfo::FunctionTemplateInfoPrint() { | 1184 |
| 1083 HeapObject::PrintHeader("FunctionTemplateInfo"); | 1185 #ifdef OBJECT_PRINT |
| 1084 PrintF("\n - class name: "); | 1186 void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) { |
| 1085 class_name()->ShortPrint(); | 1187 HeapObject::PrintHeader(out, "FunctionTemplateInfo"); |
| 1086 PrintF("\n - tag: "); | 1188 PrintF(out, "\n - class name: "); |
| 1087 tag()->ShortPrint(); | 1189 class_name()->ShortPrint(out); |
| 1088 PrintF("\n - property_list: "); | 1190 PrintF(out, "\n - tag: "); |
| 1089 property_list()->ShortPrint(); | 1191 tag()->ShortPrint(out); |
| 1090 PrintF("\n - serial_number: "); | 1192 PrintF(out, "\n - property_list: "); |
| 1091 serial_number()->ShortPrint(); | 1193 property_list()->ShortPrint(out); |
| 1092 PrintF("\n - call_code: "); | 1194 PrintF(out, "\n - serial_number: "); |
| 1093 call_code()->ShortPrint(); | 1195 serial_number()->ShortPrint(out); |
| 1094 PrintF("\n - property_accessors: "); | 1196 PrintF(out, "\n - call_code: "); |
| 1095 property_accessors()->ShortPrint(); | 1197 call_code()->ShortPrint(out); |
| 1096 PrintF("\n - prototype_template: "); | 1198 PrintF(out, "\n - property_accessors: "); |
| 1097 prototype_template()->ShortPrint(); | 1199 property_accessors()->ShortPrint(out); |
| 1098 PrintF("\n - parent_template: "); | 1200 PrintF(out, "\n - prototype_template: "); |
| 1099 parent_template()->ShortPrint(); | 1201 prototype_template()->ShortPrint(out); |
| 1100 PrintF("\n - named_property_handler: "); | 1202 PrintF(out, "\n - parent_template: "); |
| 1101 named_property_handler()->ShortPrint(); | 1203 parent_template()->ShortPrint(out); |
| 1102 PrintF("\n - indexed_property_handler: "); | 1204 PrintF(out, "\n - named_property_handler: "); |
| 1103 indexed_property_handler()->ShortPrint(); | 1205 named_property_handler()->ShortPrint(out); |
| 1104 PrintF("\n - instance_template: "); | 1206 PrintF(out, "\n - indexed_property_handler: "); |
| 1105 instance_template()->ShortPrint(); | 1207 indexed_property_handler()->ShortPrint(out); |
| 1106 PrintF("\n - signature: "); | 1208 PrintF(out, "\n - instance_template: "); |
| 1107 signature()->ShortPrint(); | 1209 instance_template()->ShortPrint(out); |
| 1108 PrintF("\n - access_check_info: "); | 1210 PrintF(out, "\n - signature: "); |
| 1109 access_check_info()->ShortPrint(); | 1211 signature()->ShortPrint(out); |
| 1110 PrintF("\n - hidden_prototype: %s", hidden_prototype() ? "true" : "false"); | 1212 PrintF(out, "\n - access_check_info: "); |
| 1111 PrintF("\n - undetectable: %s", undetectable() ? "true" : "false"); | 1213 access_check_info()->ShortPrint(out); |
| 1112 PrintF("\n - need_access_check: %s", needs_access_check() ? "true" : "false"); | 1214 PrintF(out, "\n - hidden_prototype: %s", |
| 1215 hidden_prototype() ? "true" : "false"); |
| 1216 PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false"); |
| 1217 PrintF(out, "\n - need_access_check: %s", |
| 1218 needs_access_check() ? "true" : "false"); |
| 1113 } | 1219 } |
| 1220 #endif // OBJECT_PRINT |
| 1114 | 1221 |
| 1222 |
| 1223 #ifdef DEBUG |
| 1115 void ObjectTemplateInfo::ObjectTemplateInfoVerify() { | 1224 void ObjectTemplateInfo::ObjectTemplateInfoVerify() { |
| 1116 CHECK(IsObjectTemplateInfo()); | 1225 CHECK(IsObjectTemplateInfo()); |
| 1117 TemplateInfoVerify(); | 1226 TemplateInfoVerify(); |
| 1118 VerifyPointer(constructor()); | 1227 VerifyPointer(constructor()); |
| 1119 VerifyPointer(internal_field_count()); | 1228 VerifyPointer(internal_field_count()); |
| 1120 } | 1229 } |
| 1230 #endif // DEBUG |
| 1121 | 1231 |
| 1122 void ObjectTemplateInfo::ObjectTemplateInfoPrint() { | 1232 |
| 1123 HeapObject::PrintHeader("ObjectTemplateInfo"); | 1233 #ifdef OBJECT_PRINT |
| 1124 PrintF("\n - constructor: "); | 1234 void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) { |
| 1125 constructor()->ShortPrint(); | 1235 HeapObject::PrintHeader(out, "ObjectTemplateInfo"); |
| 1126 PrintF("\n - internal_field_count: "); | 1236 PrintF(out, "\n - constructor: "); |
| 1127 internal_field_count()->ShortPrint(); | 1237 constructor()->ShortPrint(out); |
| 1238 PrintF(out, "\n - internal_field_count: "); |
| 1239 internal_field_count()->ShortPrint(out); |
| 1128 } | 1240 } |
| 1241 #endif // OBJECT_PRINT |
| 1129 | 1242 |
| 1243 |
| 1244 #ifdef DEBUG |
| 1130 void SignatureInfo::SignatureInfoVerify() { | 1245 void SignatureInfo::SignatureInfoVerify() { |
| 1131 CHECK(IsSignatureInfo()); | 1246 CHECK(IsSignatureInfo()); |
| 1132 VerifyPointer(receiver()); | 1247 VerifyPointer(receiver()); |
| 1133 VerifyPointer(args()); | 1248 VerifyPointer(args()); |
| 1134 } | 1249 } |
| 1250 #endif // DEBUG |
| 1135 | 1251 |
| 1136 void SignatureInfo::SignatureInfoPrint() { | 1252 |
| 1137 HeapObject::PrintHeader("SignatureInfo"); | 1253 #ifdef OBJECT_PRINT |
| 1138 PrintF("\n - receiver: "); | 1254 void SignatureInfo::SignatureInfoPrint(FILE* out) { |
| 1139 receiver()->ShortPrint(); | 1255 HeapObject::PrintHeader(out, "SignatureInfo"); |
| 1140 PrintF("\n - args: "); | 1256 PrintF(out, "\n - receiver: "); |
| 1141 args()->ShortPrint(); | 1257 receiver()->ShortPrint(out); |
| 1258 PrintF(out, "\n - args: "); |
| 1259 args()->ShortPrint(out); |
| 1142 } | 1260 } |
| 1261 #endif // OBJECT_PRINT |
| 1143 | 1262 |
| 1263 |
| 1264 #ifdef DEBUG |
| 1144 void TypeSwitchInfo::TypeSwitchInfoVerify() { | 1265 void TypeSwitchInfo::TypeSwitchInfoVerify() { |
| 1145 CHECK(IsTypeSwitchInfo()); | 1266 CHECK(IsTypeSwitchInfo()); |
| 1146 VerifyPointer(types()); | 1267 VerifyPointer(types()); |
| 1147 } | 1268 } |
| 1148 | 1269 #endif // DEBUG |
| 1149 void TypeSwitchInfo::TypeSwitchInfoPrint() { | |
| 1150 HeapObject::PrintHeader("TypeSwitchInfo"); | |
| 1151 PrintF("\n - types: "); | |
| 1152 types()->ShortPrint(); | |
| 1153 } | |
| 1154 | 1270 |
| 1155 | 1271 |
| 1272 #ifdef OBJECT_PRINT |
| 1273 void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) { |
| 1274 HeapObject::PrintHeader(out, "TypeSwitchInfo"); |
| 1275 PrintF(out, "\n - types: "); |
| 1276 types()->ShortPrint(out); |
| 1277 } |
| 1278 #endif // OBJECT_PRINT |
| 1279 |
| 1280 |
| 1281 #ifdef DEBUG |
| 1156 void Script::ScriptVerify() { | 1282 void Script::ScriptVerify() { |
| 1157 CHECK(IsScript()); | 1283 CHECK(IsScript()); |
| 1158 VerifyPointer(source()); | 1284 VerifyPointer(source()); |
| 1159 VerifyPointer(name()); | 1285 VerifyPointer(name()); |
| 1160 line_offset()->SmiVerify(); | 1286 line_offset()->SmiVerify(); |
| 1161 column_offset()->SmiVerify(); | 1287 column_offset()->SmiVerify(); |
| 1162 VerifyPointer(data()); | 1288 VerifyPointer(data()); |
| 1163 VerifyPointer(wrapper()); | 1289 VerifyPointer(wrapper()); |
| 1164 type()->SmiVerify(); | 1290 type()->SmiVerify(); |
| 1165 VerifyPointer(line_ends()); | 1291 VerifyPointer(line_ends()); |
| 1166 VerifyPointer(id()); | 1292 VerifyPointer(id()); |
| 1167 } | 1293 } |
| 1294 #endif // DEBUG |
| 1168 | 1295 |
| 1169 | 1296 |
| 1170 void Script::ScriptPrint() { | 1297 #ifdef OBJECT_PRINT |
| 1171 HeapObject::PrintHeader("Script"); | 1298 void Script::ScriptPrint(FILE* out) { |
| 1172 PrintF("\n - source: "); | 1299 HeapObject::PrintHeader(out, "Script"); |
| 1173 source()->ShortPrint(); | 1300 PrintF(out, "\n - source: "); |
| 1174 PrintF("\n - name: "); | 1301 source()->ShortPrint(out); |
| 1175 name()->ShortPrint(); | 1302 PrintF(out, "\n - name: "); |
| 1176 PrintF("\n - line_offset: "); | 1303 name()->ShortPrint(out); |
| 1177 line_offset()->ShortPrint(); | 1304 PrintF(out, "\n - line_offset: "); |
| 1178 PrintF("\n - column_offset: "); | 1305 line_offset()->ShortPrint(out); |
| 1179 column_offset()->ShortPrint(); | 1306 PrintF(out, "\n - column_offset: "); |
| 1180 PrintF("\n - type: "); | 1307 column_offset()->ShortPrint(out); |
| 1181 type()->ShortPrint(); | 1308 PrintF(out, "\n - type: "); |
| 1182 PrintF("\n - id: "); | 1309 type()->ShortPrint(out); |
| 1183 id()->ShortPrint(); | 1310 PrintF(out, "\n - id: "); |
| 1184 PrintF("\n - data: "); | 1311 id()->ShortPrint(out); |
| 1185 data()->ShortPrint(); | 1312 PrintF(out, "\n - data: "); |
| 1186 PrintF("\n - context data: "); | 1313 data()->ShortPrint(out); |
| 1187 context_data()->ShortPrint(); | 1314 PrintF(out, "\n - context data: "); |
| 1188 PrintF("\n - wrapper: "); | 1315 context_data()->ShortPrint(out); |
| 1189 wrapper()->ShortPrint(); | 1316 PrintF(out, "\n - wrapper: "); |
| 1190 PrintF("\n - compilation type: "); | 1317 wrapper()->ShortPrint(out); |
| 1191 compilation_type()->ShortPrint(); | 1318 PrintF(out, "\n - compilation type: "); |
| 1192 PrintF("\n - line ends: "); | 1319 compilation_type()->ShortPrint(out); |
| 1193 line_ends()->ShortPrint(); | 1320 PrintF(out, "\n - line ends: "); |
| 1194 PrintF("\n - eval from shared: "); | 1321 line_ends()->ShortPrint(out); |
| 1195 eval_from_shared()->ShortPrint(); | 1322 PrintF(out, "\n - eval from shared: "); |
| 1196 PrintF("\n - eval from instructions offset: "); | 1323 eval_from_shared()->ShortPrint(out); |
| 1197 eval_from_instructions_offset()->ShortPrint(); | 1324 PrintF(out, "\n - eval from instructions offset: "); |
| 1198 PrintF("\n"); | 1325 eval_from_instructions_offset()->ShortPrint(out); |
| 1326 PrintF(out, "\n"); |
| 1199 } | 1327 } |
| 1328 #endif // OBJECT_PRINT |
| 1200 | 1329 |
| 1201 | 1330 |
| 1202 #ifdef ENABLE_DEBUGGER_SUPPORT | 1331 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1332 #ifdef DEBUG |
| 1203 void DebugInfo::DebugInfoVerify() { | 1333 void DebugInfo::DebugInfoVerify() { |
| 1204 CHECK(IsDebugInfo()); | 1334 CHECK(IsDebugInfo()); |
| 1205 VerifyPointer(shared()); | 1335 VerifyPointer(shared()); |
| 1206 VerifyPointer(original_code()); | 1336 VerifyPointer(original_code()); |
| 1207 VerifyPointer(code()); | 1337 VerifyPointer(code()); |
| 1208 VerifyPointer(break_points()); | 1338 VerifyPointer(break_points()); |
| 1209 } | 1339 } |
| 1340 #endif // DEBUG |
| 1210 | 1341 |
| 1211 | 1342 |
| 1212 void DebugInfo::DebugInfoPrint() { | 1343 #ifdef OBJECT_PRINT |
| 1213 HeapObject::PrintHeader("DebugInfo"); | 1344 void DebugInfo::DebugInfoPrint(FILE* out) { |
| 1214 PrintF("\n - shared: "); | 1345 HeapObject::PrintHeader(out, "DebugInfo"); |
| 1215 shared()->ShortPrint(); | 1346 PrintF(out, "\n - shared: "); |
| 1216 PrintF("\n - original_code: "); | 1347 shared()->ShortPrint(out); |
| 1217 original_code()->ShortPrint(); | 1348 PrintF(out, "\n - original_code: "); |
| 1218 PrintF("\n - code: "); | 1349 original_code()->ShortPrint(out); |
| 1219 code()->ShortPrint(); | 1350 PrintF(out, "\n - code: "); |
| 1220 PrintF("\n - break_points: "); | 1351 code()->ShortPrint(out); |
| 1221 break_points()->Print(); | 1352 PrintF(out, "\n - break_points: "); |
| 1353 break_points()->Print(out); |
| 1222 } | 1354 } |
| 1355 #endif // OBJECT_PRINT |
| 1223 | 1356 |
| 1224 | 1357 |
| 1358 #ifdef DEBUG |
| 1225 void BreakPointInfo::BreakPointInfoVerify() { | 1359 void BreakPointInfo::BreakPointInfoVerify() { |
| 1226 CHECK(IsBreakPointInfo()); | 1360 CHECK(IsBreakPointInfo()); |
| 1227 code_position()->SmiVerify(); | 1361 code_position()->SmiVerify(); |
| 1228 source_position()->SmiVerify(); | 1362 source_position()->SmiVerify(); |
| 1229 statement_position()->SmiVerify(); | 1363 statement_position()->SmiVerify(); |
| 1230 VerifyPointer(break_point_objects()); | 1364 VerifyPointer(break_point_objects()); |
| 1231 } | 1365 } |
| 1366 #endif // DEBUG |
| 1232 | 1367 |
| 1233 | 1368 |
| 1234 void BreakPointInfo::BreakPointInfoPrint() { | 1369 #ifdef OBJECT_PRINT |
| 1235 HeapObject::PrintHeader("BreakPointInfo"); | 1370 void BreakPointInfo::BreakPointInfoPrint(FILE* out) { |
| 1236 PrintF("\n - code_position: %d", code_position()->value()); | 1371 HeapObject::PrintHeader(out, "BreakPointInfo"); |
| 1237 PrintF("\n - source_position: %d", source_position()->value()); | 1372 PrintF(out, "\n - code_position: %d", code_position()->value()); |
| 1238 PrintF("\n - statement_position: %d", statement_position()->value()); | 1373 PrintF(out, "\n - source_position: %d", source_position()->value()); |
| 1239 PrintF("\n - break_point_objects: "); | 1374 PrintF(out, "\n - statement_position: %d", statement_position()->value()); |
| 1240 break_point_objects()->ShortPrint(); | 1375 PrintF(out, "\n - break_point_objects: "); |
| 1376 break_point_objects()->ShortPrint(out); |
| 1241 } | 1377 } |
| 1242 #endif | 1378 #endif // OBJECT_PRINT |
| 1379 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1243 | 1380 |
| 1244 | 1381 |
| 1382 #ifdef DEBUG |
| 1245 void JSObject::IncrementSpillStatistics(SpillInformation* info) { | 1383 void JSObject::IncrementSpillStatistics(SpillInformation* info) { |
| 1246 info->number_of_objects_++; | 1384 info->number_of_objects_++; |
| 1247 // Named properties | 1385 // Named properties |
| 1248 if (HasFastProperties()) { | 1386 if (HasFastProperties()) { |
| 1249 info->number_of_objects_with_fast_properties_++; | 1387 info->number_of_objects_with_fast_properties_++; |
| 1250 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 1388 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
| 1251 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); | 1389 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
| 1252 } else { | 1390 } else { |
| 1253 StringDictionary* dict = property_dictionary(); | 1391 StringDictionary* dict = property_dictionary(); |
| 1254 info->number_of_slow_used_properties_ += dict->NumberOfElements(); | 1392 info->number_of_slow_used_properties_ += dict->NumberOfElements(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 PrintF(" - fast elements (#%d): %d (used) %d (unused)\n", | 1455 PrintF(" - fast elements (#%d): %d (used) %d (unused)\n", |
| 1318 number_of_objects_with_fast_elements_, | 1456 number_of_objects_with_fast_elements_, |
| 1319 number_of_fast_used_elements_, number_of_fast_unused_elements_); | 1457 number_of_fast_used_elements_, number_of_fast_unused_elements_); |
| 1320 | 1458 |
| 1321 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", | 1459 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", |
| 1322 number_of_objects_ - number_of_objects_with_fast_elements_, | 1460 number_of_objects_ - number_of_objects_with_fast_elements_, |
| 1323 number_of_slow_used_elements_, number_of_slow_unused_elements_); | 1461 number_of_slow_used_elements_, number_of_slow_unused_elements_); |
| 1324 | 1462 |
| 1325 PrintF("\n"); | 1463 PrintF("\n"); |
| 1326 } | 1464 } |
| 1465 #endif // DEBUG |
| 1327 | 1466 |
| 1328 | 1467 |
| 1329 void DescriptorArray::PrintDescriptors() { | 1468 #ifdef OBJECT_PRINT |
| 1330 PrintF("Descriptor array %d\n", number_of_descriptors()); | 1469 void DescriptorArray::PrintDescriptors(FILE* out) { |
| 1470 PrintF(out, "Descriptor array %d\n", number_of_descriptors()); |
| 1331 for (int i = 0; i < number_of_descriptors(); i++) { | 1471 for (int i = 0; i < number_of_descriptors(); i++) { |
| 1332 PrintF(" %d: ", i); | 1472 PrintF(out, " %d: ", i); |
| 1333 Descriptor desc; | 1473 Descriptor desc; |
| 1334 Get(i, &desc); | 1474 Get(i, &desc); |
| 1335 desc.Print(); | 1475 desc.Print(out); |
| 1336 } | 1476 } |
| 1337 PrintF("\n"); | 1477 PrintF(out, "\n"); |
| 1338 } | 1478 } |
| 1479 #endif // OBJECT_PRINT |
| 1339 | 1480 |
| 1340 | 1481 |
| 1482 #ifdef DEBUG |
| 1341 bool DescriptorArray::IsSortedNoDuplicates() { | 1483 bool DescriptorArray::IsSortedNoDuplicates() { |
| 1342 String* current_key = NULL; | 1484 String* current_key = NULL; |
| 1343 uint32_t current = 0; | 1485 uint32_t current = 0; |
| 1344 for (int i = 0; i < number_of_descriptors(); i++) { | 1486 for (int i = 0; i < number_of_descriptors(); i++) { |
| 1345 String* key = GetKey(i); | 1487 String* key = GetKey(i); |
| 1346 if (key == current_key) { | 1488 if (key == current_key) { |
| 1347 PrintDescriptors(); | 1489 PrintDescriptors(); |
| 1348 return false; | 1490 return false; |
| 1349 } | 1491 } |
| 1350 current_key = key; | 1492 current_key = key; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 ASSERT(e->IsUndefined()); | 1538 ASSERT(e->IsUndefined()); |
| 1397 } | 1539 } |
| 1398 } | 1540 } |
| 1399 } | 1541 } |
| 1400 } | 1542 } |
| 1401 | 1543 |
| 1402 | 1544 |
| 1403 #endif // DEBUG | 1545 #endif // DEBUG |
| 1404 | 1546 |
| 1405 } } // namespace v8::internal | 1547 } } // namespace v8::internal |
| OLD | NEW |