jkummerow@chromium.org | 1145ef8 | 2012-02-02 16:21:15 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [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 | |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 40 | void MaybeObject::Print() { |
| 41 | Print(stdout); |
| 42 | } |
| 43 | |
| 44 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 45 | void MaybeObject::Print(FILE* out) { |
| 46 | Object* this_as_object; |
| 47 | if (ToObject(&this_as_object)) { |
| 48 | if (this_as_object->IsSmi()) { |
| 49 | Smi::cast(this_as_object)->SmiPrint(out); |
| 50 | } else { |
| 51 | HeapObject::cast(this_as_object)->HeapObjectPrint(out); |
| 52 | } |
| 53 | } else { |
| 54 | Failure::cast(this)->FailurePrint(out); |
| 55 | } |
| 56 | Flush(out); |
| 57 | } |
| 58 | |
| 59 | |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 60 | void MaybeObject::PrintLn() { |
| 61 | PrintLn(stdout); |
| 62 | } |
| 63 | |
| 64 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 65 | void MaybeObject::PrintLn(FILE* out) { |
| 66 | Print(out); |
| 67 | PrintF(out, "\n"); |
| 68 | } |
| 69 | |
| 70 | |
| 71 | void HeapObject::PrintHeader(FILE* out, const char* id) { |
| 72 | PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | void HeapObject::HeapObjectPrint(FILE* out) { |
| 77 | InstanceType instance_type = map()->instance_type(); |
| 78 | |
yangguo@chromium.org | c03a192 | 2013-02-19 13:55:47 +0000 | [diff] [blame] | 79 | HandleScope scope(GetIsolate()); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 80 | if (instance_type < FIRST_NONSTRING_TYPE) { |
| 81 | String::cast(this)->StringPrint(out); |
| 82 | return; |
| 83 | } |
| 84 | |
| 85 | switch (instance_type) { |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 86 | case SYMBOL_TYPE: |
| 87 | Symbol::cast(this)->SymbolPrint(out); |
| 88 | break; |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 89 | case MAP_TYPE: |
| 90 | Map::cast(this)->MapPrint(out); |
| 91 | break; |
| 92 | case HEAP_NUMBER_TYPE: |
| 93 | HeapNumber::cast(this)->HeapNumberPrint(out); |
| 94 | break; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 95 | case FIXED_DOUBLE_ARRAY_TYPE: |
| 96 | FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(out); |
| 97 | break; |
mstarzinger@chromium.org | a2e1a40 | 2013-10-15 08:25:05 +0000 | [diff] [blame] | 98 | case CONSTANT_POOL_ARRAY_TYPE: |
| 99 | ConstantPoolArray::cast(this)->ConstantPoolArrayPrint(out); |
| 100 | break; |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 101 | case FIXED_ARRAY_TYPE: |
| 102 | FixedArray::cast(this)->FixedArrayPrint(out); |
| 103 | break; |
| 104 | case BYTE_ARRAY_TYPE: |
| 105 | ByteArray::cast(this)->ByteArrayPrint(out); |
| 106 | break; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 107 | case FREE_SPACE_TYPE: |
| 108 | FreeSpace::cast(this)->FreeSpacePrint(out); |
| 109 | break; |
machenbach@chromium.org | af4fba3 | 2014-01-27 01:05:32 +0000 | [diff] [blame] | 110 | |
| 111 | #define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \ |
| 112 | case EXTERNAL_##TYPE##_ARRAY_TYPE: \ |
| 113 | External##Type##Array::cast(this)->External##Type##ArrayPrint(out); \ |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 114 | break; |
machenbach@chromium.org | af4fba3 | 2014-01-27 01:05:32 +0000 | [diff] [blame] | 115 | |
| 116 | TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY) |
| 117 | #undef PRINT_EXTERNAL_ARRAY |
| 118 | |
| 119 | #define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 120 | case Fixed##Type##Array::kInstanceType: \ |
| 121 | Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \ |
| 122 | break; |
| 123 | |
machenbach@chromium.org | af4fba3 | 2014-01-27 01:05:32 +0000 | [diff] [blame] | 124 | TYPED_ARRAYS(PRINT_FIXED_TYPED_ARRAY) |
| 125 | #undef PRINT_FIXED_TYPED_ARRAY |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 126 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 127 | case FILLER_TYPE: |
| 128 | PrintF(out, "filler"); |
| 129 | break; |
| 130 | case JS_OBJECT_TYPE: // fall through |
| 131 | case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
| 132 | case JS_ARRAY_TYPE: |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 133 | case JS_GENERATOR_OBJECT_TYPE: |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 134 | case JS_REGEXP_TYPE: |
| 135 | JSObject::cast(this)->JSObjectPrint(out); |
| 136 | break; |
| 137 | case ODDBALL_TYPE: |
| 138 | Oddball::cast(this)->to_string()->Print(out); |
| 139 | break; |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 140 | case JS_MODULE_TYPE: |
| 141 | JSModule::cast(this)->JSModulePrint(out); |
| 142 | break; |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 143 | case JS_FUNCTION_TYPE: |
| 144 | JSFunction::cast(this)->JSFunctionPrint(out); |
| 145 | break; |
| 146 | case JS_GLOBAL_PROXY_TYPE: |
| 147 | JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out); |
| 148 | break; |
| 149 | case JS_GLOBAL_OBJECT_TYPE: |
| 150 | JSGlobalObject::cast(this)->JSGlobalObjectPrint(out); |
| 151 | break; |
| 152 | case JS_BUILTINS_OBJECT_TYPE: |
| 153 | JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out); |
| 154 | break; |
| 155 | case JS_VALUE_TYPE: |
| 156 | PrintF(out, "Value wrapper around:"); |
| 157 | JSValue::cast(this)->value()->Print(out); |
| 158 | break; |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 159 | case JS_DATE_TYPE: |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 160 | JSDate::cast(this)->JSDatePrint(out); |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 161 | break; |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 162 | case CODE_TYPE: |
| 163 | Code::cast(this)->CodePrint(out); |
| 164 | break; |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 165 | case JS_PROXY_TYPE: |
| 166 | JSProxy::cast(this)->JSProxyPrint(out); |
| 167 | break; |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 168 | case JS_FUNCTION_PROXY_TYPE: |
| 169 | JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out); |
| 170 | break; |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 171 | case JS_SET_TYPE: |
| 172 | JSSet::cast(this)->JSSetPrint(out); |
| 173 | break; |
| 174 | case JS_MAP_TYPE: |
| 175 | JSMap::cast(this)->JSMapPrint(out); |
| 176 | break; |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 177 | case JS_WEAK_MAP_TYPE: |
| 178 | JSWeakMap::cast(this)->JSWeakMapPrint(out); |
| 179 | break; |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 180 | case JS_WEAK_SET_TYPE: |
| 181 | JSWeakSet::cast(this)->JSWeakSetPrint(out); |
| 182 | break; |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 183 | case FOREIGN_TYPE: |
| 184 | Foreign::cast(this)->ForeignPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 185 | break; |
| 186 | case SHARED_FUNCTION_INFO_TYPE: |
| 187 | SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out); |
| 188 | break; |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 189 | case JS_MESSAGE_OBJECT_TYPE: |
| 190 | JSMessageObject::cast(this)->JSMessageObjectPrint(out); |
| 191 | break; |
danno@chromium.org | 4172848 | 2013-06-12 22:31:22 +0000 | [diff] [blame] | 192 | case CELL_TYPE: |
| 193 | Cell::cast(this)->CellPrint(out); |
| 194 | break; |
| 195 | case PROPERTY_CELL_TYPE: |
dslomov@chromium.org | b752d40 | 2013-06-18 11:54:54 +0000 | [diff] [blame] | 196 | PropertyCell::cast(this)->PropertyCellPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 197 | break; |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 198 | case JS_ARRAY_BUFFER_TYPE: |
| 199 | JSArrayBuffer::cast(this)->JSArrayBufferPrint(out); |
mstarzinger@chromium.org | b228be0 | 2013-04-18 14:56:59 +0000 | [diff] [blame] | 200 | break; |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 201 | case JS_TYPED_ARRAY_TYPE: |
| 202 | JSTypedArray::cast(this)->JSTypedArrayPrint(out); |
mstarzinger@chromium.org | b228be0 | 2013-04-18 14:56:59 +0000 | [diff] [blame] | 203 | break; |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 204 | case JS_DATA_VIEW_TYPE: |
| 205 | JSDataView::cast(this)->JSDataViewPrint(out); |
| 206 | break; |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 207 | #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
| 208 | case NAME##_TYPE: \ |
| 209 | Name::cast(this)->Name##Print(out); \ |
| 210 | break; |
| 211 | STRUCT_LIST(MAKE_STRUCT_CASE) |
| 212 | #undef MAKE_STRUCT_CASE |
| 213 | |
| 214 | default: |
| 215 | PrintF(out, "UNKNOWN TYPE %d", map()->instance_type()); |
| 216 | UNREACHABLE(); |
| 217 | break; |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | |
| 222 | void ByteArray::ByteArrayPrint(FILE* out) { |
| 223 | PrintF(out, "byte array, data starts at %p", GetDataStartAddress()); |
| 224 | } |
| 225 | |
| 226 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 227 | void FreeSpace::FreeSpacePrint(FILE* out) { |
| 228 | PrintF(out, "free space, size %d", Size()); |
| 229 | } |
| 230 | |
| 231 | |
machenbach@chromium.org | af4fba3 | 2014-01-27 01:05:32 +0000 | [diff] [blame] | 232 | #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \ |
| 233 | void External##Type##Array::External##Type##ArrayPrint(FILE* out) { \ |
| 234 | PrintF(out, "external " #type " array"); \ |
| 235 | } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 236 | |
machenbach@chromium.org | af4fba3 | 2014-01-27 01:05:32 +0000 | [diff] [blame] | 237 | TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER) |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 238 | |
machenbach@chromium.org | af4fba3 | 2014-01-27 01:05:32 +0000 | [diff] [blame] | 239 | #undef EXTERNAL_ARRAY_PRINTER |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 240 | |
| 241 | |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 242 | template <class Traits> |
| 243 | void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) { |
| 244 | PrintF(out, "fixed %s", Traits::Designator()); |
| 245 | } |
| 246 | |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 247 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 248 | void JSObject::PrintProperties(FILE* out) { |
| 249 | if (HasFastProperties()) { |
| 250 | DescriptorArray* descs = map()->instance_descriptors(); |
verwaest@chromium.org | 06ab2ec | 2012-10-09 17:00:13 +0000 | [diff] [blame] | 251 | for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 252 | PrintF(out, " "); |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 253 | descs->GetKey(i)->NamePrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 254 | PrintF(out, ": "); |
| 255 | switch (descs->GetType(i)) { |
| 256 | case FIELD: { |
| 257 | int index = descs->GetFieldIndex(i); |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame] | 258 | RawFastPropertyAt(index)->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 259 | PrintF(out, " (field at offset %d)\n", index); |
| 260 | break; |
| 261 | } |
jkummerow@chromium.org | fb732b1 | 2013-07-26 10:27:09 +0000 | [diff] [blame] | 262 | case CONSTANT: |
| 263 | descs->GetConstant(i)->ShortPrint(out); |
| 264 | PrintF(out, " (constant)\n"); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 265 | break; |
| 266 | case CALLBACKS: |
| 267 | descs->GetCallbacksObject(i)->ShortPrint(out); |
| 268 | PrintF(out, " (callback)\n"); |
| 269 | break; |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 270 | case NORMAL: // only in slow mode |
| 271 | case HANDLER: // only in lookup results, not in descriptors |
| 272 | case INTERCEPTOR: // only in lookup results, not in descriptors |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 273 | // There are no transitions in the descriptor array. |
| 274 | case TRANSITION: |
jkummerow@chromium.org | 7a6fc81 | 2012-06-27 11:12:38 +0000 | [diff] [blame] | 275 | case NONEXISTENT: |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 276 | UNREACHABLE(); |
| 277 | break; |
| 278 | } |
| 279 | } |
| 280 | } else { |
| 281 | property_dictionary()->Print(out); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 286 | template<class T> |
| 287 | static void DoPrintElements(FILE *out, Object* object) { |
| 288 | T* p = T::cast(object); |
| 289 | for (int i = 0; i < p->length(); i++) { |
| 290 | PrintF(out, " %d: %d\n", i, p->get_scalar(i)); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | |
| 295 | template<class T> |
| 296 | static void DoPrintDoubleElements(FILE* out, Object* object) { |
| 297 | T* p = T::cast(object); |
| 298 | for (int i = 0; i < p->length(); i++) { |
| 299 | PrintF(out, " %d: %f\n", i, p->get_scalar(i)); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 304 | void JSObject::PrintElements(FILE* out) { |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 305 | // Don't call GetElementsKind, its validation code can cause the printer to |
| 306 | // fail when debugging. |
| 307 | switch (map()->elements_kind()) { |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 308 | case FAST_HOLEY_SMI_ELEMENTS: |
| 309 | case FAST_SMI_ELEMENTS: |
| 310 | case FAST_HOLEY_ELEMENTS: |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 311 | case FAST_ELEMENTS: { |
| 312 | // Print in array notation for non-sparse arrays. |
| 313 | FixedArray* p = FixedArray::cast(elements()); |
| 314 | for (int i = 0; i < p->length(); i++) { |
| 315 | PrintF(out, " %d: ", i); |
| 316 | p->get(i)->ShortPrint(out); |
| 317 | PrintF(out, "\n"); |
| 318 | } |
| 319 | break; |
| 320 | } |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 321 | case FAST_HOLEY_DOUBLE_ELEMENTS: |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 322 | case FAST_DOUBLE_ELEMENTS: { |
| 323 | // Print in array notation for non-sparse arrays. |
jkummerow@chromium.org | 212d964 | 2012-05-11 15:02:09 +0000 | [diff] [blame] | 324 | if (elements()->length() > 0) { |
| 325 | FixedDoubleArray* p = FixedDoubleArray::cast(elements()); |
| 326 | for (int i = 0; i < p->length(); i++) { |
| 327 | if (p->is_the_hole(i)) { |
| 328 | PrintF(out, " %d: <the hole>", i); |
| 329 | } else { |
| 330 | PrintF(out, " %d: %g", i, p->get_scalar(i)); |
| 331 | } |
| 332 | PrintF(out, "\n"); |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 333 | } |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 334 | } |
| 335 | break; |
| 336 | } |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 337 | |
| 338 | |
| 339 | #define PRINT_ELEMENTS(Kind, Type) \ |
| 340 | case Kind: { \ |
| 341 | DoPrintElements<Type>(out, elements()); \ |
| 342 | break; \ |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 343 | } |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 344 | |
| 345 | #define PRINT_DOUBLE_ELEMENTS(Kind, Type) \ |
| 346 | case Kind: { \ |
| 347 | DoPrintDoubleElements<Type>(out, elements()); \ |
| 348 | break; \ |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 349 | } |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 350 | |
machenbach@chromium.org | af4fba3 | 2014-01-27 01:05:32 +0000 | [diff] [blame] | 351 | PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray) |
| 352 | PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array) |
| 353 | PRINT_ELEMENTS(EXTERNAL_UINT8_ELEMENTS, |
| 354 | ExternalUint8Array) |
| 355 | PRINT_ELEMENTS(EXTERNAL_INT16_ELEMENTS, ExternalInt16Array) |
| 356 | PRINT_ELEMENTS(EXTERNAL_UINT16_ELEMENTS, |
| 357 | ExternalUint16Array) |
| 358 | PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array) |
| 359 | PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS, |
| 360 | ExternalUint32Array) |
| 361 | PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array) |
| 362 | PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array) |
machenbach@chromium.org | 5c88bc3 | 2014-01-17 08:10:36 +0000 | [diff] [blame] | 363 | |
| 364 | |
| 365 | PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array) |
| 366 | PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray) |
| 367 | PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array) |
| 368 | PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array) |
| 369 | PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array) |
| 370 | PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array) |
| 371 | PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array) |
| 372 | PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array) |
| 373 | PRINT_DOUBLE_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array) |
| 374 | |
| 375 | #undef PRINT_DOUBLE_ELEMENTS |
| 376 | #undef PRINT_ELEMENTS |
| 377 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 378 | case DICTIONARY_ELEMENTS: |
| 379 | elements()->Print(out); |
| 380 | break; |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 381 | case NON_STRICT_ARGUMENTS_ELEMENTS: { |
| 382 | FixedArray* p = FixedArray::cast(elements()); |
svenpanne@chromium.org | 83130cf | 2012-11-30 10:13:25 +0000 | [diff] [blame] | 383 | PrintF(out, " parameter map:"); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 384 | for (int i = 2; i < p->length(); i++) { |
svenpanne@chromium.org | 83130cf | 2012-11-30 10:13:25 +0000 | [diff] [blame] | 385 | PrintF(out, " %d:", i - 2); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 386 | p->get(i)->ShortPrint(out); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 387 | } |
svenpanne@chromium.org | 83130cf | 2012-11-30 10:13:25 +0000 | [diff] [blame] | 388 | PrintF(out, "\n context: "); |
| 389 | p->get(0)->ShortPrint(out); |
| 390 | PrintF(out, "\n arguments: "); |
| 391 | p->get(1)->ShortPrint(out); |
| 392 | PrintF(out, "\n"); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 393 | break; |
| 394 | } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 395 | } |
| 396 | } |
| 397 | |
| 398 | |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 399 | void JSObject::PrintTransitions(FILE* out) { |
| 400 | if (!map()->HasTransitionArray()) return; |
| 401 | TransitionArray* transitions = map()->transitions(); |
| 402 | for (int i = 0; i < transitions->number_of_transitions(); i++) { |
| 403 | PrintF(out, " "); |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 404 | transitions->GetKey(i)->NamePrint(out); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 405 | PrintF(out, ": "); |
| 406 | switch (transitions->GetTargetDetails(i).type()) { |
| 407 | case FIELD: { |
| 408 | PrintF(out, " (transition to field)\n"); |
| 409 | break; |
| 410 | } |
jkummerow@chromium.org | fb732b1 | 2013-07-26 10:27:09 +0000 | [diff] [blame] | 411 | case CONSTANT: |
| 412 | PrintF(out, " (transition to constant)\n"); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 413 | break; |
| 414 | case CALLBACKS: |
| 415 | PrintF(out, " (transition to callback)\n"); |
| 416 | break; |
| 417 | // Values below are never in the target descriptor array. |
| 418 | case NORMAL: |
| 419 | case HANDLER: |
| 420 | case INTERCEPTOR: |
| 421 | case TRANSITION: |
| 422 | case NONEXISTENT: |
| 423 | UNREACHABLE(); |
| 424 | break; |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 430 | void JSObject::JSObjectPrint(FILE* out) { |
| 431 | PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this)); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 432 | PrintF(out, " - map = %p [", reinterpret_cast<void*>(map())); |
| 433 | // Don't call GetElementsKind, its validation code can cause the printer to |
| 434 | // fail when debugging. |
| 435 | PrintElementsKind(out, this->map()->elements_kind()); |
| 436 | PrintF(out, |
| 437 | "]\n - prototype = %p\n", |
| 438 | reinterpret_cast<void*>(GetPrototype())); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 439 | PrintF(out, " {\n"); |
| 440 | PrintProperties(out); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 441 | PrintTransitions(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 442 | PrintElements(out); |
| 443 | PrintF(out, " }\n"); |
| 444 | } |
| 445 | |
| 446 | |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 447 | void JSModule::JSModulePrint(FILE* out) { |
| 448 | HeapObject::PrintHeader(out, "JSModule"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 449 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 450 | PrintF(out, " - context = "); |
| 451 | context()->Print(out); |
danno@chromium.org | 81cac2b | 2012-07-10 11:28:27 +0000 | [diff] [blame] | 452 | PrintF(out, " - scope_info = "); |
| 453 | scope_info()->ShortPrint(out); |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 454 | PrintElementsKind(out, this->map()->elements_kind()); |
| 455 | PrintF(out, " {\n"); |
| 456 | PrintProperties(out); |
| 457 | PrintElements(out); |
| 458 | PrintF(out, " }\n"); |
| 459 | } |
| 460 | |
| 461 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 462 | static const char* TypeToString(InstanceType type) { |
| 463 | switch (type) { |
danno@chromium.org | 5940060 | 2013-08-13 17:09:37 +0000 | [diff] [blame] | 464 | #define TYPE_TO_STRING(TYPE) case TYPE: return #TYPE; |
| 465 | INSTANCE_TYPE_LIST(TYPE_TO_STRING) |
| 466 | #undef TYPE_TO_STRING |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 467 | } |
danno@chromium.org | 5940060 | 2013-08-13 17:09:37 +0000 | [diff] [blame] | 468 | UNREACHABLE(); |
| 469 | return "UNKNOWN"; // Keep the compiler happy. |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 473 | void Symbol::SymbolPrint(FILE* out) { |
| 474 | HeapObject::PrintHeader(out, "Symbol"); |
| 475 | PrintF(out, " - hash: %d\n", Hash()); |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 476 | PrintF(out, " - name: "); |
| 477 | name()->ShortPrint(); |
machenbach@chromium.org | 0cc0950 | 2013-11-13 12:20:55 +0000 | [diff] [blame] | 478 | PrintF(out, " - private: %d\n", is_private()); |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 479 | PrintF(out, "\n"); |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 483 | void Map::MapPrint(FILE* out) { |
| 484 | HeapObject::PrintHeader(out, "Map"); |
| 485 | PrintF(out, " - type: %s\n", TypeToString(instance_type())); |
| 486 | PrintF(out, " - instance size: %d\n", instance_size()); |
| 487 | PrintF(out, " - inobject properties: %d\n", inobject_properties()); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 488 | PrintF(out, " - elements kind: "); |
| 489 | PrintElementsKind(out, elements_kind()); |
| 490 | PrintF(out, "\n - pre-allocated property fields: %d\n", |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 491 | pre_allocated_property_fields()); |
| 492 | PrintF(out, " - unused property fields: %d\n", unused_property_fields()); |
| 493 | if (is_hidden_prototype()) { |
| 494 | PrintF(out, " - hidden_prototype\n"); |
| 495 | } |
| 496 | if (has_named_interceptor()) { |
| 497 | PrintF(out, " - named_interceptor\n"); |
| 498 | } |
| 499 | if (has_indexed_interceptor()) { |
| 500 | PrintF(out, " - indexed_interceptor\n"); |
| 501 | } |
| 502 | if (is_undetectable()) { |
| 503 | PrintF(out, " - undetectable\n"); |
| 504 | } |
| 505 | if (has_instance_call_handler()) { |
| 506 | PrintF(out, " - instance_call_handler\n"); |
| 507 | } |
| 508 | if (is_access_check_needed()) { |
| 509 | PrintF(out, " - access_check_needed\n"); |
| 510 | } |
machenbach@chromium.org | 8a58f64 | 2013-12-02 10:46:30 +0000 | [diff] [blame] | 511 | if (is_frozen()) { |
| 512 | PrintF(out, " - frozen\n"); |
| 513 | } else if (!is_extensible()) { |
| 514 | PrintF(out, " - sealed\n"); |
| 515 | } |
verwaest@chromium.org | 33e09c8 | 2012-10-10 17:07:22 +0000 | [diff] [blame] | 516 | PrintF(out, " - back pointer: "); |
| 517 | GetBackPointer()->ShortPrint(out); |
jkummerow@chromium.org | 4e308cf | 2013-05-17 13:39:16 +0000 | [diff] [blame] | 518 | PrintF(out, "\n - instance descriptors %s#%i: ", |
| 519 | owns_descriptors() ? "(own) " : "", |
rossberg@chromium.org | 89e18f5 | 2012-10-22 13:09:53 +0000 | [diff] [blame] | 520 | NumberOfOwnDescriptors()); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 521 | instance_descriptors()->ShortPrint(out); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 522 | if (HasTransitionArray()) { |
| 523 | PrintF(out, "\n - transitions: "); |
| 524 | transitions()->ShortPrint(out); |
| 525 | } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 526 | PrintF(out, "\n - prototype: "); |
| 527 | prototype()->ShortPrint(out); |
| 528 | PrintF(out, "\n - constructor: "); |
| 529 | constructor()->ShortPrint(out); |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 530 | PrintF(out, "\n - code cache: "); |
| 531 | code_cache()->ShortPrint(out); |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 532 | PrintF(out, "\n - dependent code: "); |
| 533 | dependent_code()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 534 | PrintF(out, "\n"); |
| 535 | } |
| 536 | |
| 537 | |
| 538 | void CodeCache::CodeCachePrint(FILE* out) { |
| 539 | HeapObject::PrintHeader(out, "CodeCache"); |
| 540 | PrintF(out, "\n - default_cache: "); |
| 541 | default_cache()->ShortPrint(out); |
| 542 | PrintF(out, "\n - normal_type_cache: "); |
| 543 | normal_type_cache()->ShortPrint(out); |
| 544 | } |
| 545 | |
| 546 | |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 547 | void PolymorphicCodeCache::PolymorphicCodeCachePrint(FILE* out) { |
| 548 | HeapObject::PrintHeader(out, "PolymorphicCodeCache"); |
| 549 | PrintF(out, "\n - cache: "); |
| 550 | cache()->ShortPrint(out); |
| 551 | } |
| 552 | |
| 553 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 554 | void TypeFeedbackInfo::TypeFeedbackInfoPrint(FILE* out) { |
| 555 | HeapObject::PrintHeader(out, "TypeFeedbackInfo"); |
ulan@chromium.org | ea52b5f | 2012-07-30 13:05:33 +0000 | [diff] [blame] | 556 | PrintF(out, " - ic_total_count: %d, ic_with_type_info_count: %d\n", |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 557 | ic_total_count(), ic_with_type_info_count()); |
hpayer@chromium.org | 052c956 | 2014-02-26 12:50:40 +0000 | [diff] [blame] | 558 | PrintF(out, " - type_feedback_cells: "); |
| 559 | type_feedback_cells()->FixedArrayPrint(out); |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | |
yangguo@chromium.org | ab30bb8 | 2012-02-24 14:41:46 +0000 | [diff] [blame] | 563 | void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(FILE* out) { |
| 564 | HeapObject::PrintHeader(out, "AliasedArgumentsEntry"); |
| 565 | PrintF(out, "\n - aliased_context_slot: %d", aliased_context_slot()); |
| 566 | } |
| 567 | |
| 568 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 569 | void FixedArray::FixedArrayPrint(FILE* out) { |
| 570 | HeapObject::PrintHeader(out, "FixedArray"); |
| 571 | PrintF(out, " - length: %d", length()); |
| 572 | for (int i = 0; i < length(); i++) { |
| 573 | PrintF(out, "\n [%d]: ", i); |
| 574 | get(i)->ShortPrint(out); |
| 575 | } |
| 576 | PrintF(out, "\n"); |
| 577 | } |
| 578 | |
| 579 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 580 | void FixedDoubleArray::FixedDoubleArrayPrint(FILE* out) { |
| 581 | HeapObject::PrintHeader(out, "FixedDoubleArray"); |
| 582 | PrintF(out, " - length: %d", length()); |
| 583 | for (int i = 0; i < length(); i++) { |
jkummerow@chromium.org | 1145ef8 | 2012-02-02 16:21:15 +0000 | [diff] [blame] | 584 | if (is_the_hole(i)) { |
| 585 | PrintF(out, "\n [%d]: <the hole>", i); |
| 586 | } else { |
| 587 | PrintF(out, "\n [%d]: %g", i, get_scalar(i)); |
| 588 | } |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 589 | } |
| 590 | PrintF(out, "\n"); |
| 591 | } |
| 592 | |
| 593 | |
mstarzinger@chromium.org | a2e1a40 | 2013-10-15 08:25:05 +0000 | [diff] [blame] | 594 | void ConstantPoolArray::ConstantPoolArrayPrint(FILE* out) { |
| 595 | HeapObject::PrintHeader(out, "ConstantPoolArray"); |
| 596 | PrintF(out, " - length: %d", length()); |
| 597 | for (int i = 0; i < length(); i++) { |
| 598 | if (i < first_ptr_index()) { |
| 599 | PrintF(out, "\n [%d]: double: %g", i, get_int64_entry_as_double(i)); |
| 600 | } else if (i < first_int32_index()) { |
| 601 | PrintF(out, "\n [%d]: pointer: %p", i, |
| 602 | reinterpret_cast<void*>(get_ptr_entry(i))); |
| 603 | } else { |
| 604 | PrintF(out, "\n [%d]: int32: %d", i, get_int32_entry(i)); |
| 605 | } |
| 606 | } |
| 607 | PrintF(out, "\n"); |
| 608 | } |
| 609 | |
| 610 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 611 | void JSValue::JSValuePrint(FILE* out) { |
| 612 | HeapObject::PrintHeader(out, "ValueObject"); |
| 613 | value()->Print(out); |
| 614 | } |
| 615 | |
| 616 | |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 617 | void JSMessageObject::JSMessageObjectPrint(FILE* out) { |
| 618 | HeapObject::PrintHeader(out, "JSMessageObject"); |
| 619 | PrintF(out, " - type: "); |
| 620 | type()->ShortPrint(out); |
| 621 | PrintF(out, "\n - arguments: "); |
| 622 | arguments()->ShortPrint(out); |
| 623 | PrintF(out, "\n - start_position: %d", start_position()); |
| 624 | PrintF(out, "\n - end_position: %d", end_position()); |
| 625 | PrintF(out, "\n - script: "); |
| 626 | script()->ShortPrint(out); |
hpayer@chromium.org | 052c956 | 2014-02-26 12:50:40 +0000 | [diff] [blame] | 627 | PrintF(out, "\n - stack_trace: "); |
| 628 | stack_trace()->ShortPrint(out); |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 629 | PrintF(out, "\n - stack_frames: "); |
| 630 | stack_frames()->ShortPrint(out); |
| 631 | PrintF(out, "\n"); |
| 632 | } |
| 633 | |
| 634 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 635 | void String::StringPrint(FILE* out) { |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 636 | if (StringShape(this).IsInternalized()) { |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 637 | PrintF(out, "#"); |
| 638 | } else if (StringShape(this).IsCons()) { |
| 639 | PrintF(out, "c\""); |
| 640 | } else { |
| 641 | PrintF(out, "\""); |
| 642 | } |
| 643 | |
| 644 | const char truncated_epilogue[] = "...<truncated>"; |
| 645 | int len = length(); |
| 646 | if (!FLAG_use_verbose_printer) { |
| 647 | if (len > 100) { |
| 648 | len = 100 - sizeof(truncated_epilogue); |
| 649 | } |
| 650 | } |
| 651 | for (int i = 0; i < len; i++) { |
| 652 | PrintF(out, "%c", Get(i)); |
| 653 | } |
| 654 | if (len != length()) { |
| 655 | PrintF(out, "%s", truncated_epilogue); |
| 656 | } |
| 657 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 658 | if (!StringShape(this).IsInternalized()) PrintF(out, "\""); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 662 | void Name::NamePrint(FILE* out) { |
| 663 | if (IsString()) |
| 664 | String::cast(this)->StringPrint(out); |
| 665 | else |
| 666 | ShortPrint(); |
| 667 | } |
| 668 | |
| 669 | |
vegorov@chromium.org | 7943d46 | 2011-08-01 11:41:52 +0000 | [diff] [blame] | 670 | // This method is only meant to be called from gdb for debugging purposes. |
ulan@chromium.org | 2efb900 | 2012-01-19 15:36:35 +0000 | [diff] [blame] | 671 | // Since the string can also be in two-byte encoding, non-ASCII characters |
vegorov@chromium.org | 7943d46 | 2011-08-01 11:41:52 +0000 | [diff] [blame] | 672 | // will be ignored in the output. |
| 673 | char* String::ToAsciiArray() { |
| 674 | // Static so that subsequent calls frees previously allocated space. |
| 675 | // This also means that previous results will be overwritten. |
| 676 | static char* buffer = NULL; |
| 677 | if (buffer != NULL) free(buffer); |
| 678 | buffer = new char[length()+1]; |
jkummerow@chromium.org | 9439d1f | 2013-01-09 17:13:11 +0000 | [diff] [blame] | 679 | WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length()); |
vegorov@chromium.org | 7943d46 | 2011-08-01 11:41:52 +0000 | [diff] [blame] | 680 | buffer[length()] = 0; |
| 681 | return buffer; |
| 682 | } |
| 683 | |
| 684 | |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 685 | static const char* const weekdays[] = { |
| 686 | "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" |
| 687 | }; |
| 688 | |
mstarzinger@chromium.org | e0e1b0d | 2013-07-08 08:38:06 +0000 | [diff] [blame] | 689 | |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 690 | void JSDate::JSDatePrint(FILE* out) { |
| 691 | HeapObject::PrintHeader(out, "JSDate"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 692 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 693 | PrintF(out, " - value = "); |
| 694 | value()->Print(out); |
| 695 | if (!year()->IsSmi()) { |
| 696 | PrintF(out, " - time = NaN\n"); |
| 697 | } else { |
| 698 | PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n", |
| 699 | weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0], |
| 700 | year()->IsSmi() ? Smi::cast(year())->value() : -1, |
| 701 | month()->IsSmi() ? Smi::cast(month())->value() : -1, |
| 702 | day()->IsSmi() ? Smi::cast(day())->value() : -1, |
| 703 | hour()->IsSmi() ? Smi::cast(hour())->value() : -1, |
| 704 | min()->IsSmi() ? Smi::cast(min())->value() : -1, |
| 705 | sec()->IsSmi() ? Smi::cast(sec())->value() : -1); |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 710 | void JSProxy::JSProxyPrint(FILE* out) { |
| 711 | HeapObject::PrintHeader(out, "JSProxy"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 712 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 713 | PrintF(out, " - handler = "); |
| 714 | handler()->Print(out); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 715 | PrintF(out, " - hash = "); |
| 716 | hash()->Print(out); |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 717 | PrintF(out, "\n"); |
| 718 | } |
| 719 | |
| 720 | |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 721 | void JSFunctionProxy::JSFunctionProxyPrint(FILE* out) { |
| 722 | HeapObject::PrintHeader(out, "JSFunctionProxy"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 723 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 724 | PrintF(out, " - handler = "); |
| 725 | handler()->Print(out); |
| 726 | PrintF(out, " - call_trap = "); |
| 727 | call_trap()->Print(out); |
| 728 | PrintF(out, " - construct_trap = "); |
| 729 | construct_trap()->Print(out); |
| 730 | PrintF(out, "\n"); |
| 731 | } |
| 732 | |
| 733 | |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 734 | void JSSet::JSSetPrint(FILE* out) { |
| 735 | HeapObject::PrintHeader(out, "JSSet"); |
| 736 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
| 737 | PrintF(out, " - table = "); |
| 738 | table()->ShortPrint(out); |
| 739 | PrintF(out, "\n"); |
| 740 | } |
| 741 | |
| 742 | |
| 743 | void JSMap::JSMapPrint(FILE* out) { |
| 744 | HeapObject::PrintHeader(out, "JSMap"); |
| 745 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
| 746 | PrintF(out, " - table = "); |
| 747 | table()->ShortPrint(out); |
| 748 | PrintF(out, "\n"); |
| 749 | } |
| 750 | |
| 751 | |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 752 | void JSWeakMap::JSWeakMapPrint(FILE* out) { |
| 753 | HeapObject::PrintHeader(out, "JSWeakMap"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 754 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 755 | PrintF(out, " - table = "); |
| 756 | table()->ShortPrint(out); |
| 757 | PrintF(out, "\n"); |
| 758 | } |
| 759 | |
| 760 | |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 761 | void JSWeakSet::JSWeakSetPrint(FILE* out) { |
| 762 | HeapObject::PrintHeader(out, "JSWeakSet"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 763 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 764 | PrintF(out, " - table = "); |
| 765 | table()->ShortPrint(out); |
| 766 | PrintF(out, "\n"); |
| 767 | } |
| 768 | |
| 769 | |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 770 | void JSArrayBuffer::JSArrayBufferPrint(FILE* out) { |
| 771 | HeapObject::PrintHeader(out, "JSArrayBuffer"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 772 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
| 773 | PrintF(out, " - backing_store = %p\n", backing_store()); |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 774 | PrintF(out, " - byte_length = "); |
| 775 | byte_length()->ShortPrint(out); |
| 776 | PrintF(out, "\n"); |
| 777 | } |
| 778 | |
| 779 | |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 780 | void JSTypedArray::JSTypedArrayPrint(FILE* out) { |
| 781 | HeapObject::PrintHeader(out, "JSTypedArray"); |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 782 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 783 | PrintF(out, " - buffer ="); |
| 784 | buffer()->ShortPrint(out); |
| 785 | PrintF(out, "\n - byte_offset = "); |
| 786 | byte_offset()->ShortPrint(out); |
| 787 | PrintF(out, "\n - byte_length = "); |
| 788 | byte_length()->ShortPrint(out); |
ulan@chromium.org | dfe5307 | 2013-06-06 14:14:51 +0000 | [diff] [blame] | 789 | PrintF(out, "\n - length = "); |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 790 | length()->ShortPrint(out); |
machenbach@chromium.org | e8412be | 2013-11-08 10:23:52 +0000 | [diff] [blame] | 791 | PrintF(out, "\n"); |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 792 | PrintElements(out); |
| 793 | } |
| 794 | |
| 795 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 796 | void JSDataView::JSDataViewPrint(FILE* out) { |
| 797 | HeapObject::PrintHeader(out, "JSDataView"); |
| 798 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
| 799 | PrintF(out, " - buffer ="); |
| 800 | buffer()->ShortPrint(out); |
| 801 | PrintF(out, "\n - byte_offset = "); |
| 802 | byte_offset()->ShortPrint(out); |
| 803 | PrintF(out, "\n - byte_length = "); |
| 804 | byte_length()->ShortPrint(out); |
machenbach@chromium.org | e8412be | 2013-11-08 10:23:52 +0000 | [diff] [blame] | 805 | PrintF(out, "\n"); |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 809 | void JSFunction::JSFunctionPrint(FILE* out) { |
| 810 | HeapObject::PrintHeader(out, "Function"); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 811 | PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 812 | PrintF(out, " - initial_map = "); |
| 813 | if (has_initial_map()) { |
| 814 | initial_map()->ShortPrint(out); |
| 815 | } |
| 816 | PrintF(out, "\n - shared_info = "); |
| 817 | shared()->ShortPrint(out); |
| 818 | PrintF(out, "\n - name = "); |
| 819 | shared()->name()->Print(out); |
| 820 | PrintF(out, "\n - context = "); |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 821 | context()->ShortPrint(out); |
machenbach@chromium.org | 37be408 | 2013-11-26 13:50:38 +0000 | [diff] [blame] | 822 | if (shared()->bound()) { |
| 823 | PrintF(out, "\n - bindings = "); |
| 824 | function_bindings()->ShortPrint(out); |
| 825 | } else { |
| 826 | PrintF(out, "\n - literals = "); |
| 827 | literals()->ShortPrint(out); |
| 828 | } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 829 | PrintF(out, "\n - code = "); |
| 830 | code()->ShortPrint(out); |
| 831 | PrintF(out, "\n"); |
| 832 | |
| 833 | PrintProperties(out); |
| 834 | PrintElements(out); |
| 835 | |
| 836 | PrintF(out, "\n"); |
| 837 | } |
| 838 | |
| 839 | |
| 840 | void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) { |
| 841 | HeapObject::PrintHeader(out, "SharedFunctionInfo"); |
| 842 | PrintF(out, " - name: "); |
| 843 | name()->ShortPrint(out); |
| 844 | PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties()); |
| 845 | PrintF(out, "\n - instance class name = "); |
| 846 | instance_class_name()->Print(out); |
| 847 | PrintF(out, "\n - code = "); |
| 848 | code()->ShortPrint(out); |
yangguo@chromium.org | 5a11aaf | 2012-06-20 11:29:00 +0000 | [diff] [blame] | 849 | if (HasSourceCode()) { |
| 850 | PrintF(out, "\n - source code = "); |
ulan@chromium.org | ea52b5f | 2012-07-30 13:05:33 +0000 | [diff] [blame] | 851 | String* source = String::cast(Script::cast(script())->source()); |
| 852 | int start = start_position(); |
| 853 | int length = end_position() - start; |
| 854 | SmartArrayPointer<char> source_string = |
| 855 | source->ToCString(DISALLOW_NULLS, |
| 856 | FAST_STRING_TRAVERSAL, |
| 857 | start, length, NULL); |
machenbach@chromium.org | afbdadc | 2013-12-09 16:12:18 +0000 | [diff] [blame] | 858 | PrintF(out, "%s", source_string.get()); |
yangguo@chromium.org | 5a11aaf | 2012-06-20 11:29:00 +0000 | [diff] [blame] | 859 | } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 860 | // Script files are often large, hard to read. |
| 861 | // PrintF(out, "\n - script ="); |
| 862 | // script()->Print(out); |
| 863 | PrintF(out, "\n - function token position = %d", function_token_position()); |
| 864 | PrintF(out, "\n - start position = %d", start_position()); |
| 865 | PrintF(out, "\n - end position = %d", end_position()); |
| 866 | PrintF(out, "\n - is expression = %d", is_expression()); |
| 867 | PrintF(out, "\n - debug info = "); |
| 868 | debug_info()->ShortPrint(out); |
| 869 | PrintF(out, "\n - length = %d", length()); |
svenpanne@chromium.org | a53e8e0 | 2013-05-24 12:35:50 +0000 | [diff] [blame] | 870 | PrintF(out, "\n - optimized_code_map = "); |
| 871 | optimized_code_map()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 872 | PrintF(out, "\n"); |
| 873 | } |
| 874 | |
| 875 | |
| 876 | void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) { |
ulan@chromium.org | ea52b5f | 2012-07-30 13:05:33 +0000 | [diff] [blame] | 877 | PrintF(out, "global_proxy "); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 878 | JSObjectPrint(out); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 879 | PrintF(out, "native context : "); |
| 880 | native_context()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 881 | PrintF(out, "\n"); |
| 882 | } |
| 883 | |
| 884 | |
| 885 | void JSGlobalObject::JSGlobalObjectPrint(FILE* out) { |
| 886 | PrintF(out, "global "); |
| 887 | JSObjectPrint(out); |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 888 | PrintF(out, "native context : "); |
| 889 | native_context()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 890 | PrintF(out, "\n"); |
| 891 | } |
| 892 | |
| 893 | |
| 894 | void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) { |
| 895 | PrintF(out, "builtins "); |
| 896 | JSObjectPrint(out); |
| 897 | } |
| 898 | |
| 899 | |
danno@chromium.org | 4172848 | 2013-06-12 22:31:22 +0000 | [diff] [blame] | 900 | void Cell::CellPrint(FILE* out) { |
| 901 | HeapObject::PrintHeader(out, "Cell"); |
| 902 | } |
| 903 | |
| 904 | |
dslomov@chromium.org | b752d40 | 2013-06-18 11:54:54 +0000 | [diff] [blame] | 905 | void PropertyCell::PropertyCellPrint(FILE* out) { |
| 906 | HeapObject::PrintHeader(out, "PropertyCell"); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 907 | } |
| 908 | |
| 909 | |
| 910 | void Code::CodePrint(FILE* out) { |
| 911 | HeapObject::PrintHeader(out, "Code"); |
| 912 | #ifdef ENABLE_DISASSEMBLER |
| 913 | if (FLAG_use_verbose_printer) { |
| 914 | Disassemble(NULL, out); |
| 915 | } |
| 916 | #endif |
| 917 | } |
| 918 | |
| 919 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 920 | void Foreign::ForeignPrint(FILE* out) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 921 | PrintF(out, "foreign address : %p", foreign_address()); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 922 | } |
| 923 | |
| 924 | |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 925 | void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(FILE* out) { |
| 926 | HeapObject::PrintHeader(out, "ExecutableAccessorInfo"); |
| 927 | PrintF(out, "\n - name: "); |
| 928 | name()->ShortPrint(out); |
| 929 | PrintF(out, "\n - flag: "); |
| 930 | flag()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 931 | PrintF(out, "\n - getter: "); |
| 932 | getter()->ShortPrint(out); |
| 933 | PrintF(out, "\n - setter: "); |
| 934 | setter()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 935 | PrintF(out, "\n - data: "); |
| 936 | data()->ShortPrint(out); |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 937 | } |
| 938 | |
| 939 | |
| 940 | void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(FILE* out) { |
| 941 | HeapObject::PrintHeader(out, "DeclaredAccessorInfo"); |
| 942 | PrintF(out, "\n - name: "); |
| 943 | name()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 944 | PrintF(out, "\n - flag: "); |
| 945 | flag()->ShortPrint(out); |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 946 | PrintF(out, "\n - descriptor: "); |
| 947 | descriptor()->ShortPrint(out); |
| 948 | } |
| 949 | |
| 950 | |
| 951 | void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(FILE* out) { |
| 952 | HeapObject::PrintHeader(out, "DeclaredAccessorDescriptor"); |
| 953 | PrintF(out, "\n - internal field: "); |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 954 | serialized_data()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 955 | } |
| 956 | |
| 957 | |
danno@chromium.org | 1fd77d5 | 2013-06-07 16:01:45 +0000 | [diff] [blame] | 958 | void Box::BoxPrint(FILE* out) { |
| 959 | HeapObject::PrintHeader(out, "Box"); |
| 960 | PrintF(out, "\n - value: "); |
| 961 | value()->ShortPrint(out); |
| 962 | } |
| 963 | |
| 964 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 965 | void AccessorPair::AccessorPairPrint(FILE* out) { |
| 966 | HeapObject::PrintHeader(out, "AccessorPair"); |
| 967 | PrintF(out, "\n - getter: "); |
| 968 | getter()->ShortPrint(out); |
| 969 | PrintF(out, "\n - setter: "); |
| 970 | setter()->ShortPrint(out); |
jkummerow@chromium.org | 1e8da74 | 2013-08-26 17:13:35 +0000 | [diff] [blame] | 971 | PrintF(out, "\n - flag: "); |
| 972 | access_flags()->ShortPrint(out); |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 976 | void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) { |
| 977 | HeapObject::PrintHeader(out, "AccessCheckInfo"); |
| 978 | PrintF(out, "\n - named_callback: "); |
| 979 | named_callback()->ShortPrint(out); |
| 980 | PrintF(out, "\n - indexed_callback: "); |
| 981 | indexed_callback()->ShortPrint(out); |
| 982 | PrintF(out, "\n - data: "); |
| 983 | data()->ShortPrint(out); |
| 984 | } |
| 985 | |
| 986 | |
| 987 | void InterceptorInfo::InterceptorInfoPrint(FILE* out) { |
| 988 | HeapObject::PrintHeader(out, "InterceptorInfo"); |
| 989 | PrintF(out, "\n - getter: "); |
| 990 | getter()->ShortPrint(out); |
| 991 | PrintF(out, "\n - setter: "); |
| 992 | setter()->ShortPrint(out); |
| 993 | PrintF(out, "\n - query: "); |
| 994 | query()->ShortPrint(out); |
| 995 | PrintF(out, "\n - deleter: "); |
| 996 | deleter()->ShortPrint(out); |
| 997 | PrintF(out, "\n - enumerator: "); |
| 998 | enumerator()->ShortPrint(out); |
| 999 | PrintF(out, "\n - data: "); |
| 1000 | data()->ShortPrint(out); |
| 1001 | } |
| 1002 | |
| 1003 | |
| 1004 | void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) { |
| 1005 | HeapObject::PrintHeader(out, "CallHandlerInfo"); |
| 1006 | PrintF(out, "\n - callback: "); |
| 1007 | callback()->ShortPrint(out); |
| 1008 | PrintF(out, "\n - data: "); |
| 1009 | data()->ShortPrint(out); |
| 1010 | PrintF(out, "\n - call_stub_cache: "); |
| 1011 | } |
| 1012 | |
| 1013 | |
| 1014 | void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) { |
| 1015 | HeapObject::PrintHeader(out, "FunctionTemplateInfo"); |
| 1016 | PrintF(out, "\n - class name: "); |
| 1017 | class_name()->ShortPrint(out); |
| 1018 | PrintF(out, "\n - tag: "); |
| 1019 | tag()->ShortPrint(out); |
| 1020 | PrintF(out, "\n - property_list: "); |
| 1021 | property_list()->ShortPrint(out); |
| 1022 | PrintF(out, "\n - serial_number: "); |
| 1023 | serial_number()->ShortPrint(out); |
| 1024 | PrintF(out, "\n - call_code: "); |
| 1025 | call_code()->ShortPrint(out); |
| 1026 | PrintF(out, "\n - property_accessors: "); |
| 1027 | property_accessors()->ShortPrint(out); |
| 1028 | PrintF(out, "\n - prototype_template: "); |
| 1029 | prototype_template()->ShortPrint(out); |
| 1030 | PrintF(out, "\n - parent_template: "); |
| 1031 | parent_template()->ShortPrint(out); |
| 1032 | PrintF(out, "\n - named_property_handler: "); |
| 1033 | named_property_handler()->ShortPrint(out); |
| 1034 | PrintF(out, "\n - indexed_property_handler: "); |
| 1035 | indexed_property_handler()->ShortPrint(out); |
| 1036 | PrintF(out, "\n - instance_template: "); |
| 1037 | instance_template()->ShortPrint(out); |
| 1038 | PrintF(out, "\n - signature: "); |
| 1039 | signature()->ShortPrint(out); |
| 1040 | PrintF(out, "\n - access_check_info: "); |
| 1041 | access_check_info()->ShortPrint(out); |
| 1042 | PrintF(out, "\n - hidden_prototype: %s", |
| 1043 | hidden_prototype() ? "true" : "false"); |
| 1044 | PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false"); |
| 1045 | PrintF(out, "\n - need_access_check: %s", |
| 1046 | needs_access_check() ? "true" : "false"); |
| 1047 | } |
| 1048 | |
| 1049 | |
| 1050 | void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) { |
| 1051 | HeapObject::PrintHeader(out, "ObjectTemplateInfo"); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 1052 | PrintF(out, " - tag: "); |
| 1053 | tag()->ShortPrint(out); |
| 1054 | PrintF(out, "\n - property_list: "); |
| 1055 | property_list()->ShortPrint(out); |
jkummerow@chromium.org | 3d00d0a | 2013-09-04 13:57:32 +0000 | [diff] [blame] | 1056 | PrintF(out, "\n - property_accessors: "); |
| 1057 | property_accessors()->ShortPrint(out); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1058 | PrintF(out, "\n - constructor: "); |
| 1059 | constructor()->ShortPrint(out); |
| 1060 | PrintF(out, "\n - internal_field_count: "); |
| 1061 | internal_field_count()->ShortPrint(out); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 1062 | PrintF(out, "\n"); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1063 | } |
| 1064 | |
| 1065 | |
| 1066 | void SignatureInfo::SignatureInfoPrint(FILE* out) { |
| 1067 | HeapObject::PrintHeader(out, "SignatureInfo"); |
| 1068 | PrintF(out, "\n - receiver: "); |
| 1069 | receiver()->ShortPrint(out); |
| 1070 | PrintF(out, "\n - args: "); |
| 1071 | args()->ShortPrint(out); |
| 1072 | } |
| 1073 | |
| 1074 | |
| 1075 | void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) { |
| 1076 | HeapObject::PrintHeader(out, "TypeSwitchInfo"); |
| 1077 | PrintF(out, "\n - types: "); |
| 1078 | types()->ShortPrint(out); |
| 1079 | } |
| 1080 | |
| 1081 | |
danno@chromium.org | bee5199 | 2013-07-10 14:57:15 +0000 | [diff] [blame] | 1082 | void AllocationSite::AllocationSitePrint(FILE* out) { |
| 1083 | HeapObject::PrintHeader(out, "AllocationSite"); |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 1084 | PrintF(out, " - weak_next: "); |
| 1085 | weak_next()->ShortPrint(out); |
machenbach@chromium.org | 528ce02 | 2013-09-23 14:09:36 +0000 | [diff] [blame] | 1086 | PrintF(out, "\n - dependent code: "); |
| 1087 | dependent_code()->ShortPrint(out); |
machenbach@chromium.org | 3d079fe | 2013-09-25 08:19:55 +0000 | [diff] [blame] | 1088 | PrintF(out, "\n - nested site: "); |
| 1089 | nested_site()->ShortPrint(out); |
machenbach@chromium.org | 90dca01 | 2013-11-22 10:04:21 +0000 | [diff] [blame] | 1090 | PrintF(out, "\n - memento found count: "); |
machenbach@chromium.org | 4ddd2f1 | 2014-01-14 08:13:44 +0000 | [diff] [blame] | 1091 | Smi::FromInt(memento_found_count())->ShortPrint(out); |
machenbach@chromium.org | 90dca01 | 2013-11-22 10:04:21 +0000 | [diff] [blame] | 1092 | PrintF(out, "\n - memento create count: "); |
machenbach@chromium.org | 4ddd2f1 | 2014-01-14 08:13:44 +0000 | [diff] [blame] | 1093 | Smi::FromInt(memento_create_count())->ShortPrint(out); |
machenbach@chromium.org | 90dca01 | 2013-11-22 10:04:21 +0000 | [diff] [blame] | 1094 | PrintF(out, "\n - pretenure decision: "); |
machenbach@chromium.org | 4ddd2f1 | 2014-01-14 08:13:44 +0000 | [diff] [blame] | 1095 | Smi::FromInt(pretenure_decision())->ShortPrint(out); |
machenbach@chromium.org | 528ce02 | 2013-09-23 14:09:36 +0000 | [diff] [blame] | 1096 | PrintF(out, "\n - transition_info: "); |
machenbach@chromium.org | b5be0a9 | 2013-11-15 10:32:41 +0000 | [diff] [blame] | 1097 | if (transition_info()->IsSmi()) { |
| 1098 | ElementsKind kind = GetElementsKind(); |
| 1099 | PrintF(out, "Array allocation with ElementsKind "); |
| 1100 | PrintElementsKind(out, kind); |
| 1101 | PrintF(out, "\n"); |
| 1102 | return; |
danno@chromium.org | bee5199 | 2013-07-10 14:57:15 +0000 | [diff] [blame] | 1103 | } else if (transition_info()->IsJSArray()) { |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 1104 | PrintF(out, "Array literal "); |
danno@chromium.org | bee5199 | 2013-07-10 14:57:15 +0000 | [diff] [blame] | 1105 | transition_info()->ShortPrint(out); |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 1106 | PrintF(out, "\n"); |
| 1107 | return; |
| 1108 | } |
| 1109 | |
danno@chromium.org | bee5199 | 2013-07-10 14:57:15 +0000 | [diff] [blame] | 1110 | PrintF(out, "unknown transition_info"); |
| 1111 | transition_info()->ShortPrint(out); |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 1112 | PrintF(out, "\n"); |
| 1113 | } |
| 1114 | |
| 1115 | |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 1116 | void AllocationMemento::AllocationMementoPrint(FILE* out) { |
| 1117 | HeapObject::PrintHeader(out, "AllocationMemento"); |
danno@chromium.org | bee5199 | 2013-07-10 14:57:15 +0000 | [diff] [blame] | 1118 | PrintF(out, " - allocation site: "); |
| 1119 | if (IsValid()) { |
| 1120 | GetAllocationSite()->Print(); |
| 1121 | } else { |
| 1122 | PrintF(out, "<invalid>\n"); |
| 1123 | } |
| 1124 | } |
| 1125 | |
| 1126 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1127 | void Script::ScriptPrint(FILE* out) { |
| 1128 | HeapObject::PrintHeader(out, "Script"); |
| 1129 | PrintF(out, "\n - source: "); |
| 1130 | source()->ShortPrint(out); |
| 1131 | PrintF(out, "\n - name: "); |
| 1132 | name()->ShortPrint(out); |
| 1133 | PrintF(out, "\n - line_offset: "); |
| 1134 | line_offset()->ShortPrint(out); |
| 1135 | PrintF(out, "\n - column_offset: "); |
| 1136 | column_offset()->ShortPrint(out); |
| 1137 | PrintF(out, "\n - type: "); |
| 1138 | type()->ShortPrint(out); |
| 1139 | PrintF(out, "\n - id: "); |
| 1140 | id()->ShortPrint(out); |
| 1141 | PrintF(out, "\n - data: "); |
| 1142 | data()->ShortPrint(out); |
| 1143 | PrintF(out, "\n - context data: "); |
| 1144 | context_data()->ShortPrint(out); |
| 1145 | PrintF(out, "\n - wrapper: "); |
| 1146 | wrapper()->ShortPrint(out); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 1147 | PrintF(out, "\n - compilation type: %d", compilation_type()); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1148 | PrintF(out, "\n - line ends: "); |
| 1149 | line_ends()->ShortPrint(out); |
| 1150 | PrintF(out, "\n - eval from shared: "); |
| 1151 | eval_from_shared()->ShortPrint(out); |
| 1152 | PrintF(out, "\n - eval from instructions offset: "); |
| 1153 | eval_from_instructions_offset()->ShortPrint(out); |
| 1154 | PrintF(out, "\n"); |
| 1155 | } |
| 1156 | |
| 1157 | |
| 1158 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1159 | void DebugInfo::DebugInfoPrint(FILE* out) { |
| 1160 | HeapObject::PrintHeader(out, "DebugInfo"); |
| 1161 | PrintF(out, "\n - shared: "); |
| 1162 | shared()->ShortPrint(out); |
| 1163 | PrintF(out, "\n - original_code: "); |
| 1164 | original_code()->ShortPrint(out); |
| 1165 | PrintF(out, "\n - code: "); |
| 1166 | code()->ShortPrint(out); |
| 1167 | PrintF(out, "\n - break_points: "); |
| 1168 | break_points()->Print(out); |
| 1169 | } |
| 1170 | |
| 1171 | |
| 1172 | void BreakPointInfo::BreakPointInfoPrint(FILE* out) { |
| 1173 | HeapObject::PrintHeader(out, "BreakPointInfo"); |
| 1174 | PrintF(out, "\n - code_position: %d", code_position()->value()); |
| 1175 | PrintF(out, "\n - source_position: %d", source_position()->value()); |
| 1176 | PrintF(out, "\n - statement_position: %d", statement_position()->value()); |
| 1177 | PrintF(out, "\n - break_point_objects: "); |
| 1178 | break_point_objects()->ShortPrint(out); |
| 1179 | } |
| 1180 | #endif // ENABLE_DEBUGGER_SUPPORT |
| 1181 | |
| 1182 | |
| 1183 | void DescriptorArray::PrintDescriptors(FILE* out) { |
| 1184 | PrintF(out, "Descriptor array %d\n", number_of_descriptors()); |
| 1185 | for (int i = 0; i < number_of_descriptors(); i++) { |
| 1186 | PrintF(out, " %d: ", i); |
| 1187 | Descriptor desc; |
| 1188 | Get(i, &desc); |
| 1189 | desc.Print(out); |
| 1190 | } |
| 1191 | PrintF(out, "\n"); |
| 1192 | } |
| 1193 | |
| 1194 | |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 1195 | void TransitionArray::PrintTransitions(FILE* out) { |
| 1196 | PrintF(out, "Transition array %d\n", number_of_transitions()); |
| 1197 | for (int i = 0; i < number_of_transitions(); i++) { |
| 1198 | PrintF(out, " %d: ", i); |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 1199 | GetKey(i)->NamePrint(out); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 1200 | PrintF(out, ": "); |
| 1201 | switch (GetTargetDetails(i).type()) { |
| 1202 | case FIELD: { |
| 1203 | PrintF(out, " (transition to field)\n"); |
| 1204 | break; |
| 1205 | } |
jkummerow@chromium.org | fb732b1 | 2013-07-26 10:27:09 +0000 | [diff] [blame] | 1206 | case CONSTANT: |
| 1207 | PrintF(out, " (transition to constant)\n"); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 1208 | break; |
| 1209 | case CALLBACKS: |
| 1210 | PrintF(out, " (transition to callback)\n"); |
| 1211 | break; |
| 1212 | // Values below are never in the target descriptor array. |
| 1213 | case NORMAL: |
| 1214 | case HANDLER: |
| 1215 | case INTERCEPTOR: |
| 1216 | case TRANSITION: |
| 1217 | case NONEXISTENT: |
| 1218 | UNREACHABLE(); |
| 1219 | break; |
| 1220 | } |
| 1221 | } |
| 1222 | PrintF(out, "\n"); |
| 1223 | } |
| 1224 | |
| 1225 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1226 | #endif // OBJECT_PRINT |
| 1227 | |
| 1228 | |
| 1229 | } } // namespace v8::internal |