v8  3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
objects-printer.cc
Go to the documentation of this file.
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 static const char* TypeToString(InstanceType type);
41 
42 
43 void MaybeObject::Print(FILE* out) {
44  Object* this_as_object;
45  if (ToObject(&this_as_object)) {
46  if (this_as_object->IsSmi()) {
47  Smi::cast(this_as_object)->SmiPrint(out);
48  } else {
49  HeapObject::cast(this_as_object)->HeapObjectPrint(out);
50  }
51  } else {
52  Failure::cast(this)->FailurePrint(out);
53  }
54  Flush(out);
55 }
56 
57 
58 void MaybeObject::PrintLn(FILE* out) {
59  Print(out);
60  PrintF(out, "\n");
61 }
62 
63 
64 void HeapObject::PrintHeader(FILE* out, const char* id) {
65  PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id);
66 }
67 
68 
69 void HeapObject::HeapObjectPrint(FILE* out) {
70  InstanceType instance_type = map()->instance_type();
71 
72  HandleScope scope;
73  if (instance_type < FIRST_NONSTRING_TYPE) {
74  String::cast(this)->StringPrint(out);
75  return;
76  }
77 
78  switch (instance_type) {
79  case MAP_TYPE:
80  Map::cast(this)->MapPrint(out);
81  break;
82  case HEAP_NUMBER_TYPE:
84  break;
86  FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(out);
87  break;
88  case FIXED_ARRAY_TYPE:
89  FixedArray::cast(this)->FixedArrayPrint(out);
90  break;
91  case BYTE_ARRAY_TYPE:
92  ByteArray::cast(this)->ByteArrayPrint(out);
93  break;
94  case FREE_SPACE_TYPE:
95  FreeSpace::cast(this)->FreeSpacePrint(out);
96  break;
98  ExternalPixelArray::cast(this)->ExternalPixelArrayPrint(out);
99  break;
101  ExternalByteArray::cast(this)->ExternalByteArrayPrint(out);
102  break;
105  ->ExternalUnsignedByteArrayPrint(out);
106  break;
108  ExternalShortArray::cast(this)->ExternalShortArrayPrint(out);
109  break;
112  ->ExternalUnsignedShortArrayPrint(out);
113  break;
115  ExternalIntArray::cast(this)->ExternalIntArrayPrint(out);
116  break;
118  ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out);
119  break;
121  ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out);
122  break;
124  ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out);
125  break;
126  case FILLER_TYPE:
127  PrintF(out, "filler");
128  break;
129  case JS_OBJECT_TYPE: // fall through
131  case JS_ARRAY_TYPE:
132  case JS_REGEXP_TYPE:
133  JSObject::cast(this)->JSObjectPrint(out);
134  break;
135  case ODDBALL_TYPE:
136  Oddball::cast(this)->to_string()->Print(out);
137  break;
138  case JS_MODULE_TYPE:
139  JSModule::cast(this)->JSModulePrint(out);
140  break;
141  case JS_FUNCTION_TYPE:
142  JSFunction::cast(this)->JSFunctionPrint(out);
143  break;
145  JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out);
146  break;
148  JSGlobalObject::cast(this)->JSGlobalObjectPrint(out);
149  break;
151  JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out);
152  break;
153  case JS_VALUE_TYPE:
154  PrintF(out, "Value wrapper around:");
155  JSValue::cast(this)->value()->Print(out);
156  break;
157  case JS_DATE_TYPE:
158  JSDate::cast(this)->JSDatePrint(out);
159  break;
160  case CODE_TYPE:
161  Code::cast(this)->CodePrint(out);
162  break;
163  case JS_PROXY_TYPE:
164  JSProxy::cast(this)->JSProxyPrint(out);
165  break;
167  JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out);
168  break;
169  case JS_WEAK_MAP_TYPE:
170  JSWeakMap::cast(this)->JSWeakMapPrint(out);
171  break;
172  case FOREIGN_TYPE:
173  Foreign::cast(this)->ForeignPrint(out);
174  break;
176  SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out);
177  break;
179  JSMessageObject::cast(this)->JSMessageObjectPrint(out);
180  break;
182  JSGlobalPropertyCell::cast(this)->JSGlobalPropertyCellPrint(out);
183  break;
184 #define MAKE_STRUCT_CASE(NAME, Name, name) \
185  case NAME##_TYPE: \
186  Name::cast(this)->Name##Print(out); \
187  break;
189 #undef MAKE_STRUCT_CASE
190 
191  default:
192  PrintF(out, "UNKNOWN TYPE %d", map()->instance_type());
193  UNREACHABLE();
194  break;
195  }
196 }
197 
198 
199 void ByteArray::ByteArrayPrint(FILE* out) {
200  PrintF(out, "byte array, data starts at %p", GetDataStartAddress());
201 }
202 
203 
204 void FreeSpace::FreeSpacePrint(FILE* out) {
205  PrintF(out, "free space, size %d", Size());
206 }
207 
208 
209 void ExternalPixelArray::ExternalPixelArrayPrint(FILE* out) {
210  PrintF(out, "external pixel array");
211 }
212 
213 
214 void ExternalByteArray::ExternalByteArrayPrint(FILE* out) {
215  PrintF(out, "external byte array");
216 }
217 
218 
219 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) {
220  PrintF(out, "external unsigned byte array");
221 }
222 
223 
224 void ExternalShortArray::ExternalShortArrayPrint(FILE* out) {
225  PrintF(out, "external short array");
226 }
227 
228 
229 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) {
230  PrintF(out, "external unsigned short array");
231 }
232 
233 
234 void ExternalIntArray::ExternalIntArrayPrint(FILE* out) {
235  PrintF(out, "external int array");
236 }
237 
238 
239 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) {
240  PrintF(out, "external unsigned int array");
241 }
242 
243 
244 void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) {
245  PrintF(out, "external float array");
246 }
247 
248 
249 void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) {
250  PrintF(out, "external double array");
251 }
252 
253 
254 void JSObject::PrintProperties(FILE* out) {
255  if (HasFastProperties()) {
256  DescriptorArray* descs = map()->instance_descriptors();
257  for (int i = 0; i < descs->number_of_descriptors(); i++) {
258  PrintF(out, " ");
259  descs->GetKey(i)->StringPrint(out);
260  PrintF(out, ": ");
261  switch (descs->GetType(i)) {
262  case FIELD: {
263  int index = descs->GetFieldIndex(i);
264  FastPropertyAt(index)->ShortPrint(out);
265  PrintF(out, " (field at offset %d)\n", index);
266  break;
267  }
268  case CONSTANT_FUNCTION:
269  descs->GetConstantFunction(i)->ShortPrint(out);
270  PrintF(out, " (constant function)\n");
271  break;
272  case CALLBACKS:
273  descs->GetCallbacksObject(i)->ShortPrint(out);
274  PrintF(out, " (callback)\n");
275  break;
276  case MAP_TRANSITION:
277  PrintF(out, "(map transition)\n");
278  break;
279  case CONSTANT_TRANSITION:
280  PrintF(out, "(constant transition)\n");
281  break;
282  case NULL_DESCRIPTOR:
283  PrintF(out, "(null descriptor)\n");
284  break;
285  case NORMAL: // only in slow mode
286  case HANDLER: // only in lookup results, not in descriptors
287  case INTERCEPTOR: // only in lookup results, not in descriptors
288  UNREACHABLE();
289  break;
290  }
291  }
292  } else {
293  property_dictionary()->Print(out);
294  }
295 }
296 
297 
298 void JSObject::PrintElements(FILE* out) {
299  // Don't call GetElementsKind, its validation code can cause the printer to
300  // fail when debugging.
301  switch (map()->elements_kind()) {
303  case FAST_SMI_ELEMENTS:
304  case FAST_HOLEY_ELEMENTS:
305  case FAST_ELEMENTS: {
306  // Print in array notation for non-sparse arrays.
307  FixedArray* p = FixedArray::cast(elements());
308  for (int i = 0; i < p->length(); i++) {
309  PrintF(out, " %d: ", i);
310  p->get(i)->ShortPrint(out);
311  PrintF(out, "\n");
312  }
313  break;
314  }
316  case FAST_DOUBLE_ELEMENTS: {
317  // Print in array notation for non-sparse arrays.
318  if (elements()->length() > 0) {
319  FixedDoubleArray* p = FixedDoubleArray::cast(elements());
320  for (int i = 0; i < p->length(); i++) {
321  if (p->is_the_hole(i)) {
322  PrintF(out, " %d: <the hole>", i);
323  } else {
324  PrintF(out, " %d: %g", i, p->get_scalar(i));
325  }
326  PrintF(out, "\n");
327  }
328  }
329  break;
330  }
332  ExternalPixelArray* p = ExternalPixelArray::cast(elements());
333  for (int i = 0; i < p->length(); i++) {
334  PrintF(out, " %d: %d\n", i, p->get_scalar(i));
335  }
336  break;
337  }
338  case EXTERNAL_BYTE_ELEMENTS: {
339  ExternalByteArray* p = ExternalByteArray::cast(elements());
340  for (int i = 0; i < p->length(); i++) {
341  PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
342  }
343  break;
344  }
346  ExternalUnsignedByteArray* p =
348  for (int i = 0; i < p->length(); i++) {
349  PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
350  }
351  break;
352  }
354  ExternalShortArray* p = ExternalShortArray::cast(elements());
355  for (int i = 0; i < p->length(); i++) {
356  PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
357  }
358  break;
359  }
361  ExternalUnsignedShortArray* p =
363  for (int i = 0; i < p->length(); i++) {
364  PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
365  }
366  break;
367  }
368  case EXTERNAL_INT_ELEMENTS: {
369  ExternalIntArray* p = ExternalIntArray::cast(elements());
370  for (int i = 0; i < p->length(); i++) {
371  PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
372  }
373  break;
374  }
376  ExternalUnsignedIntArray* p =
377  ExternalUnsignedIntArray::cast(elements());
378  for (int i = 0; i < p->length(); i++) {
379  PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
380  }
381  break;
382  }
384  ExternalFloatArray* p = ExternalFloatArray::cast(elements());
385  for (int i = 0; i < p->length(); i++) {
386  PrintF(out, " %d: %f\n", i, p->get_scalar(i));
387  }
388  break;
389  }
391  ExternalDoubleArray* p = ExternalDoubleArray::cast(elements());
392  for (int i = 0; i < p->length(); i++) {
393  PrintF(out, " %d: %f\n", i, p->get_scalar(i));
394  }
395  break;
396  }
397  case DICTIONARY_ELEMENTS:
398  elements()->Print(out);
399  break;
401  FixedArray* p = FixedArray::cast(elements());
402  for (int i = 2; i < p->length(); i++) {
403  PrintF(out, " %d: ", i);
404  p->get(i)->ShortPrint(out);
405  PrintF(out, "\n");
406  }
407  break;
408  }
409  }
410 }
411 
412 
413 void JSObject::JSObjectPrint(FILE* out) {
414  PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this));
415  PrintF(out, " - map = %p [", reinterpret_cast<void*>(map()));
416  // Don't call GetElementsKind, its validation code can cause the printer to
417  // fail when debugging.
418  PrintElementsKind(out, this->map()->elements_kind());
419  PrintF(out,
420  "]\n - prototype = %p\n",
421  reinterpret_cast<void*>(GetPrototype()));
422  PrintF(out,
423  " - elements transition to = %p\n",
424  reinterpret_cast<void*>(map()->elements_transition_map()));
425  PrintF(out, " {\n");
426  PrintProperties(out);
427  PrintElements(out);
428  PrintF(out, " }\n");
429 }
430 
431 
432 void JSModule::JSModulePrint(FILE* out) {
433  HeapObject::PrintHeader(out, "JSModule");
434  PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
435  PrintF(out, " - context = ");
436  context()->Print(out);
437  PrintElementsKind(out, this->map()->elements_kind());
438  PrintF(out, " {\n");
439  PrintProperties(out);
440  PrintElements(out);
441  PrintF(out, " }\n");
442 }
443 
444 
445 static const char* TypeToString(InstanceType type) {
446  switch (type) {
447  case INVALID_TYPE: return "INVALID";
448  case MAP_TYPE: return "MAP";
449  case HEAP_NUMBER_TYPE: return "HEAP_NUMBER";
450  case SYMBOL_TYPE: return "SYMBOL";
451  case ASCII_SYMBOL_TYPE: return "ASCII_SYMBOL";
452  case CONS_SYMBOL_TYPE: return "CONS_SYMBOL";
453  case CONS_ASCII_SYMBOL_TYPE: return "CONS_ASCII_SYMBOL";
456  case EXTERNAL_SYMBOL_TYPE: return "EXTERNAL_SYMBOL";
459  case SHORT_EXTERNAL_SYMBOL_TYPE: return "SHORT_EXTERNAL_SYMBOL";
460  case ASCII_STRING_TYPE: return "ASCII_STRING";
461  case STRING_TYPE: return "TWO_BYTE_STRING";
462  case CONS_STRING_TYPE:
463  case CONS_ASCII_STRING_TYPE: return "CONS_STRING";
466  case EXTERNAL_STRING_TYPE: return "EXTERNAL_STRING";
469  case SHORT_EXTERNAL_STRING_TYPE: return "SHORT_EXTERNAL_STRING";
470  case FIXED_ARRAY_TYPE: return "FIXED_ARRAY";
471  case BYTE_ARRAY_TYPE: return "BYTE_ARRAY";
472  case FREE_SPACE_TYPE: return "FREE_SPACE";
473  case EXTERNAL_PIXEL_ARRAY_TYPE: return "EXTERNAL_PIXEL_ARRAY";
474  case EXTERNAL_BYTE_ARRAY_TYPE: return "EXTERNAL_BYTE_ARRAY";
476  return "EXTERNAL_UNSIGNED_BYTE_ARRAY";
477  case EXTERNAL_SHORT_ARRAY_TYPE: return "EXTERNAL_SHORT_ARRAY";
479  return "EXTERNAL_UNSIGNED_SHORT_ARRAY";
480  case EXTERNAL_INT_ARRAY_TYPE: return "EXTERNAL_INT_ARRAY";
482  return "EXTERNAL_UNSIGNED_INT_ARRAY";
483  case EXTERNAL_FLOAT_ARRAY_TYPE: return "EXTERNAL_FLOAT_ARRAY";
484  case EXTERNAL_DOUBLE_ARRAY_TYPE: return "EXTERNAL_DOUBLE_ARRAY";
485  case FILLER_TYPE: return "FILLER";
486  case JS_OBJECT_TYPE: return "JS_OBJECT";
487  case JS_CONTEXT_EXTENSION_OBJECT_TYPE: return "JS_CONTEXT_EXTENSION_OBJECT";
488  case ODDBALL_TYPE: return "ODDBALL";
489  case JS_GLOBAL_PROPERTY_CELL_TYPE: return "JS_GLOBAL_PROPERTY_CELL";
490  case SHARED_FUNCTION_INFO_TYPE: return "SHARED_FUNCTION_INFO";
491  case JS_MODULE_TYPE: return "JS_MODULE";
492  case JS_FUNCTION_TYPE: return "JS_FUNCTION";
493  case CODE_TYPE: return "CODE";
494  case JS_ARRAY_TYPE: return "JS_ARRAY";
495  case JS_PROXY_TYPE: return "JS_PROXY";
496  case JS_WEAK_MAP_TYPE: return "JS_WEAK_MAP";
497  case JS_REGEXP_TYPE: return "JS_REGEXP";
498  case JS_VALUE_TYPE: return "JS_VALUE";
499  case JS_GLOBAL_OBJECT_TYPE: return "JS_GLOBAL_OBJECT";
500  case JS_BUILTINS_OBJECT_TYPE: return "JS_BUILTINS_OBJECT";
501  case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY";
502  case FOREIGN_TYPE: return "FOREIGN";
503  case JS_MESSAGE_OBJECT_TYPE: return "JS_MESSAGE_OBJECT_TYPE";
504 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME;
506 #undef MAKE_STRUCT_CASE
507  default: return "UNKNOWN";
508  }
509 }
510 
511 
512 void Map::MapPrint(FILE* out) {
513  HeapObject::PrintHeader(out, "Map");
514  PrintF(out, " - type: %s\n", TypeToString(instance_type()));
515  PrintF(out, " - instance size: %d\n", instance_size());
516  PrintF(out, " - inobject properties: %d\n", inobject_properties());
517  PrintF(out, " - elements kind: ");
519  PrintF(out, "\n - pre-allocated property fields: %d\n",
521  PrintF(out, " - unused property fields: %d\n", unused_property_fields());
522  if (is_hidden_prototype()) {
523  PrintF(out, " - hidden_prototype\n");
524  }
525  if (has_named_interceptor()) {
526  PrintF(out, " - named_interceptor\n");
527  }
528  if (has_indexed_interceptor()) {
529  PrintF(out, " - indexed_interceptor\n");
530  }
531  if (is_undetectable()) {
532  PrintF(out, " - undetectable\n");
533  }
535  PrintF(out, " - instance_call_handler\n");
536  }
537  if (is_access_check_needed()) {
538  PrintF(out, " - access_check_needed\n");
539  }
540  PrintF(out, " - instance descriptors: ");
541  instance_descriptors()->ShortPrint(out);
542  PrintF(out, "\n - prototype: ");
543  prototype()->ShortPrint(out);
544  PrintF(out, "\n - constructor: ");
545  constructor()->ShortPrint(out);
546  PrintF(out, "\n - code cache: ");
547  code_cache()->ShortPrint(out);
548  PrintF(out, "\n");
549 }
550 
551 
552 void CodeCache::CodeCachePrint(FILE* out) {
553  HeapObject::PrintHeader(out, "CodeCache");
554  PrintF(out, "\n - default_cache: ");
555  default_cache()->ShortPrint(out);
556  PrintF(out, "\n - normal_type_cache: ");
557  normal_type_cache()->ShortPrint(out);
558 }
559 
560 
561 void PolymorphicCodeCache::PolymorphicCodeCachePrint(FILE* out) {
562  HeapObject::PrintHeader(out, "PolymorphicCodeCache");
563  PrintF(out, "\n - cache: ");
564  cache()->ShortPrint(out);
565 }
566 
567 
568 void TypeFeedbackInfo::TypeFeedbackInfoPrint(FILE* out) {
569  HeapObject::PrintHeader(out, "TypeFeedbackInfo");
570  PrintF(out, "\n - ic_total_count: %d, ic_with_type_info_count: %d",
572  PrintF(out, "\n - type_feedback_cells: ");
573  type_feedback_cells()->FixedArrayPrint(out);
574 }
575 
576 
577 void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(FILE* out) {
578  HeapObject::PrintHeader(out, "AliasedArgumentsEntry");
579  PrintF(out, "\n - aliased_context_slot: %d", aliased_context_slot());
580 }
581 
582 
583 void FixedArray::FixedArrayPrint(FILE* out) {
584  HeapObject::PrintHeader(out, "FixedArray");
585  PrintF(out, " - length: %d", length());
586  for (int i = 0; i < length(); i++) {
587  PrintF(out, "\n [%d]: ", i);
588  get(i)->ShortPrint(out);
589  }
590  PrintF(out, "\n");
591 }
592 
593 
594 void FixedDoubleArray::FixedDoubleArrayPrint(FILE* out) {
595  HeapObject::PrintHeader(out, "FixedDoubleArray");
596  PrintF(out, " - length: %d", length());
597  for (int i = 0; i < length(); i++) {
598  if (is_the_hole(i)) {
599  PrintF(out, "\n [%d]: <the hole>", i);
600  } else {
601  PrintF(out, "\n [%d]: %g", i, get_scalar(i));
602  }
603  }
604  PrintF(out, "\n");
605 }
606 
607 
608 void JSValue::JSValuePrint(FILE* out) {
609  HeapObject::PrintHeader(out, "ValueObject");
610  value()->Print(out);
611 }
612 
613 
614 void JSMessageObject::JSMessageObjectPrint(FILE* out) {
615  HeapObject::PrintHeader(out, "JSMessageObject");
616  PrintF(out, " - type: ");
617  type()->ShortPrint(out);
618  PrintF(out, "\n - arguments: ");
619  arguments()->ShortPrint(out);
620  PrintF(out, "\n - start_position: %d", start_position());
621  PrintF(out, "\n - end_position: %d", end_position());
622  PrintF(out, "\n - script: ");
623  script()->ShortPrint(out);
624  PrintF(out, "\n - stack_trace: ");
625  stack_trace()->ShortPrint(out);
626  PrintF(out, "\n - stack_frames: ");
627  stack_frames()->ShortPrint(out);
628  PrintF(out, "\n");
629 }
630 
631 
632 void String::StringPrint(FILE* out) {
633  if (StringShape(this).IsSymbol()) {
634  PrintF(out, "#");
635  } else if (StringShape(this).IsCons()) {
636  PrintF(out, "c\"");
637  } else {
638  PrintF(out, "\"");
639  }
640 
641  const char truncated_epilogue[] = "...<truncated>";
642  int len = length();
643  if (!FLAG_use_verbose_printer) {
644  if (len > 100) {
645  len = 100 - sizeof(truncated_epilogue);
646  }
647  }
648  for (int i = 0; i < len; i++) {
649  PrintF(out, "%c", Get(i));
650  }
651  if (len != length()) {
652  PrintF(out, "%s", truncated_epilogue);
653  }
654 
655  if (!StringShape(this).IsSymbol()) PrintF(out, "\"");
656 }
657 
658 
659 // This method is only meant to be called from gdb for debugging purposes.
660 // Since the string can also be in two-byte encoding, non-ASCII characters
661 // will be ignored in the output.
662 char* String::ToAsciiArray() {
663  // Static so that subsequent calls frees previously allocated space.
664  // This also means that previous results will be overwritten.
665  static char* buffer = NULL;
666  if (buffer != NULL) free(buffer);
667  buffer = new char[length()+1];
668  WriteToFlat(this, buffer, 0, length());
669  buffer[length()] = 0;
670  return buffer;
671 }
672 
673 
674 static const char* const weekdays[] = {
675  "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
676 };
677 
678 void JSDate::JSDatePrint(FILE* out) {
679  HeapObject::PrintHeader(out, "JSDate");
680  PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
681  PrintF(out, " - value = ");
682  value()->Print(out);
683  if (!year()->IsSmi()) {
684  PrintF(out, " - time = NaN\n");
685  } else {
686  PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
687  weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
688  year()->IsSmi() ? Smi::cast(year())->value() : -1,
689  month()->IsSmi() ? Smi::cast(month())->value() : -1,
690  day()->IsSmi() ? Smi::cast(day())->value() : -1,
691  hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
692  min()->IsSmi() ? Smi::cast(min())->value() : -1,
693  sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
694  }
695 }
696 
697 
698 void JSProxy::JSProxyPrint(FILE* out) {
699  HeapObject::PrintHeader(out, "JSProxy");
700  PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
701  PrintF(out, " - handler = ");
702  handler()->Print(out);
703  PrintF(out, " - hash = ");
704  hash()->Print(out);
705  PrintF(out, "\n");
706 }
707 
708 
709 void JSFunctionProxy::JSFunctionProxyPrint(FILE* out) {
710  HeapObject::PrintHeader(out, "JSFunctionProxy");
711  PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
712  PrintF(out, " - handler = ");
713  handler()->Print(out);
714  PrintF(out, " - call_trap = ");
715  call_trap()->Print(out);
716  PrintF(out, " - construct_trap = ");
717  construct_trap()->Print(out);
718  PrintF(out, "\n");
719 }
720 
721 
722 void JSWeakMap::JSWeakMapPrint(FILE* out) {
723  HeapObject::PrintHeader(out, "JSWeakMap");
724  PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
725  PrintF(out, " - table = ");
726  table()->ShortPrint(out);
727  PrintF(out, "\n");
728 }
729 
730 
731 void JSFunction::JSFunctionPrint(FILE* out) {
732  HeapObject::PrintHeader(out, "Function");
733  PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
734  PrintF(out, " - initial_map = ");
735  if (has_initial_map()) {
736  initial_map()->ShortPrint(out);
737  }
738  PrintF(out, "\n - shared_info = ");
739  shared()->ShortPrint(out);
740  PrintF(out, "\n - name = ");
741  shared()->name()->Print(out);
742  PrintF(out, "\n - context = ");
744  PrintF(out, "\n - code = ");
745  code()->ShortPrint(out);
746  PrintF(out, "\n");
747 
748  PrintProperties(out);
749  PrintElements(out);
750 
751  PrintF(out, "\n");
752 }
753 
754 
755 void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) {
756  HeapObject::PrintHeader(out, "SharedFunctionInfo");
757  PrintF(out, " - name: ");
758  name()->ShortPrint(out);
759  PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties());
760  PrintF(out, "\n - instance class name = ");
761  instance_class_name()->Print(out);
762  PrintF(out, "\n - code = ");
763  code()->ShortPrint(out);
764  PrintF(out, "\n - source code = ");
765  GetSourceCode()->ShortPrint(out);
766  // Script files are often large, hard to read.
767  // PrintF(out, "\n - script =");
768  // script()->Print(out);
769  PrintF(out, "\n - function token position = %d", function_token_position());
770  PrintF(out, "\n - start position = %d", start_position());
771  PrintF(out, "\n - end position = %d", end_position());
772  PrintF(out, "\n - is expression = %d", is_expression());
773  PrintF(out, "\n - debug info = ");
774  debug_info()->ShortPrint(out);
775  PrintF(out, "\n - length = %d", length());
776  PrintF(out, "\n - has_only_simple_this_property_assignments = %d",
778  PrintF(out, "\n - this_property_assignments = ");
779  this_property_assignments()->ShortPrint(out);
780  PrintF(out, "\n");
781 }
782 
783 
784 void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) {
785  PrintF(out, "global_proxy");
786  JSObjectPrint(out);
787  PrintF(out, "context : ");
788  context()->ShortPrint(out);
789  PrintF(out, "\n");
790 }
791 
792 
793 void JSGlobalObject::JSGlobalObjectPrint(FILE* out) {
794  PrintF(out, "global ");
795  JSObjectPrint(out);
796  PrintF(out, "global context : ");
797  global_context()->ShortPrint(out);
798  PrintF(out, "\n");
799 }
800 
801 
802 void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) {
803  PrintF(out, "builtins ");
804  JSObjectPrint(out);
805 }
806 
807 
808 void JSGlobalPropertyCell::JSGlobalPropertyCellPrint(FILE* out) {
809  HeapObject::PrintHeader(out, "JSGlobalPropertyCell");
810 }
811 
812 
813 void Code::CodePrint(FILE* out) {
814  HeapObject::PrintHeader(out, "Code");
815 #ifdef ENABLE_DISASSEMBLER
816  if (FLAG_use_verbose_printer) {
817  Disassemble(NULL, out);
818  }
819 #endif
820 }
821 
822 
823 void Foreign::ForeignPrint(FILE* out) {
824  PrintF(out, "foreign address : %p", foreign_address());
825 }
826 
827 
828 void AccessorInfo::AccessorInfoPrint(FILE* out) {
829  HeapObject::PrintHeader(out, "AccessorInfo");
830  PrintF(out, "\n - getter: ");
831  getter()->ShortPrint(out);
832  PrintF(out, "\n - setter: ");
833  setter()->ShortPrint(out);
834  PrintF(out, "\n - name: ");
835  name()->ShortPrint(out);
836  PrintF(out, "\n - data: ");
837  data()->ShortPrint(out);
838  PrintF(out, "\n - flag: ");
839  flag()->ShortPrint(out);
840 }
841 
842 
843 void AccessorPair::AccessorPairPrint(FILE* out) {
844  HeapObject::PrintHeader(out, "AccessorPair");
845  PrintF(out, "\n - getter: ");
846  getter()->ShortPrint(out);
847  PrintF(out, "\n - setter: ");
848  setter()->ShortPrint(out);
849 }
850 
851 
852 void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) {
853  HeapObject::PrintHeader(out, "AccessCheckInfo");
854  PrintF(out, "\n - named_callback: ");
855  named_callback()->ShortPrint(out);
856  PrintF(out, "\n - indexed_callback: ");
857  indexed_callback()->ShortPrint(out);
858  PrintF(out, "\n - data: ");
859  data()->ShortPrint(out);
860 }
861 
862 
863 void InterceptorInfo::InterceptorInfoPrint(FILE* out) {
864  HeapObject::PrintHeader(out, "InterceptorInfo");
865  PrintF(out, "\n - getter: ");
866  getter()->ShortPrint(out);
867  PrintF(out, "\n - setter: ");
868  setter()->ShortPrint(out);
869  PrintF(out, "\n - query: ");
870  query()->ShortPrint(out);
871  PrintF(out, "\n - deleter: ");
872  deleter()->ShortPrint(out);
873  PrintF(out, "\n - enumerator: ");
874  enumerator()->ShortPrint(out);
875  PrintF(out, "\n - data: ");
876  data()->ShortPrint(out);
877 }
878 
879 
880 void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) {
881  HeapObject::PrintHeader(out, "CallHandlerInfo");
882  PrintF(out, "\n - callback: ");
883  callback()->ShortPrint(out);
884  PrintF(out, "\n - data: ");
885  data()->ShortPrint(out);
886  PrintF(out, "\n - call_stub_cache: ");
887 }
888 
889 
890 void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) {
891  HeapObject::PrintHeader(out, "FunctionTemplateInfo");
892  PrintF(out, "\n - class name: ");
893  class_name()->ShortPrint(out);
894  PrintF(out, "\n - tag: ");
895  tag()->ShortPrint(out);
896  PrintF(out, "\n - property_list: ");
897  property_list()->ShortPrint(out);
898  PrintF(out, "\n - serial_number: ");
899  serial_number()->ShortPrint(out);
900  PrintF(out, "\n - call_code: ");
901  call_code()->ShortPrint(out);
902  PrintF(out, "\n - property_accessors: ");
903  property_accessors()->ShortPrint(out);
904  PrintF(out, "\n - prototype_template: ");
905  prototype_template()->ShortPrint(out);
906  PrintF(out, "\n - parent_template: ");
907  parent_template()->ShortPrint(out);
908  PrintF(out, "\n - named_property_handler: ");
909  named_property_handler()->ShortPrint(out);
910  PrintF(out, "\n - indexed_property_handler: ");
911  indexed_property_handler()->ShortPrint(out);
912  PrintF(out, "\n - instance_template: ");
913  instance_template()->ShortPrint(out);
914  PrintF(out, "\n - signature: ");
915  signature()->ShortPrint(out);
916  PrintF(out, "\n - access_check_info: ");
917  access_check_info()->ShortPrint(out);
918  PrintF(out, "\n - hidden_prototype: %s",
919  hidden_prototype() ? "true" : "false");
920  PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false");
921  PrintF(out, "\n - need_access_check: %s",
922  needs_access_check() ? "true" : "false");
923 }
924 
925 
926 void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) {
927  HeapObject::PrintHeader(out, "ObjectTemplateInfo");
928  PrintF(out, " - tag: ");
929  tag()->ShortPrint(out);
930  PrintF(out, "\n - property_list: ");
931  property_list()->ShortPrint(out);
932  PrintF(out, "\n - constructor: ");
933  constructor()->ShortPrint(out);
934  PrintF(out, "\n - internal_field_count: ");
935  internal_field_count()->ShortPrint(out);
936  PrintF(out, "\n");
937 }
938 
939 
940 void SignatureInfo::SignatureInfoPrint(FILE* out) {
941  HeapObject::PrintHeader(out, "SignatureInfo");
942  PrintF(out, "\n - receiver: ");
943  receiver()->ShortPrint(out);
944  PrintF(out, "\n - args: ");
945  args()->ShortPrint(out);
946 }
947 
948 
949 void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) {
950  HeapObject::PrintHeader(out, "TypeSwitchInfo");
951  PrintF(out, "\n - types: ");
952  types()->ShortPrint(out);
953 }
954 
955 
956 void Script::ScriptPrint(FILE* out) {
957  HeapObject::PrintHeader(out, "Script");
958  PrintF(out, "\n - source: ");
959  source()->ShortPrint(out);
960  PrintF(out, "\n - name: ");
961  name()->ShortPrint(out);
962  PrintF(out, "\n - line_offset: ");
963  line_offset()->ShortPrint(out);
964  PrintF(out, "\n - column_offset: ");
965  column_offset()->ShortPrint(out);
966  PrintF(out, "\n - type: ");
967  type()->ShortPrint(out);
968  PrintF(out, "\n - id: ");
969  id()->ShortPrint(out);
970  PrintF(out, "\n - data: ");
971  data()->ShortPrint(out);
972  PrintF(out, "\n - context data: ");
973  context_data()->ShortPrint(out);
974  PrintF(out, "\n - wrapper: ");
975  wrapper()->ShortPrint(out);
976  PrintF(out, "\n - compilation type: ");
977  compilation_type()->ShortPrint(out);
978  PrintF(out, "\n - line ends: ");
979  line_ends()->ShortPrint(out);
980  PrintF(out, "\n - eval from shared: ");
981  eval_from_shared()->ShortPrint(out);
982  PrintF(out, "\n - eval from instructions offset: ");
983  eval_from_instructions_offset()->ShortPrint(out);
984  PrintF(out, "\n");
985 }
986 
987 
988 #ifdef ENABLE_DEBUGGER_SUPPORT
989 void DebugInfo::DebugInfoPrint(FILE* out) {
990  HeapObject::PrintHeader(out, "DebugInfo");
991  PrintF(out, "\n - shared: ");
992  shared()->ShortPrint(out);
993  PrintF(out, "\n - original_code: ");
994  original_code()->ShortPrint(out);
995  PrintF(out, "\n - code: ");
996  code()->ShortPrint(out);
997  PrintF(out, "\n - break_points: ");
998  break_points()->Print(out);
999 }
1000 
1001 
1002 void BreakPointInfo::BreakPointInfoPrint(FILE* out) {
1003  HeapObject::PrintHeader(out, "BreakPointInfo");
1004  PrintF(out, "\n - code_position: %d", code_position()->value());
1005  PrintF(out, "\n - source_position: %d", source_position()->value());
1006  PrintF(out, "\n - statement_position: %d", statement_position()->value());
1007  PrintF(out, "\n - break_point_objects: ");
1008  break_point_objects()->ShortPrint(out);
1009 }
1010 #endif // ENABLE_DEBUGGER_SUPPORT
1011 
1012 
1013 void DescriptorArray::PrintDescriptors(FILE* out) {
1014  PrintF(out, "Descriptor array %d\n", number_of_descriptors());
1015  for (int i = 0; i < number_of_descriptors(); i++) {
1016  PrintF(out, " %d: ", i);
1017  Descriptor desc;
1018  Get(i, &desc);
1019  desc.Print(out);
1020  }
1021  PrintF(out, "\n");
1022 }
1023 
1024 
1025 #endif // OBJECT_PRINT
1026 
1027 
1028 } } // namespace v8::internal
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset eval_from_instructions_offset
Definition: objects-inl.h:3650
bool is_hidden_prototype()
Definition: objects.h:4629
void PrintF(const char *format,...)
Definition: v8utils.cc:40
static String * cast(Object *obj)
int unused_property_fields()
Definition: objects-inl.h:2874
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Definition: flags.cc:1349
static HeapObject * cast(Object *obj)
bool is_access_check_needed()
Definition: objects-inl.h:2941
static JSBuiltinsObject * cast(Object *obj)
void Get(int descriptor_number, Descriptor *desc)
Definition: objects-inl.h:2072
static Map * cast(Object *obj)
static ByteArray * cast(Object *obj)
static FreeSpace * cast(Object *obj)
static Foreign * cast(Object *obj)
v8::Handle< v8::Value > Print(const v8::Arguments &args)
static ExternalUnsignedShortArray * cast(Object *obj)
kPropertyAccessorsOffset kNamedPropertyHandlerOffset instance_template
Definition: objects-inl.h:3618
static SharedFunctionInfo * cast(Object *obj)
static Code * cast(Object *obj)
static Smi * cast(Object *object)
static ExternalShortArray * cast(Object *obj)
bool has_instance_call_handler()
Definition: objects.h:4670
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset this_property_assignments
Definition: objects-inl.h:3674
static JSFunctionProxy * cast(Object *obj)
#define UNREACHABLE()
Definition: checks.h:50
static JSGlobalProxy * cast(Object *obj)
static ExternalIntArray * cast(Object *obj)
int pre_allocated_property_fields()
Definition: objects-inl.h:2804
static Failure * cast(MaybeObject *object)
Definition: objects-inl.h:485
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kThisPropertyAssignmentsOffset kNeedsAccessCheckBit is_expression
Definition: objects-inl.h:3686
static Oddball * cast(Object *obj)
Handle< Object > GetSourceCode()
Definition: objects.cc:7675
static ExternalUnsignedByteArray * cast(Object *obj)
void SmiPrint()
Definition: objects.h:995
kPropertyAccessorsOffset named_property_handler
Definition: objects-inl.h:3614
static FixedDoubleArray * cast(Object *obj)
Object * FastPropertyAt(int index)
Definition: objects-inl.h:1521
static ExternalPixelArray * cast(Object *obj)
double get_scalar(int index)
Definition: objects-inl.h:1721
static JSMessageObject * cast(Object *obj)
Definition: objects-inl.h:4361
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kThisPropertyAssignmentsOffset needs_access_check
Definition: objects-inl.h:3682
static JSDate * cast(Object *obj)
Definition: objects-inl.h:4345
static ExternalDoubleArray * cast(Object *obj)
static ExternalFloatArray * cast(Object *obj)
void PrintElementsKind(FILE *out, ElementsKind kind)
bool has_named_interceptor()
Definition: objects.h:4638
static HeapNumber * cast(Object *obj)
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
Definition: objects.cc:6819
#define STRUCT_LIST(V)
Definition: objects.h:429
static JSGlobalPropertyCell * cast(Object *obj)
bool has_indexed_interceptor()
Definition: objects.h:4647
static JSValue * cast(Object *obj)
Definition: objects-inl.h:4327
bool is_undetectable()
Definition: objects.h:4661
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kThisPropertyAssignmentsOffset flag
Definition: objects-inl.h:3682
static JSWeakMap * cast(Object *obj)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
Definition: flags.cc:274
InstanceType instance_type()
Definition: objects-inl.h:2864
static JSProxy * cast(Object *obj)
static FixedArray * cast(Object *obj)
ElementsKind elements_kind()
Definition: objects.h:4685
static ExternalByteArray * cast(Object *obj)
int aliased_context_slot()
void Flush(FILE *out)
Definition: v8utils.cc:56
static JSModule * cast(Object *obj)
Definition: objects-inl.h:4317
static ExternalUnsignedIntArray * cast(Object *obj)
StringDictionary * property_dictionary()
Definition: objects-inl.h:4626
static JSObject * cast(Object *obj)
FlagType type() const
Definition: flags.cc:1358
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset access_check_info
Definition: objects-inl.h:3624
#define MAKE_STRUCT_CASE(NAME, Name, name)
static JSGlobalObject * cast(Object *obj)
static JSFunction * cast(Object *obj)