The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / deps / v8 / src / objects-printer.cc @ f230a1cf
History | View | Annotate | Download (36.6 KB)
1 |
// Copyright 2012 the V8 project authors. All rights reserved.
|
---|---|
2 |
// Redistribution and use in source and binary forms, with or without
|
3 |
// modification, are permitted provided that the following conditions are
|
4 |
// met:
|
5 |
//
|
6 |
// * Redistributions of source code must retain the above copyright
|
7 |
// notice, this list of conditions and the following disclaimer.
|
8 |
// * Redistributions in binary form must reproduce the above
|
9 |
// copyright notice, this list of conditions and the following
|
10 |
// disclaimer in the documentation and/or other materials provided
|
11 |
// with the distribution.
|
12 |
// * Neither the name of Google Inc. nor the names of its
|
13 |
// contributors may be used to endorse or promote products derived
|
14 |
// from this software without specific prior written permission.
|
15 |
//
|
16 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18 |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20 |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27 |
|
28 |
#include "v8.h" |
29 |
|
30 |
#include "disassembler.h" |
31 |
#include "disasm.h" |
32 |
#include "jsregexp.h" |
33 |
#include "objects-visiting.h" |
34 |
|
35 |
namespace v8 {
|
36 |
namespace internal {
|
37 |
|
38 |
#ifdef OBJECT_PRINT
|
39 |
|
40 |
void MaybeObject::Print() {
|
41 |
Print(stdout); |
42 |
} |
43 |
|
44 |
|
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 |
|
60 |
void MaybeObject::PrintLn() {
|
61 |
PrintLn(stdout); |
62 |
} |
63 |
|
64 |
|
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 |
|
79 |
HandleScope scope(GetIsolate()); |
80 |
if (instance_type < FIRST_NONSTRING_TYPE) {
|
81 |
String::cast(this)->StringPrint(out);
|
82 |
return;
|
83 |
} |
84 |
|
85 |
switch (instance_type) {
|
86 |
case SYMBOL_TYPE:
|
87 |
Symbol::cast(this)->SymbolPrint(out);
|
88 |
break;
|
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;
|
95 |
case FIXED_DOUBLE_ARRAY_TYPE:
|
96 |
FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(out);
|
97 |
break;
|
98 |
case CONSTANT_POOL_ARRAY_TYPE:
|
99 |
ConstantPoolArray::cast(this)->ConstantPoolArrayPrint(out);
|
100 |
break;
|
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;
|
107 |
case FREE_SPACE_TYPE:
|
108 |
FreeSpace::cast(this)->FreeSpacePrint(out);
|
109 |
break;
|
110 |
case EXTERNAL_PIXEL_ARRAY_TYPE:
|
111 |
ExternalPixelArray::cast(this)->ExternalPixelArrayPrint(out);
|
112 |
break;
|
113 |
case EXTERNAL_BYTE_ARRAY_TYPE:
|
114 |
ExternalByteArray::cast(this)->ExternalByteArrayPrint(out);
|
115 |
break;
|
116 |
case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
|
117 |
ExternalUnsignedByteArray::cast(this)
|
118 |
->ExternalUnsignedByteArrayPrint(out); |
119 |
break;
|
120 |
case EXTERNAL_SHORT_ARRAY_TYPE:
|
121 |
ExternalShortArray::cast(this)->ExternalShortArrayPrint(out);
|
122 |
break;
|
123 |
case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
|
124 |
ExternalUnsignedShortArray::cast(this)
|
125 |
->ExternalUnsignedShortArrayPrint(out); |
126 |
break;
|
127 |
case EXTERNAL_INT_ARRAY_TYPE:
|
128 |
ExternalIntArray::cast(this)->ExternalIntArrayPrint(out);
|
129 |
break;
|
130 |
case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
|
131 |
ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out);
|
132 |
break;
|
133 |
case EXTERNAL_FLOAT_ARRAY_TYPE:
|
134 |
ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out);
|
135 |
break;
|
136 |
case EXTERNAL_DOUBLE_ARRAY_TYPE:
|
137 |
ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out);
|
138 |
break;
|
139 |
case FILLER_TYPE:
|
140 |
PrintF(out, "filler");
|
141 |
break;
|
142 |
case JS_OBJECT_TYPE: // fall through |
143 |
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
|
144 |
case JS_ARRAY_TYPE:
|
145 |
case JS_GENERATOR_OBJECT_TYPE:
|
146 |
case JS_REGEXP_TYPE:
|
147 |
JSObject::cast(this)->JSObjectPrint(out);
|
148 |
break;
|
149 |
case ODDBALL_TYPE:
|
150 |
Oddball::cast(this)->to_string()->Print(out);
|
151 |
break;
|
152 |
case JS_MODULE_TYPE:
|
153 |
JSModule::cast(this)->JSModulePrint(out);
|
154 |
break;
|
155 |
case JS_FUNCTION_TYPE:
|
156 |
JSFunction::cast(this)->JSFunctionPrint(out);
|
157 |
break;
|
158 |
case JS_GLOBAL_PROXY_TYPE:
|
159 |
JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out);
|
160 |
break;
|
161 |
case JS_GLOBAL_OBJECT_TYPE:
|
162 |
JSGlobalObject::cast(this)->JSGlobalObjectPrint(out);
|
163 |
break;
|
164 |
case JS_BUILTINS_OBJECT_TYPE:
|
165 |
JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out);
|
166 |
break;
|
167 |
case JS_VALUE_TYPE:
|
168 |
PrintF(out, "Value wrapper around:");
|
169 |
JSValue::cast(this)->value()->Print(out);
|
170 |
break;
|
171 |
case JS_DATE_TYPE:
|
172 |
JSDate::cast(this)->JSDatePrint(out);
|
173 |
break;
|
174 |
case CODE_TYPE:
|
175 |
Code::cast(this)->CodePrint(out);
|
176 |
break;
|
177 |
case JS_PROXY_TYPE:
|
178 |
JSProxy::cast(this)->JSProxyPrint(out);
|
179 |
break;
|
180 |
case JS_FUNCTION_PROXY_TYPE:
|
181 |
JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out);
|
182 |
break;
|
183 |
case JS_SET_TYPE:
|
184 |
JSSet::cast(this)->JSSetPrint(out);
|
185 |
break;
|
186 |
case JS_MAP_TYPE:
|
187 |
JSMap::cast(this)->JSMapPrint(out);
|
188 |
break;
|
189 |
case JS_WEAK_MAP_TYPE:
|
190 |
JSWeakMap::cast(this)->JSWeakMapPrint(out);
|
191 |
break;
|
192 |
case JS_WEAK_SET_TYPE:
|
193 |
JSWeakSet::cast(this)->JSWeakSetPrint(out);
|
194 |
break;
|
195 |
case FOREIGN_TYPE:
|
196 |
Foreign::cast(this)->ForeignPrint(out);
|
197 |
break;
|
198 |
case SHARED_FUNCTION_INFO_TYPE:
|
199 |
SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out);
|
200 |
break;
|
201 |
case JS_MESSAGE_OBJECT_TYPE:
|
202 |
JSMessageObject::cast(this)->JSMessageObjectPrint(out);
|
203 |
break;
|
204 |
case CELL_TYPE:
|
205 |
Cell::cast(this)->CellPrint(out);
|
206 |
break;
|
207 |
case PROPERTY_CELL_TYPE:
|
208 |
PropertyCell::cast(this)->PropertyCellPrint(out);
|
209 |
break;
|
210 |
case JS_ARRAY_BUFFER_TYPE:
|
211 |
JSArrayBuffer::cast(this)->JSArrayBufferPrint(out);
|
212 |
break;
|
213 |
case JS_TYPED_ARRAY_TYPE:
|
214 |
JSTypedArray::cast(this)->JSTypedArrayPrint(out);
|
215 |
break;
|
216 |
case JS_DATA_VIEW_TYPE:
|
217 |
JSDataView::cast(this)->JSDataViewPrint(out);
|
218 |
break;
|
219 |
#define MAKE_STRUCT_CASE(NAME, Name, name) \
|
220 |
case NAME##_TYPE: \ |
221 |
Name::cast(this)->Name##Print(out); \ |
222 |
break;
|
223 |
STRUCT_LIST(MAKE_STRUCT_CASE) |
224 |
#undef MAKE_STRUCT_CASE
|
225 |
|
226 |
default:
|
227 |
PrintF(out, "UNKNOWN TYPE %d", map()->instance_type());
|
228 |
UNREACHABLE(); |
229 |
break;
|
230 |
} |
231 |
} |
232 |
|
233 |
|
234 |
void ByteArray::ByteArrayPrint(FILE* out) {
|
235 |
PrintF(out, "byte array, data starts at %p", GetDataStartAddress());
|
236 |
} |
237 |
|
238 |
|
239 |
void FreeSpace::FreeSpacePrint(FILE* out) {
|
240 |
PrintF(out, "free space, size %d", Size());
|
241 |
} |
242 |
|
243 |
|
244 |
void ExternalPixelArray::ExternalPixelArrayPrint(FILE* out) {
|
245 |
PrintF(out, "external pixel array");
|
246 |
} |
247 |
|
248 |
|
249 |
void ExternalByteArray::ExternalByteArrayPrint(FILE* out) {
|
250 |
PrintF(out, "external byte array");
|
251 |
} |
252 |
|
253 |
|
254 |
void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) {
|
255 |
PrintF(out, "external unsigned byte array");
|
256 |
} |
257 |
|
258 |
|
259 |
void ExternalShortArray::ExternalShortArrayPrint(FILE* out) {
|
260 |
PrintF(out, "external short array");
|
261 |
} |
262 |
|
263 |
|
264 |
void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) {
|
265 |
PrintF(out, "external unsigned short array");
|
266 |
} |
267 |
|
268 |
|
269 |
void ExternalIntArray::ExternalIntArrayPrint(FILE* out) {
|
270 |
PrintF(out, "external int array");
|
271 |
} |
272 |
|
273 |
|
274 |
void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) {
|
275 |
PrintF(out, "external unsigned int array");
|
276 |
} |
277 |
|
278 |
|
279 |
void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) {
|
280 |
PrintF(out, "external float array");
|
281 |
} |
282 |
|
283 |
|
284 |
void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) {
|
285 |
PrintF(out, "external double array");
|
286 |
} |
287 |
|
288 |
|
289 |
void JSObject::PrintProperties(FILE* out) {
|
290 |
if (HasFastProperties()) {
|
291 |
DescriptorArray* descs = map()->instance_descriptors(); |
292 |
for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
293 |
PrintF(out, " ");
|
294 |
descs->GetKey(i)->NamePrint(out); |
295 |
PrintF(out, ": ");
|
296 |
switch (descs->GetType(i)) {
|
297 |
case FIELD: {
|
298 |
int index = descs->GetFieldIndex(i);
|
299 |
RawFastPropertyAt(index)->ShortPrint(out); |
300 |
PrintF(out, " (field at offset %d)\n", index);
|
301 |
break;
|
302 |
} |
303 |
case CONSTANT:
|
304 |
descs->GetConstant(i)->ShortPrint(out); |
305 |
PrintF(out, " (constant)\n");
|
306 |
break;
|
307 |
case CALLBACKS:
|
308 |
descs->GetCallbacksObject(i)->ShortPrint(out); |
309 |
PrintF(out, " (callback)\n");
|
310 |
break;
|
311 |
case NORMAL: // only in slow mode |
312 |
case HANDLER: // only in lookup results, not in descriptors |
313 |
case INTERCEPTOR: // only in lookup results, not in descriptors |
314 |
// There are no transitions in the descriptor array.
|
315 |
case TRANSITION:
|
316 |
case NONEXISTENT:
|
317 |
UNREACHABLE(); |
318 |
break;
|
319 |
} |
320 |
} |
321 |
} else {
|
322 |
property_dictionary()->Print(out); |
323 |
} |
324 |
} |
325 |
|
326 |
|
327 |
void JSObject::PrintElements(FILE* out) {
|
328 |
// Don't call GetElementsKind, its validation code can cause the printer to
|
329 |
// fail when debugging.
|
330 |
switch (map()->elements_kind()) {
|
331 |
case FAST_HOLEY_SMI_ELEMENTS:
|
332 |
case FAST_SMI_ELEMENTS:
|
333 |
case FAST_HOLEY_ELEMENTS:
|
334 |
case FAST_ELEMENTS: {
|
335 |
// Print in array notation for non-sparse arrays.
|
336 |
FixedArray* p = FixedArray::cast(elements()); |
337 |
for (int i = 0; i < p->length(); i++) { |
338 |
PrintF(out, " %d: ", i);
|
339 |
p->get(i)->ShortPrint(out); |
340 |
PrintF(out, "\n");
|
341 |
} |
342 |
break;
|
343 |
} |
344 |
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
345 |
case FAST_DOUBLE_ELEMENTS: {
|
346 |
// Print in array notation for non-sparse arrays.
|
347 |
if (elements()->length() > 0) { |
348 |
FixedDoubleArray* p = FixedDoubleArray::cast(elements()); |
349 |
for (int i = 0; i < p->length(); i++) { |
350 |
if (p->is_the_hole(i)) {
|
351 |
PrintF(out, " %d: <the hole>", i);
|
352 |
} else {
|
353 |
PrintF(out, " %d: %g", i, p->get_scalar(i));
|
354 |
} |
355 |
PrintF(out, "\n");
|
356 |
} |
357 |
} |
358 |
break;
|
359 |
} |
360 |
case EXTERNAL_PIXEL_ELEMENTS: {
|
361 |
ExternalPixelArray* p = ExternalPixelArray::cast(elements()); |
362 |
for (int i = 0; i < p->length(); i++) { |
363 |
PrintF(out, " %d: %d\n", i, p->get_scalar(i));
|
364 |
} |
365 |
break;
|
366 |
} |
367 |
case EXTERNAL_BYTE_ELEMENTS: {
|
368 |
ExternalByteArray* p = ExternalByteArray::cast(elements()); |
369 |
for (int i = 0; i < p->length(); i++) { |
370 |
PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
371 |
} |
372 |
break;
|
373 |
} |
374 |
case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
|
375 |
ExternalUnsignedByteArray* p = |
376 |
ExternalUnsignedByteArray::cast(elements()); |
377 |
for (int i = 0; i < p->length(); i++) { |
378 |
PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
379 |
} |
380 |
break;
|
381 |
} |
382 |
case EXTERNAL_SHORT_ELEMENTS: {
|
383 |
ExternalShortArray* p = ExternalShortArray::cast(elements()); |
384 |
for (int i = 0; i < p->length(); i++) { |
385 |
PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
386 |
} |
387 |
break;
|
388 |
} |
389 |
case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
|
390 |
ExternalUnsignedShortArray* p = |
391 |
ExternalUnsignedShortArray::cast(elements()); |
392 |
for (int i = 0; i < p->length(); i++) { |
393 |
PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
394 |
} |
395 |
break;
|
396 |
} |
397 |
case EXTERNAL_INT_ELEMENTS: {
|
398 |
ExternalIntArray* p = ExternalIntArray::cast(elements()); |
399 |
for (int i = 0; i < p->length(); i++) { |
400 |
PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
401 |
} |
402 |
break;
|
403 |
} |
404 |
case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
|
405 |
ExternalUnsignedIntArray* p = |
406 |
ExternalUnsignedIntArray::cast(elements()); |
407 |
for (int i = 0; i < p->length(); i++) { |
408 |
PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i))); |
409 |
} |
410 |
break;
|
411 |
} |
412 |
case EXTERNAL_FLOAT_ELEMENTS: {
|
413 |
ExternalFloatArray* p = ExternalFloatArray::cast(elements()); |
414 |
for (int i = 0; i < p->length(); i++) { |
415 |
PrintF(out, " %d: %f\n", i, p->get_scalar(i));
|
416 |
} |
417 |
break;
|
418 |
} |
419 |
case EXTERNAL_DOUBLE_ELEMENTS: {
|
420 |
ExternalDoubleArray* p = ExternalDoubleArray::cast(elements()); |
421 |
for (int i = 0; i < p->length(); i++) { |
422 |
PrintF(out, " %d: %f\n", i, p->get_scalar(i));
|
423 |
} |
424 |
break;
|
425 |
} |
426 |
case DICTIONARY_ELEMENTS:
|
427 |
elements()->Print(out); |
428 |
break;
|
429 |
case NON_STRICT_ARGUMENTS_ELEMENTS: {
|
430 |
FixedArray* p = FixedArray::cast(elements()); |
431 |
PrintF(out, " parameter map:");
|
432 |
for (int i = 2; i < p->length(); i++) { |
433 |
PrintF(out, " %d:", i - 2); |
434 |
p->get(i)->ShortPrint(out); |
435 |
} |
436 |
PrintF(out, "\n context: ");
|
437 |
p->get(0)->ShortPrint(out);
|
438 |
PrintF(out, "\n arguments: ");
|
439 |
p->get(1)->ShortPrint(out);
|
440 |
PrintF(out, "\n");
|
441 |
break;
|
442 |
} |
443 |
} |
444 |
} |
445 |
|
446 |
|
447 |
void JSObject::PrintTransitions(FILE* out) {
|
448 |
if (!map()->HasTransitionArray()) return; |
449 |
TransitionArray* transitions = map()->transitions(); |
450 |
for (int i = 0; i < transitions->number_of_transitions(); i++) { |
451 |
PrintF(out, " ");
|
452 |
transitions->GetKey(i)->NamePrint(out); |
453 |
PrintF(out, ": ");
|
454 |
switch (transitions->GetTargetDetails(i).type()) {
|
455 |
case FIELD: {
|
456 |
PrintF(out, " (transition to field)\n");
|
457 |
break;
|
458 |
} |
459 |
case CONSTANT:
|
460 |
PrintF(out, " (transition to constant)\n");
|
461 |
break;
|
462 |
case CALLBACKS:
|
463 |
PrintF(out, " (transition to callback)\n");
|
464 |
break;
|
465 |
// Values below are never in the target descriptor array.
|
466 |
case NORMAL:
|
467 |
case HANDLER:
|
468 |
case INTERCEPTOR:
|
469 |
case TRANSITION:
|
470 |
case NONEXISTENT:
|
471 |
UNREACHABLE(); |
472 |
break;
|
473 |
} |
474 |
} |
475 |
} |
476 |
|
477 |
|
478 |
void JSObject::JSObjectPrint(FILE* out) {
|
479 |
PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this)); |
480 |
PrintF(out, " - map = %p [", reinterpret_cast<void*>(map())); |
481 |
// Don't call GetElementsKind, its validation code can cause the printer to
|
482 |
// fail when debugging.
|
483 |
PrintElementsKind(out, this->map()->elements_kind());
|
484 |
PrintF(out, |
485 |
"]\n - prototype = %p\n",
|
486 |
reinterpret_cast<void*>(GetPrototype())); |
487 |
PrintF(out, " {\n");
|
488 |
PrintProperties(out); |
489 |
PrintTransitions(out); |
490 |
PrintElements(out); |
491 |
PrintF(out, " }\n");
|
492 |
} |
493 |
|
494 |
|
495 |
void JSModule::JSModulePrint(FILE* out) {
|
496 |
HeapObject::PrintHeader(out, "JSModule");
|
497 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
498 |
PrintF(out, " - context = ");
|
499 |
context()->Print(out); |
500 |
PrintF(out, " - scope_info = ");
|
501 |
scope_info()->ShortPrint(out); |
502 |
PrintElementsKind(out, this->map()->elements_kind());
|
503 |
PrintF(out, " {\n");
|
504 |
PrintProperties(out); |
505 |
PrintElements(out); |
506 |
PrintF(out, " }\n");
|
507 |
} |
508 |
|
509 |
|
510 |
static const char* TypeToString(InstanceType type) { |
511 |
switch (type) {
|
512 |
#define TYPE_TO_STRING(TYPE) case TYPE: return #TYPE; |
513 |
INSTANCE_TYPE_LIST(TYPE_TO_STRING) |
514 |
#undef TYPE_TO_STRING
|
515 |
} |
516 |
UNREACHABLE(); |
517 |
return "UNKNOWN"; // Keep the compiler happy. |
518 |
} |
519 |
|
520 |
|
521 |
void Symbol::SymbolPrint(FILE* out) {
|
522 |
HeapObject::PrintHeader(out, "Symbol");
|
523 |
PrintF(out, " - hash: %d\n", Hash());
|
524 |
PrintF(out, " - name: ");
|
525 |
name()->ShortPrint(); |
526 |
PrintF(out, "\n");
|
527 |
} |
528 |
|
529 |
|
530 |
void Map::MapPrint(FILE* out) {
|
531 |
HeapObject::PrintHeader(out, "Map");
|
532 |
PrintF(out, " - type: %s\n", TypeToString(instance_type()));
|
533 |
PrintF(out, " - instance size: %d\n", instance_size());
|
534 |
PrintF(out, " - inobject properties: %d\n", inobject_properties());
|
535 |
PrintF(out, " - elements kind: ");
|
536 |
PrintElementsKind(out, elements_kind()); |
537 |
PrintF(out, "\n - pre-allocated property fields: %d\n",
|
538 |
pre_allocated_property_fields()); |
539 |
PrintF(out, " - unused property fields: %d\n", unused_property_fields());
|
540 |
if (is_hidden_prototype()) {
|
541 |
PrintF(out, " - hidden_prototype\n");
|
542 |
} |
543 |
if (has_named_interceptor()) {
|
544 |
PrintF(out, " - named_interceptor\n");
|
545 |
} |
546 |
if (has_indexed_interceptor()) {
|
547 |
PrintF(out, " - indexed_interceptor\n");
|
548 |
} |
549 |
if (is_undetectable()) {
|
550 |
PrintF(out, " - undetectable\n");
|
551 |
} |
552 |
if (has_instance_call_handler()) {
|
553 |
PrintF(out, " - instance_call_handler\n");
|
554 |
} |
555 |
if (is_access_check_needed()) {
|
556 |
PrintF(out, " - access_check_needed\n");
|
557 |
} |
558 |
PrintF(out, " - back pointer: ");
|
559 |
GetBackPointer()->ShortPrint(out); |
560 |
PrintF(out, "\n - instance descriptors %s#%i: ",
|
561 |
owns_descriptors() ? "(own) " : "", |
562 |
NumberOfOwnDescriptors()); |
563 |
instance_descriptors()->ShortPrint(out); |
564 |
if (HasTransitionArray()) {
|
565 |
PrintF(out, "\n - transitions: ");
|
566 |
transitions()->ShortPrint(out); |
567 |
} |
568 |
PrintF(out, "\n - prototype: ");
|
569 |
prototype()->ShortPrint(out); |
570 |
PrintF(out, "\n - constructor: ");
|
571 |
constructor()->ShortPrint(out); |
572 |
PrintF(out, "\n - code cache: ");
|
573 |
code_cache()->ShortPrint(out); |
574 |
PrintF(out, "\n - dependent code: ");
|
575 |
dependent_code()->ShortPrint(out); |
576 |
PrintF(out, "\n");
|
577 |
} |
578 |
|
579 |
|
580 |
void CodeCache::CodeCachePrint(FILE* out) {
|
581 |
HeapObject::PrintHeader(out, "CodeCache");
|
582 |
PrintF(out, "\n - default_cache: ");
|
583 |
default_cache()->ShortPrint(out); |
584 |
PrintF(out, "\n - normal_type_cache: ");
|
585 |
normal_type_cache()->ShortPrint(out); |
586 |
} |
587 |
|
588 |
|
589 |
void PolymorphicCodeCache::PolymorphicCodeCachePrint(FILE* out) {
|
590 |
HeapObject::PrintHeader(out, "PolymorphicCodeCache");
|
591 |
PrintF(out, "\n - cache: ");
|
592 |
cache()->ShortPrint(out); |
593 |
} |
594 |
|
595 |
|
596 |
void TypeFeedbackInfo::TypeFeedbackInfoPrint(FILE* out) {
|
597 |
HeapObject::PrintHeader(out, "TypeFeedbackInfo");
|
598 |
PrintF(out, " - ic_total_count: %d, ic_with_type_info_count: %d\n",
|
599 |
ic_total_count(), ic_with_type_info_count()); |
600 |
PrintF(out, " - type_feedback_cells: ");
|
601 |
type_feedback_cells()->FixedArrayPrint(out); |
602 |
} |
603 |
|
604 |
|
605 |
void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(FILE* out) {
|
606 |
HeapObject::PrintHeader(out, "AliasedArgumentsEntry");
|
607 |
PrintF(out, "\n - aliased_context_slot: %d", aliased_context_slot());
|
608 |
} |
609 |
|
610 |
|
611 |
void FixedArray::FixedArrayPrint(FILE* out) {
|
612 |
HeapObject::PrintHeader(out, "FixedArray");
|
613 |
PrintF(out, " - length: %d", length());
|
614 |
for (int i = 0; i < length(); i++) { |
615 |
PrintF(out, "\n [%d]: ", i);
|
616 |
get(i)->ShortPrint(out); |
617 |
} |
618 |
PrintF(out, "\n");
|
619 |
} |
620 |
|
621 |
|
622 |
void FixedDoubleArray::FixedDoubleArrayPrint(FILE* out) {
|
623 |
HeapObject::PrintHeader(out, "FixedDoubleArray");
|
624 |
PrintF(out, " - length: %d", length());
|
625 |
for (int i = 0; i < length(); i++) { |
626 |
if (is_the_hole(i)) {
|
627 |
PrintF(out, "\n [%d]: <the hole>", i);
|
628 |
} else {
|
629 |
PrintF(out, "\n [%d]: %g", i, get_scalar(i));
|
630 |
} |
631 |
} |
632 |
PrintF(out, "\n");
|
633 |
} |
634 |
|
635 |
|
636 |
void ConstantPoolArray::ConstantPoolArrayPrint(FILE* out) {
|
637 |
HeapObject::PrintHeader(out, "ConstantPoolArray");
|
638 |
PrintF(out, " - length: %d", length());
|
639 |
for (int i = 0; i < length(); i++) { |
640 |
if (i < first_ptr_index()) {
|
641 |
PrintF(out, "\n [%d]: double: %g", i, get_int64_entry_as_double(i));
|
642 |
} else if (i < first_int32_index()) { |
643 |
PrintF(out, "\n [%d]: pointer: %p", i,
|
644 |
reinterpret_cast<void*>(get_ptr_entry(i))); |
645 |
} else {
|
646 |
PrintF(out, "\n [%d]: int32: %d", i, get_int32_entry(i));
|
647 |
} |
648 |
} |
649 |
PrintF(out, "\n");
|
650 |
} |
651 |
|
652 |
|
653 |
void JSValue::JSValuePrint(FILE* out) {
|
654 |
HeapObject::PrintHeader(out, "ValueObject");
|
655 |
value()->Print(out); |
656 |
} |
657 |
|
658 |
|
659 |
void JSMessageObject::JSMessageObjectPrint(FILE* out) {
|
660 |
HeapObject::PrintHeader(out, "JSMessageObject");
|
661 |
PrintF(out, " - type: ");
|
662 |
type()->ShortPrint(out); |
663 |
PrintF(out, "\n - arguments: ");
|
664 |
arguments()->ShortPrint(out); |
665 |
PrintF(out, "\n - start_position: %d", start_position());
|
666 |
PrintF(out, "\n - end_position: %d", end_position());
|
667 |
PrintF(out, "\n - script: ");
|
668 |
script()->ShortPrint(out); |
669 |
PrintF(out, "\n - stack_trace: ");
|
670 |
stack_trace()->ShortPrint(out); |
671 |
PrintF(out, "\n - stack_frames: ");
|
672 |
stack_frames()->ShortPrint(out); |
673 |
PrintF(out, "\n");
|
674 |
} |
675 |
|
676 |
|
677 |
void String::StringPrint(FILE* out) {
|
678 |
if (StringShape(this).IsInternalized()) { |
679 |
PrintF(out, "#");
|
680 |
} else if (StringShape(this).IsCons()) { |
681 |
PrintF(out, "c\"");
|
682 |
} else {
|
683 |
PrintF(out, "\"");
|
684 |
} |
685 |
|
686 |
const char truncated_epilogue[] = "...<truncated>"; |
687 |
int len = length();
|
688 |
if (!FLAG_use_verbose_printer) {
|
689 |
if (len > 100) { |
690 |
len = 100 - sizeof(truncated_epilogue); |
691 |
} |
692 |
} |
693 |
for (int i = 0; i < len; i++) { |
694 |
PrintF(out, "%c", Get(i));
|
695 |
} |
696 |
if (len != length()) {
|
697 |
PrintF(out, "%s", truncated_epilogue);
|
698 |
} |
699 |
|
700 |
if (!StringShape(this).IsInternalized()) PrintF(out, "\""); |
701 |
} |
702 |
|
703 |
|
704 |
void Name::NamePrint(FILE* out) {
|
705 |
if (IsString())
|
706 |
String::cast(this)->StringPrint(out);
|
707 |
else
|
708 |
ShortPrint(); |
709 |
} |
710 |
|
711 |
|
712 |
// This method is only meant to be called from gdb for debugging purposes.
|
713 |
// Since the string can also be in two-byte encoding, non-ASCII characters
|
714 |
// will be ignored in the output.
|
715 |
char* String::ToAsciiArray() {
|
716 |
// Static so that subsequent calls frees previously allocated space.
|
717 |
// This also means that previous results will be overwritten.
|
718 |
static char* buffer = NULL; |
719 |
if (buffer != NULL) free(buffer); |
720 |
buffer = new char[length()+1]; |
721 |
WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length()); |
722 |
buffer[length()] = 0;
|
723 |
return buffer;
|
724 |
} |
725 |
|
726 |
|
727 |
static const char* const weekdays[] = { |
728 |
"???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" |
729 |
}; |
730 |
|
731 |
|
732 |
void JSDate::JSDatePrint(FILE* out) {
|
733 |
HeapObject::PrintHeader(out, "JSDate");
|
734 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
735 |
PrintF(out, " - value = ");
|
736 |
value()->Print(out); |
737 |
if (!year()->IsSmi()) {
|
738 |
PrintF(out, " - time = NaN\n");
|
739 |
} else {
|
740 |
PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
|
741 |
weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0], |
742 |
year()->IsSmi() ? Smi::cast(year())->value() : -1,
|
743 |
month()->IsSmi() ? Smi::cast(month())->value() : -1,
|
744 |
day()->IsSmi() ? Smi::cast(day())->value() : -1,
|
745 |
hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
|
746 |
min()->IsSmi() ? Smi::cast(min())->value() : -1,
|
747 |
sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
|
748 |
} |
749 |
} |
750 |
|
751 |
|
752 |
void JSProxy::JSProxyPrint(FILE* out) {
|
753 |
HeapObject::PrintHeader(out, "JSProxy");
|
754 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
755 |
PrintF(out, " - handler = ");
|
756 |
handler()->Print(out); |
757 |
PrintF(out, " - hash = ");
|
758 |
hash()->Print(out); |
759 |
PrintF(out, "\n");
|
760 |
} |
761 |
|
762 |
|
763 |
void JSFunctionProxy::JSFunctionProxyPrint(FILE* out) {
|
764 |
HeapObject::PrintHeader(out, "JSFunctionProxy");
|
765 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
766 |
PrintF(out, " - handler = ");
|
767 |
handler()->Print(out); |
768 |
PrintF(out, " - call_trap = ");
|
769 |
call_trap()->Print(out); |
770 |
PrintF(out, " - construct_trap = ");
|
771 |
construct_trap()->Print(out); |
772 |
PrintF(out, "\n");
|
773 |
} |
774 |
|
775 |
|
776 |
void JSSet::JSSetPrint(FILE* out) {
|
777 |
HeapObject::PrintHeader(out, "JSSet");
|
778 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
779 |
PrintF(out, " - table = ");
|
780 |
table()->ShortPrint(out); |
781 |
PrintF(out, "\n");
|
782 |
} |
783 |
|
784 |
|
785 |
void JSMap::JSMapPrint(FILE* out) {
|
786 |
HeapObject::PrintHeader(out, "JSMap");
|
787 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
788 |
PrintF(out, " - table = ");
|
789 |
table()->ShortPrint(out); |
790 |
PrintF(out, "\n");
|
791 |
} |
792 |
|
793 |
|
794 |
void JSWeakMap::JSWeakMapPrint(FILE* out) {
|
795 |
HeapObject::PrintHeader(out, "JSWeakMap");
|
796 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
797 |
PrintF(out, " - table = ");
|
798 |
table()->ShortPrint(out); |
799 |
PrintF(out, "\n");
|
800 |
} |
801 |
|
802 |
|
803 |
void JSWeakSet::JSWeakSetPrint(FILE* out) {
|
804 |
HeapObject::PrintHeader(out, "JSWeakSet");
|
805 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
806 |
PrintF(out, " - table = ");
|
807 |
table()->ShortPrint(out); |
808 |
PrintF(out, "\n");
|
809 |
} |
810 |
|
811 |
|
812 |
void JSArrayBuffer::JSArrayBufferPrint(FILE* out) {
|
813 |
HeapObject::PrintHeader(out, "JSArrayBuffer");
|
814 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
815 |
PrintF(out, " - backing_store = %p\n", backing_store());
|
816 |
PrintF(out, " - byte_length = ");
|
817 |
byte_length()->ShortPrint(out); |
818 |
PrintF(out, "\n");
|
819 |
} |
820 |
|
821 |
|
822 |
void JSTypedArray::JSTypedArrayPrint(FILE* out) {
|
823 |
HeapObject::PrintHeader(out, "JSTypedArray");
|
824 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
825 |
PrintF(out, " - buffer =");
|
826 |
buffer()->ShortPrint(out); |
827 |
PrintF(out, "\n - byte_offset = ");
|
828 |
byte_offset()->ShortPrint(out); |
829 |
PrintF(out, "\n - byte_length = ");
|
830 |
byte_length()->ShortPrint(out); |
831 |
PrintF(out, "\n - length = ");
|
832 |
length()->ShortPrint(out); |
833 |
PrintF("\n");
|
834 |
PrintElements(out); |
835 |
} |
836 |
|
837 |
|
838 |
void JSDataView::JSDataViewPrint(FILE* out) {
|
839 |
HeapObject::PrintHeader(out, "JSDataView");
|
840 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
841 |
PrintF(out, " - buffer =");
|
842 |
buffer()->ShortPrint(out); |
843 |
PrintF(out, "\n - byte_offset = ");
|
844 |
byte_offset()->ShortPrint(out); |
845 |
PrintF(out, "\n - byte_length = ");
|
846 |
byte_length()->ShortPrint(out); |
847 |
PrintF("\n");
|
848 |
} |
849 |
|
850 |
|
851 |
void JSFunction::JSFunctionPrint(FILE* out) {
|
852 |
HeapObject::PrintHeader(out, "Function");
|
853 |
PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); |
854 |
PrintF(out, " - initial_map = ");
|
855 |
if (has_initial_map()) {
|
856 |
initial_map()->ShortPrint(out); |
857 |
} |
858 |
PrintF(out, "\n - shared_info = ");
|
859 |
shared()->ShortPrint(out); |
860 |
PrintF(out, "\n - name = ");
|
861 |
shared()->name()->Print(out); |
862 |
PrintF(out, "\n - context = ");
|
863 |
context()->ShortPrint(out); |
864 |
PrintF(out, "\n - literals = ");
|
865 |
literals()->ShortPrint(out); |
866 |
PrintF(out, "\n - code = ");
|
867 |
code()->ShortPrint(out); |
868 |
PrintF(out, "\n");
|
869 |
|
870 |
PrintProperties(out); |
871 |
PrintElements(out); |
872 |
|
873 |
PrintF(out, "\n");
|
874 |
} |
875 |
|
876 |
|
877 |
void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) {
|
878 |
HeapObject::PrintHeader(out, "SharedFunctionInfo");
|
879 |
PrintF(out, " - name: ");
|
880 |
name()->ShortPrint(out); |
881 |
PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties());
|
882 |
PrintF(out, "\n - instance class name = ");
|
883 |
instance_class_name()->Print(out); |
884 |
PrintF(out, "\n - code = ");
|
885 |
code()->ShortPrint(out); |
886 |
if (HasSourceCode()) {
|
887 |
PrintF(out, "\n - source code = ");
|
888 |
String* source = String::cast(Script::cast(script())->source()); |
889 |
int start = start_position();
|
890 |
int length = end_position() - start;
|
891 |
SmartArrayPointer<char> source_string =
|
892 |
source->ToCString(DISALLOW_NULLS, |
893 |
FAST_STRING_TRAVERSAL, |
894 |
start, length, NULL);
|
895 |
PrintF(out, "%s", *source_string);
|
896 |
} |
897 |
// Script files are often large, hard to read.
|
898 |
// PrintF(out, "\n - script =");
|
899 |
// script()->Print(out);
|
900 |
PrintF(out, "\n - function token position = %d", function_token_position());
|
901 |
PrintF(out, "\n - start position = %d", start_position());
|
902 |
PrintF(out, "\n - end position = %d", end_position());
|
903 |
PrintF(out, "\n - is expression = %d", is_expression());
|
904 |
PrintF(out, "\n - debug info = ");
|
905 |
debug_info()->ShortPrint(out); |
906 |
PrintF(out, "\n - length = %d", length());
|
907 |
PrintF(out, "\n - optimized_code_map = ");
|
908 |
optimized_code_map()->ShortPrint(out); |
909 |
PrintF(out, "\n");
|
910 |
} |
911 |
|
912 |
|
913 |
void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) {
|
914 |
PrintF(out, "global_proxy ");
|
915 |
JSObjectPrint(out); |
916 |
PrintF(out, "native context : ");
|
917 |
native_context()->ShortPrint(out); |
918 |
PrintF(out, "\n");
|
919 |
} |
920 |
|
921 |
|
922 |
void JSGlobalObject::JSGlobalObjectPrint(FILE* out) {
|
923 |
PrintF(out, "global ");
|
924 |
JSObjectPrint(out); |
925 |
PrintF(out, "native context : ");
|
926 |
native_context()->ShortPrint(out); |
927 |
PrintF(out, "\n");
|
928 |
} |
929 |
|
930 |
|
931 |
void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) {
|
932 |
PrintF(out, "builtins ");
|
933 |
JSObjectPrint(out); |
934 |
} |
935 |
|
936 |
|
937 |
void Cell::CellPrint(FILE* out) {
|
938 |
HeapObject::PrintHeader(out, "Cell");
|
939 |
} |
940 |
|
941 |
|
942 |
void PropertyCell::PropertyCellPrint(FILE* out) {
|
943 |
HeapObject::PrintHeader(out, "PropertyCell");
|
944 |
} |
945 |
|
946 |
|
947 |
void Code::CodePrint(FILE* out) {
|
948 |
HeapObject::PrintHeader(out, "Code");
|
949 |
#ifdef ENABLE_DISASSEMBLER
|
950 |
if (FLAG_use_verbose_printer) {
|
951 |
Disassemble(NULL, out);
|
952 |
} |
953 |
#endif
|
954 |
} |
955 |
|
956 |
|
957 |
void Foreign::ForeignPrint(FILE* out) {
|
958 |
PrintF(out, "foreign address : %p", foreign_address());
|
959 |
} |
960 |
|
961 |
|
962 |
void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(FILE* out) {
|
963 |
HeapObject::PrintHeader(out, "ExecutableAccessorInfo");
|
964 |
PrintF(out, "\n - name: ");
|
965 |
name()->ShortPrint(out); |
966 |
PrintF(out, "\n - flag: ");
|
967 |
flag()->ShortPrint(out); |
968 |
PrintF(out, "\n - getter: ");
|
969 |
getter()->ShortPrint(out); |
970 |
PrintF(out, "\n - setter: ");
|
971 |
setter()->ShortPrint(out); |
972 |
PrintF(out, "\n - data: ");
|
973 |
data()->ShortPrint(out); |
974 |
} |
975 |
|
976 |
|
977 |
void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(FILE* out) {
|
978 |
HeapObject::PrintHeader(out, "DeclaredAccessorInfo");
|
979 |
PrintF(out, "\n - name: ");
|
980 |
name()->ShortPrint(out); |
981 |
PrintF(out, "\n - flag: ");
|
982 |
flag()->ShortPrint(out); |
983 |
PrintF(out, "\n - descriptor: ");
|
984 |
descriptor()->ShortPrint(out); |
985 |
} |
986 |
|
987 |
|
988 |
void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(FILE* out) {
|
989 |
HeapObject::PrintHeader(out, "DeclaredAccessorDescriptor");
|
990 |
PrintF(out, "\n - internal field: ");
|
991 |
serialized_data()->ShortPrint(out); |
992 |
} |
993 |
|
994 |
|
995 |
void Box::BoxPrint(FILE* out) {
|
996 |
HeapObject::PrintHeader(out, "Box");
|
997 |
PrintF(out, "\n - value: ");
|
998 |
value()->ShortPrint(out); |
999 |
} |
1000 |
|
1001 |
|
1002 |
void AccessorPair::AccessorPairPrint(FILE* out) {
|
1003 |
HeapObject::PrintHeader(out, "AccessorPair");
|
1004 |
PrintF(out, "\n - getter: ");
|
1005 |
getter()->ShortPrint(out); |
1006 |
PrintF(out, "\n - setter: ");
|
1007 |
setter()->ShortPrint(out); |
1008 |
PrintF(out, "\n - flag: ");
|
1009 |
access_flags()->ShortPrint(out); |
1010 |
} |
1011 |
|
1012 |
|
1013 |
void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) {
|
1014 |
HeapObject::PrintHeader(out, "AccessCheckInfo");
|
1015 |
PrintF(out, "\n - named_callback: ");
|
1016 |
named_callback()->ShortPrint(out); |
1017 |
PrintF(out, "\n - indexed_callback: ");
|
1018 |
indexed_callback()->ShortPrint(out); |
1019 |
PrintF(out, "\n - data: ");
|
1020 |
data()->ShortPrint(out); |
1021 |
} |
1022 |
|
1023 |
|
1024 |
void InterceptorInfo::InterceptorInfoPrint(FILE* out) {
|
1025 |
HeapObject::PrintHeader(out, "InterceptorInfo");
|
1026 |
PrintF(out, "\n - getter: ");
|
1027 |
getter()->ShortPrint(out); |
1028 |
PrintF(out, "\n - setter: ");
|
1029 |
setter()->ShortPrint(out); |
1030 |
PrintF(out, "\n - query: ");
|
1031 |
query()->ShortPrint(out); |
1032 |
PrintF(out, "\n - deleter: ");
|
1033 |
deleter()->ShortPrint(out); |
1034 |
PrintF(out, "\n - enumerator: ");
|
1035 |
enumerator()->ShortPrint(out); |
1036 |
PrintF(out, "\n - data: ");
|
1037 |
data()->ShortPrint(out); |
1038 |
} |
1039 |
|
1040 |
|
1041 |
void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) {
|
1042 |
HeapObject::PrintHeader(out, "CallHandlerInfo");
|
1043 |
PrintF(out, "\n - callback: ");
|
1044 |
callback()->ShortPrint(out); |
1045 |
PrintF(out, "\n - data: ");
|
1046 |
data()->ShortPrint(out); |
1047 |
PrintF(out, "\n - call_stub_cache: ");
|
1048 |
} |
1049 |
|
1050 |
|
1051 |
void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) {
|
1052 |
HeapObject::PrintHeader(out, "FunctionTemplateInfo");
|
1053 |
PrintF(out, "\n - class name: ");
|
1054 |
class_name()->ShortPrint(out); |
1055 |
PrintF(out, "\n - tag: ");
|
1056 |
tag()->ShortPrint(out); |
1057 |
PrintF(out, "\n - property_list: ");
|
1058 |
property_list()->ShortPrint(out); |
1059 |
PrintF(out, "\n - serial_number: ");
|
1060 |
serial_number()->ShortPrint(out); |
1061 |
PrintF(out, "\n - call_code: ");
|
1062 |
call_code()->ShortPrint(out); |
1063 |
PrintF(out, "\n - property_accessors: ");
|
1064 |
property_accessors()->ShortPrint(out); |
1065 |
PrintF(out, "\n - prototype_template: ");
|
1066 |
prototype_template()->ShortPrint(out); |
1067 |
PrintF(out, "\n - parent_template: ");
|
1068 |
parent_template()->ShortPrint(out); |
1069 |
PrintF(out, "\n - named_property_handler: ");
|
1070 |
named_property_handler()->ShortPrint(out); |
1071 |
PrintF(out, "\n - indexed_property_handler: ");
|
1072 |
indexed_property_handler()->ShortPrint(out); |
1073 |
PrintF(out, "\n - instance_template: ");
|
1074 |
instance_template()->ShortPrint(out); |
1075 |
PrintF(out, "\n - signature: ");
|
1076 |
signature()->ShortPrint(out); |
1077 |
PrintF(out, "\n - access_check_info: ");
|
1078 |
access_check_info()->ShortPrint(out); |
1079 |
PrintF(out, "\n - hidden_prototype: %s",
|
1080 |
hidden_prototype() ? "true" : "false"); |
1081 |
PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false"); |
1082 |
PrintF(out, "\n - need_access_check: %s",
|
1083 |
needs_access_check() ? "true" : "false"); |
1084 |
} |
1085 |
|
1086 |
|
1087 |
void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) {
|
1088 |
HeapObject::PrintHeader(out, "ObjectTemplateInfo");
|
1089 |
PrintF(out, " - tag: ");
|
1090 |
tag()->ShortPrint(out); |
1091 |
PrintF(out, "\n - property_list: ");
|
1092 |
property_list()->ShortPrint(out); |
1093 |
PrintF(out, "\n - property_accessors: ");
|
1094 |
property_accessors()->ShortPrint(out); |
1095 |
PrintF(out, "\n - constructor: ");
|
1096 |
constructor()->ShortPrint(out); |
1097 |
PrintF(out, "\n - internal_field_count: ");
|
1098 |
internal_field_count()->ShortPrint(out); |
1099 |
PrintF(out, "\n");
|
1100 |
} |
1101 |
|
1102 |
|
1103 |
void SignatureInfo::SignatureInfoPrint(FILE* out) {
|
1104 |
HeapObject::PrintHeader(out, "SignatureInfo");
|
1105 |
PrintF(out, "\n - receiver: ");
|
1106 |
receiver()->ShortPrint(out); |
1107 |
PrintF(out, "\n - args: ");
|
1108 |
args()->ShortPrint(out); |
1109 |
} |
1110 |
|
1111 |
|
1112 |
void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) {
|
1113 |
HeapObject::PrintHeader(out, "TypeSwitchInfo");
|
1114 |
PrintF(out, "\n - types: ");
|
1115 |
types()->ShortPrint(out); |
1116 |
} |
1117 |
|
1118 |
|
1119 |
void AllocationSite::AllocationSitePrint(FILE* out) {
|
1120 |
HeapObject::PrintHeader(out, "AllocationSite");
|
1121 |
PrintF(out, " - weak_next: ");
|
1122 |
weak_next()->ShortPrint(out); |
1123 |
PrintF(out, "\n - dependent code: ");
|
1124 |
dependent_code()->ShortPrint(out); |
1125 |
PrintF(out, "\n - nested site: ");
|
1126 |
nested_site()->ShortPrint(out); |
1127 |
PrintF(out, "\n - transition_info: ");
|
1128 |
if (transition_info()->IsCell()) {
|
1129 |
Cell* cell = Cell::cast(transition_info()); |
1130 |
Object* cell_contents = cell->value(); |
1131 |
if (cell_contents->IsSmi()) {
|
1132 |
ElementsKind kind = static_cast<ElementsKind>(
|
1133 |
Smi::cast(cell_contents)->value()); |
1134 |
PrintF(out, "Array allocation with ElementsKind ");
|
1135 |
PrintElementsKind(out, kind); |
1136 |
PrintF(out, "\n");
|
1137 |
return;
|
1138 |
} |
1139 |
} else if (transition_info()->IsJSArray()) { |
1140 |
PrintF(out, "Array literal ");
|
1141 |
transition_info()->ShortPrint(out); |
1142 |
PrintF(out, "\n");
|
1143 |
return;
|
1144 |
} |
1145 |
|
1146 |
PrintF(out, "unknown transition_info");
|
1147 |
transition_info()->ShortPrint(out); |
1148 |
PrintF(out, "\n");
|
1149 |
} |
1150 |
|
1151 |
|
1152 |
void AllocationMemento::AllocationMementoPrint(FILE* out) {
|
1153 |
HeapObject::PrintHeader(out, "AllocationMemento");
|
1154 |
PrintF(out, " - allocation site: ");
|
1155 |
if (IsValid()) {
|
1156 |
GetAllocationSite()->Print(); |
1157 |
} else {
|
1158 |
PrintF(out, "<invalid>\n");
|
1159 |
} |
1160 |
} |
1161 |
|
1162 |
|
1163 |
void Script::ScriptPrint(FILE* out) {
|
1164 |
HeapObject::PrintHeader(out, "Script");
|
1165 |
PrintF(out, "\n - source: ");
|
1166 |
source()->ShortPrint(out); |
1167 |
PrintF(out, "\n - name: ");
|
1168 |
name()->ShortPrint(out); |
1169 |
PrintF(out, "\n - line_offset: ");
|
1170 |
line_offset()->ShortPrint(out); |
1171 |
PrintF(out, "\n - column_offset: ");
|
1172 |
column_offset()->ShortPrint(out); |
1173 |
PrintF(out, "\n - type: ");
|
1174 |
type()->ShortPrint(out); |
1175 |
PrintF(out, "\n - id: ");
|
1176 |
id()->ShortPrint(out); |
1177 |
PrintF(out, "\n - data: ");
|
1178 |
data()->ShortPrint(out); |
1179 |
PrintF(out, "\n - context data: ");
|
1180 |
context_data()->ShortPrint(out); |
1181 |
PrintF(out, "\n - wrapper: ");
|
1182 |
wrapper()->ShortPrint(out); |
1183 |
PrintF(out, "\n - compilation type: %d", compilation_type());
|
1184 |
PrintF(out, "\n - line ends: ");
|
1185 |
line_ends()->ShortPrint(out); |
1186 |
PrintF(out, "\n - eval from shared: ");
|
1187 |
eval_from_shared()->ShortPrint(out); |
1188 |
PrintF(out, "\n - eval from instructions offset: ");
|
1189 |
eval_from_instructions_offset()->ShortPrint(out); |
1190 |
PrintF(out, "\n");
|
1191 |
} |
1192 |
|
1193 |
|
1194 |
#ifdef ENABLE_DEBUGGER_SUPPORT
|
1195 |
void DebugInfo::DebugInfoPrint(FILE* out) {
|
1196 |
HeapObject::PrintHeader(out, "DebugInfo");
|
1197 |
PrintF(out, "\n - shared: ");
|
1198 |
shared()->ShortPrint(out); |
1199 |
PrintF(out, "\n - original_code: ");
|
1200 |
original_code()->ShortPrint(out); |
1201 |
PrintF(out, "\n - code: ");
|
1202 |
code()->ShortPrint(out); |
1203 |
PrintF(out, "\n - break_points: ");
|
1204 |
break_points()->Print(out); |
1205 |
} |
1206 |
|
1207 |
|
1208 |
void BreakPointInfo::BreakPointInfoPrint(FILE* out) {
|
1209 |
HeapObject::PrintHeader(out, "BreakPointInfo");
|
1210 |
PrintF(out, "\n - code_position: %d", code_position()->value());
|
1211 |
PrintF(out, "\n - source_position: %d", source_position()->value());
|
1212 |
PrintF(out, "\n - statement_position: %d", statement_position()->value());
|
1213 |
PrintF(out, "\n - break_point_objects: ");
|
1214 |
break_point_objects()->ShortPrint(out); |
1215 |
} |
1216 |
#endif // ENABLE_DEBUGGER_SUPPORT |
1217 |
|
1218 |
|
1219 |
void DescriptorArray::PrintDescriptors(FILE* out) {
|
1220 |
PrintF(out, "Descriptor array %d\n", number_of_descriptors());
|
1221 |
for (int i = 0; i < number_of_descriptors(); i++) { |
1222 |
PrintF(out, " %d: ", i);
|
1223 |
Descriptor desc; |
1224 |
Get(i, &desc); |
1225 |
desc.Print(out); |
1226 |
} |
1227 |
PrintF(out, "\n");
|
1228 |
} |
1229 |
|
1230 |
|
1231 |
void TransitionArray::PrintTransitions(FILE* out) {
|
1232 |
PrintF(out, "Transition array %d\n", number_of_transitions());
|
1233 |
for (int i = 0; i < number_of_transitions(); i++) { |
1234 |
PrintF(out, " %d: ", i);
|
1235 |
GetKey(i)->NamePrint(out); |
1236 |
PrintF(out, ": ");
|
1237 |
switch (GetTargetDetails(i).type()) {
|
1238 |
case FIELD: {
|
1239 |
PrintF(out, " (transition to field)\n");
|
1240 |
break;
|
1241 |
} |
1242 |
case CONSTANT:
|
1243 |
PrintF(out, " (transition to constant)\n");
|
1244 |
break;
|
1245 |
case CALLBACKS:
|
1246 |
PrintF(out, " (transition to callback)\n");
|
1247 |
break;
|
1248 |
// Values below are never in the target descriptor array.
|
1249 |
case NORMAL:
|
1250 |
case HANDLER:
|
1251 |
case INTERCEPTOR:
|
1252 |
case TRANSITION:
|
1253 |
case NONEXISTENT:
|
1254 |
UNREACHABLE(); |
1255 |
break;
|
1256 |
} |
1257 |
} |
1258 |
PrintF(out, "\n");
|
1259 |
} |
1260 |
|
1261 |
|
1262 |
#endif // OBJECT_PRINT |
1263 |
|
1264 |
|
1265 |
} } // namespace v8::internal
|