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-debug.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 DEBUG
39 
40 void MaybeObject::Verify() {
41  Object* this_as_object;
42  if (ToObject(&this_as_object)) {
43  if (this_as_object->IsSmi()) {
44  Smi::cast(this_as_object)->SmiVerify();
45  } else {
46  HeapObject::cast(this_as_object)->HeapObjectVerify();
47  }
48  } else {
49  Failure::cast(this)->FailureVerify();
50  }
51 }
52 
53 
54 void Object::VerifyPointer(Object* p) {
55  if (p->IsHeapObject()) {
56  HeapObject::VerifyHeapPointer(p);
57  } else {
58  ASSERT(p->IsSmi());
59  }
60 }
61 
62 
63 void Smi::SmiVerify() {
64  ASSERT(IsSmi());
65 }
66 
67 
68 void Failure::FailureVerify() {
69  ASSERT(IsFailure());
70 }
71 
72 
73 void HeapObject::HeapObjectVerify() {
74  InstanceType instance_type = map()->instance_type();
75 
76  if (instance_type < FIRST_NONSTRING_TYPE) {
77  String::cast(this)->StringVerify();
78  return;
79  }
80 
81  switch (instance_type) {
82  case MAP_TYPE:
83  Map::cast(this)->MapVerify();
84  break;
85  case HEAP_NUMBER_TYPE:
86  HeapNumber::cast(this)->HeapNumberVerify();
87  break;
88  case FIXED_ARRAY_TYPE:
89  FixedArray::cast(this)->FixedArrayVerify();
90  break;
92  FixedDoubleArray::cast(this)->FixedDoubleArrayVerify();
93  break;
94  case BYTE_ARRAY_TYPE:
95  ByteArray::cast(this)->ByteArrayVerify();
96  break;
97  case FREE_SPACE_TYPE:
98  FreeSpace::cast(this)->FreeSpaceVerify();
99  break;
101  ExternalPixelArray::cast(this)->ExternalPixelArrayVerify();
102  break;
104  ExternalByteArray::cast(this)->ExternalByteArrayVerify();
105  break;
107  ExternalUnsignedByteArray::cast(this)->ExternalUnsignedByteArrayVerify();
108  break;
110  ExternalShortArray::cast(this)->ExternalShortArrayVerify();
111  break;
114  ExternalUnsignedShortArrayVerify();
115  break;
117  ExternalIntArray::cast(this)->ExternalIntArrayVerify();
118  break;
120  ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayVerify();
121  break;
123  ExternalFloatArray::cast(this)->ExternalFloatArrayVerify();
124  break;
126  ExternalDoubleArray::cast(this)->ExternalDoubleArrayVerify();
127  break;
128  case CODE_TYPE:
129  Code::cast(this)->CodeVerify();
130  break;
131  case ODDBALL_TYPE:
132  Oddball::cast(this)->OddballVerify();
133  break;
134  case JS_OBJECT_TYPE:
136  JSObject::cast(this)->JSObjectVerify();
137  break;
138  case JS_MODULE_TYPE:
139  JSModule::cast(this)->JSModuleVerify();
140  break;
141  case JS_VALUE_TYPE:
142  JSValue::cast(this)->JSValueVerify();
143  break;
144  case JS_DATE_TYPE:
145  JSDate::cast(this)->JSDateVerify();
146  break;
147  case JS_FUNCTION_TYPE:
148  JSFunction::cast(this)->JSFunctionVerify();
149  break;
151  JSGlobalProxy::cast(this)->JSGlobalProxyVerify();
152  break;
154  JSGlobalObject::cast(this)->JSGlobalObjectVerify();
155  break;
157  JSBuiltinsObject::cast(this)->JSBuiltinsObjectVerify();
158  break;
160  JSGlobalPropertyCell::cast(this)->JSGlobalPropertyCellVerify();
161  break;
162  case JS_ARRAY_TYPE:
163  JSArray::cast(this)->JSArrayVerify();
164  break;
165  case JS_SET_TYPE:
166  JSSet::cast(this)->JSSetVerify();
167  break;
168  case JS_MAP_TYPE:
169  JSMap::cast(this)->JSMapVerify();
170  break;
171  case JS_WEAK_MAP_TYPE:
172  JSWeakMap::cast(this)->JSWeakMapVerify();
173  break;
174  case JS_REGEXP_TYPE:
175  JSRegExp::cast(this)->JSRegExpVerify();
176  break;
177  case FILLER_TYPE:
178  break;
179  case JS_PROXY_TYPE:
180  JSProxy::cast(this)->JSProxyVerify();
181  break;
183  JSFunctionProxy::cast(this)->JSFunctionProxyVerify();
184  break;
185  case FOREIGN_TYPE:
186  Foreign::cast(this)->ForeignVerify();
187  break;
189  SharedFunctionInfo::cast(this)->SharedFunctionInfoVerify();
190  break;
192  JSMessageObject::cast(this)->JSMessageObjectVerify();
193  break;
194 
195 #define MAKE_STRUCT_CASE(NAME, Name, name) \
196  case NAME##_TYPE: \
197  Name::cast(this)->Name##Verify(); \
198  break;
200 #undef MAKE_STRUCT_CASE
201 
202  default:
203  UNREACHABLE();
204  break;
205  }
206 }
207 
208 
209 void HeapObject::VerifyHeapPointer(Object* p) {
210  ASSERT(p->IsHeapObject());
211  ASSERT(HEAP->Contains(HeapObject::cast(p)));
212 }
213 
214 
215 void HeapNumber::HeapNumberVerify() {
216  ASSERT(IsHeapNumber());
217 }
218 
219 
220 void ByteArray::ByteArrayVerify() {
221  ASSERT(IsByteArray());
222 }
223 
224 
225 void FreeSpace::FreeSpaceVerify() {
226  ASSERT(IsFreeSpace());
227 }
228 
229 
230 void ExternalPixelArray::ExternalPixelArrayVerify() {
231  ASSERT(IsExternalPixelArray());
232 }
233 
234 
235 void ExternalByteArray::ExternalByteArrayVerify() {
236  ASSERT(IsExternalByteArray());
237 }
238 
239 
240 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayVerify() {
241  ASSERT(IsExternalUnsignedByteArray());
242 }
243 
244 
245 void ExternalShortArray::ExternalShortArrayVerify() {
246  ASSERT(IsExternalShortArray());
247 }
248 
249 
250 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayVerify() {
251  ASSERT(IsExternalUnsignedShortArray());
252 }
253 
254 
255 void ExternalIntArray::ExternalIntArrayVerify() {
256  ASSERT(IsExternalIntArray());
257 }
258 
259 
260 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() {
261  ASSERT(IsExternalUnsignedIntArray());
262 }
263 
264 
265 void ExternalFloatArray::ExternalFloatArrayVerify() {
266  ASSERT(IsExternalFloatArray());
267 }
268 
269 
270 void ExternalDoubleArray::ExternalDoubleArrayVerify() {
271  ASSERT(IsExternalDoubleArray());
272 }
273 
274 
275 void JSObject::JSObjectVerify() {
276  VerifyHeapPointer(properties());
277  VerifyHeapPointer(elements());
278 
280  ASSERT(this->elements()->IsFixedArray());
281  ASSERT(this->elements()->length() >= 2);
282  }
283 
284  if (HasFastProperties()) {
285  CHECK_EQ(map()->unused_property_fields(),
286  (map()->inobject_properties() + properties()->length() -
287  map()->NextFreePropertyIndex()));
288  }
289  ASSERT_EQ((map()->has_fast_smi_or_object_elements() ||
290  (elements() == GetHeap()->empty_fixed_array())),
291  (elements()->map() == GetHeap()->fixed_array_map() ||
292  elements()->map() == GetHeap()->fixed_cow_array_map()));
293  ASSERT(map()->has_fast_object_elements() == HasFastObjectElements());
294 }
295 
296 
297 void Map::MapVerify() {
298  ASSERT(!HEAP->InNewSpace(this));
301  (kPointerSize <= instance_size() &&
302  instance_size() < HEAP->Capacity()));
303  VerifyHeapPointer(prototype());
304  VerifyHeapPointer(instance_descriptors());
305  SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates());
306  SLOW_ASSERT(instance_descriptors()->IsConsistentWithBackPointers(this));
307 }
308 
309 
310 void Map::SharedMapVerify() {
311  MapVerify();
312  ASSERT(is_shared());
313  ASSERT(instance_descriptors()->IsEmpty());
317  visitor_id());
318 }
319 
320 
321 void CodeCache::CodeCacheVerify() {
322  VerifyHeapPointer(default_cache());
323  VerifyHeapPointer(normal_type_cache());
324  ASSERT(default_cache()->IsFixedArray());
325  ASSERT(normal_type_cache()->IsUndefined()
326  || normal_type_cache()->IsCodeCacheHashTable());
327 }
328 
329 
330 void PolymorphicCodeCache::PolymorphicCodeCacheVerify() {
331  VerifyHeapPointer(cache());
332  ASSERT(cache()->IsUndefined() || cache()->IsPolymorphicCodeCacheHashTable());
333 }
334 
335 
336 void TypeFeedbackInfo::TypeFeedbackInfoVerify() {
337  VerifyObjectField(kIcTotalCountOffset);
338  VerifyObjectField(kIcWithTypeinfoCountOffset);
339  VerifyHeapPointer(type_feedback_cells());
340 }
341 
342 
343 void AliasedArgumentsEntry::AliasedArgumentsEntryVerify() {
344  VerifySmiField(kAliasedContextSlot);
345 }
346 
347 
348 void FixedArray::FixedArrayVerify() {
349  for (int i = 0; i < length(); i++) {
350  Object* e = get(i);
351  if (e->IsHeapObject()) {
352  VerifyHeapPointer(e);
353  } else {
354  e->Verify();
355  }
356  }
357 }
358 
359 
360 void FixedDoubleArray::FixedDoubleArrayVerify() {
361  for (int i = 0; i < length(); i++) {
362  if (!is_the_hole(i)) {
363  double value = get_scalar(i);
364  ASSERT(!isnan(value) ||
365  (BitCast<uint64_t>(value) ==
366  BitCast<uint64_t>(canonical_not_the_hole_nan_as_double())) ||
367  ((BitCast<uint64_t>(value) & Double::kSignMask) != 0));
368  }
369  }
370 }
371 
372 
373 void JSModule::JSModuleVerify() {
374  Object* v = context();
375  if (v->IsHeapObject()) {
376  VerifyHeapPointer(v);
377  }
378  CHECK(v->IsUndefined() || v->IsModuleContext());
379 }
380 
381 
382 void JSValue::JSValueVerify() {
383  Object* v = value();
384  if (v->IsHeapObject()) {
385  VerifyHeapPointer(v);
386  }
387 }
388 
389 
390 void JSDate::JSDateVerify() {
391  if (value()->IsHeapObject()) {
392  VerifyHeapPointer(value());
393  }
394  CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber());
395  CHECK(year()->IsUndefined() || year()->IsSmi() || year()->IsNaN());
396  CHECK(month()->IsUndefined() || month()->IsSmi() || month()->IsNaN());
397  CHECK(day()->IsUndefined() || day()->IsSmi() || day()->IsNaN());
398  CHECK(weekday()->IsUndefined() || weekday()->IsSmi() || weekday()->IsNaN());
399  CHECK(hour()->IsUndefined() || hour()->IsSmi() || hour()->IsNaN());
400  CHECK(min()->IsUndefined() || min()->IsSmi() || min()->IsNaN());
401  CHECK(sec()->IsUndefined() || sec()->IsSmi() || sec()->IsNaN());
402  CHECK(cache_stamp()->IsUndefined() ||
403  cache_stamp()->IsSmi() ||
404  cache_stamp()->IsNaN());
405 
406  if (month()->IsSmi()) {
407  int month = Smi::cast(this->month())->value();
408  CHECK(0 <= month && month <= 11);
409  }
410  if (day()->IsSmi()) {
411  int day = Smi::cast(this->day())->value();
412  CHECK(1 <= day && day <= 31);
413  }
414  if (hour()->IsSmi()) {
415  int hour = Smi::cast(this->hour())->value();
416  CHECK(0 <= hour && hour <= 23);
417  }
418  if (min()->IsSmi()) {
419  int min = Smi::cast(this->min())->value();
420  CHECK(0 <= min && min <= 59);
421  }
422  if (sec()->IsSmi()) {
423  int sec = Smi::cast(this->sec())->value();
424  CHECK(0 <= sec && sec <= 59);
425  }
426  if (weekday()->IsSmi()) {
427  int weekday = Smi::cast(this->weekday())->value();
428  CHECK(0 <= weekday && weekday <= 6);
429  }
430  if (cache_stamp()->IsSmi()) {
431  CHECK(Smi::cast(cache_stamp())->value() <=
432  Smi::cast(Isolate::Current()->date_cache()->stamp())->value());
433  }
434 }
435 
436 
437 void JSMessageObject::JSMessageObjectVerify() {
438  CHECK(IsJSMessageObject());
439  CHECK(type()->IsString());
440  CHECK(arguments()->IsJSArray());
441  VerifyObjectField(kStartPositionOffset);
442  VerifyObjectField(kEndPositionOffset);
443  VerifyObjectField(kArgumentsOffset);
444  VerifyObjectField(kScriptOffset);
445  VerifyObjectField(kStackTraceOffset);
446  VerifyObjectField(kStackFramesOffset);
447 }
448 
449 
450 void String::StringVerify() {
451  CHECK(IsString());
452  CHECK(length() >= 0 && length() <= Smi::kMaxValue);
453  if (IsSymbol()) {
454  CHECK(!HEAP->InNewSpace(this));
455  }
456  if (IsConsString()) {
457  ConsString::cast(this)->ConsStringVerify();
458  } else if (IsSlicedString()) {
459  SlicedString::cast(this)->SlicedStringVerify();
460  } else if (IsSeqAsciiString()) {
461  SeqAsciiString::cast(this)->SeqAsciiStringVerify();
462  }
463 }
464 
465 
466 void SeqAsciiString::SeqAsciiStringVerify() {
468 }
469 
470 
471 void ConsString::ConsStringVerify() {
472  CHECK(this->first()->IsString());
473  CHECK(this->second() == GetHeap()->empty_string() ||
474  this->second()->IsString());
475  CHECK(this->length() >= ConsString::kMinLength);
476  if (this->IsFlat()) {
477  // A flat cons can only be created by String::SlowTryFlatten.
478  // Afterwards, the first part may be externalized.
479  CHECK(this->first()->IsSeqString() || this->first()->IsExternalString());
480  }
481 }
482 
483 
484 void SlicedString::SlicedStringVerify() {
485  CHECK(!this->parent()->IsConsString());
486  CHECK(!this->parent()->IsSlicedString());
488 }
489 
490 
491 void JSFunction::JSFunctionVerify() {
492  CHECK(IsJSFunction());
493  VerifyObjectField(kPrototypeOrInitialMapOffset);
494  VerifyObjectField(kNextFunctionLinkOffset);
495  CHECK(code()->IsCode());
496  CHECK(next_function_link()->IsUndefined() ||
497  next_function_link()->IsJSFunction());
498 }
499 
500 
501 void SharedFunctionInfo::SharedFunctionInfoVerify() {
502  CHECK(IsSharedFunctionInfo());
503  VerifyObjectField(kNameOffset);
504  VerifyObjectField(kCodeOffset);
505  VerifyObjectField(kScopeInfoOffset);
506  VerifyObjectField(kInstanceClassNameOffset);
507  VerifyObjectField(kFunctionDataOffset);
508  VerifyObjectField(kScriptOffset);
509  VerifyObjectField(kDebugInfoOffset);
510 }
511 
512 
513 void JSGlobalProxy::JSGlobalProxyVerify() {
514  CHECK(IsJSGlobalProxy());
515  JSObjectVerify();
516  VerifyObjectField(JSGlobalProxy::kContextOffset);
517  // Make sure that this object has no properties, elements.
518  CHECK_EQ(0, properties()->length());
520  CHECK_EQ(0, FixedArray::cast(elements())->length());
521 }
522 
523 
524 void JSGlobalObject::JSGlobalObjectVerify() {
525  CHECK(IsJSGlobalObject());
526  JSObjectVerify();
527  for (int i = GlobalObject::kBuiltinsOffset;
529  i += kPointerSize) {
530  VerifyObjectField(i);
531  }
532 }
533 
534 
535 void JSBuiltinsObject::JSBuiltinsObjectVerify() {
536  CHECK(IsJSBuiltinsObject());
537  JSObjectVerify();
538  for (int i = GlobalObject::kBuiltinsOffset;
540  i += kPointerSize) {
541  VerifyObjectField(i);
542  }
543 }
544 
545 
546 void Oddball::OddballVerify() {
547  CHECK(IsOddball());
548  VerifyHeapPointer(to_string());
549  Object* number = to_number();
550  if (number->IsHeapObject()) {
551  ASSERT(number == HEAP->nan_value());
552  } else {
553  ASSERT(number->IsSmi());
554  int value = Smi::cast(number)->value();
555  // Hidden oddballs have negative smis.
556  const int kLeastHiddenOddballNumber = -4;
557  ASSERT(value <= 1);
558  ASSERT(value >= kLeastHiddenOddballNumber);
559  }
560 }
561 
562 
563 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() {
564  CHECK(IsJSGlobalPropertyCell());
565  VerifyObjectField(kValueOffset);
566 }
567 
568 
569 void Code::CodeVerify() {
570  CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()),
571  kCodeAlignment));
572  relocation_info()->Verify();
573  Address last_gc_pc = NULL;
574  for (RelocIterator it(this); !it.done(); it.next()) {
575  it.rinfo()->Verify();
576  // Ensure that GC will not iterate twice over the same pointer.
577  if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) {
578  CHECK(it.rinfo()->pc() != last_gc_pc);
579  last_gc_pc = it.rinfo()->pc();
580  }
581  }
582 }
583 
584 
585 void JSArray::JSArrayVerify() {
586  JSObjectVerify();
587  ASSERT(length()->IsNumber() || length()->IsUndefined());
588  ASSERT(elements()->IsUndefined() ||
589  elements()->IsFixedArray() ||
590  elements()->IsFixedDoubleArray());
591 }
592 
593 
594 void JSSet::JSSetVerify() {
595  CHECK(IsJSSet());
596  JSObjectVerify();
597  VerifyHeapPointer(table());
598  ASSERT(table()->IsHashTable() || table()->IsUndefined());
599 }
600 
601 
602 void JSMap::JSMapVerify() {
603  CHECK(IsJSMap());
604  JSObjectVerify();
605  VerifyHeapPointer(table());
606  ASSERT(table()->IsHashTable() || table()->IsUndefined());
607 }
608 
609 
610 void JSWeakMap::JSWeakMapVerify() {
611  CHECK(IsJSWeakMap());
612  JSObjectVerify();
613  VerifyHeapPointer(table());
614  ASSERT(table()->IsHashTable() || table()->IsUndefined());
615 }
616 
617 
618 void JSRegExp::JSRegExpVerify() {
619  JSObjectVerify();
620  ASSERT(data()->IsUndefined() || data()->IsFixedArray());
621  switch (TypeTag()) {
622  case JSRegExp::ATOM: {
623  FixedArray* arr = FixedArray::cast(data());
624  ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString());
625  break;
626  }
627  case JSRegExp::IRREGEXP: {
628  bool is_native = RegExpImpl::UsesNativeRegExp();
629 
630  FixedArray* arr = FixedArray::cast(data());
631  Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex);
632  // Smi : Not compiled yet (-1) or code prepared for flushing.
633  // JSObject: Compilation error.
634  // Code/ByteArray: Compiled code.
635  ASSERT(ascii_data->IsSmi() ||
636  (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray()));
637  Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex);
638  ASSERT(uc16_data->IsSmi() ||
639  (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray()));
640 
641  Object* ascii_saved = arr->get(JSRegExp::kIrregexpASCIICodeSavedIndex);
642  ASSERT(ascii_saved->IsSmi() || ascii_saved->IsString() ||
643  ascii_saved->IsCode());
644  Object* uc16_saved = arr->get(JSRegExp::kIrregexpUC16CodeSavedIndex);
645  ASSERT(uc16_saved->IsSmi() || uc16_saved->IsString() ||
646  uc16_saved->IsCode());
647 
648  ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi());
650  break;
651  }
652  default:
654  ASSERT(data()->IsUndefined());
655  break;
656  }
657 }
658 
659 
660 void JSProxy::JSProxyVerify() {
661  CHECK(IsJSProxy());
662  VerifyPointer(handler());
663  ASSERT(hash()->IsSmi() || hash()->IsUndefined());
664 }
665 
666 
667 void JSFunctionProxy::JSFunctionProxyVerify() {
668  CHECK(IsJSFunctionProxy());
669  JSProxyVerify();
670  VerifyPointer(call_trap());
671  VerifyPointer(construct_trap());
672 }
673 
674 
675 void Foreign::ForeignVerify() {
676  ASSERT(IsForeign());
677 }
678 
679 
680 void AccessorInfo::AccessorInfoVerify() {
681  CHECK(IsAccessorInfo());
682  VerifyPointer(getter());
683  VerifyPointer(setter());
684  VerifyPointer(name());
685  VerifyPointer(data());
686  VerifyPointer(flag());
687  VerifyPointer(expected_receiver_type());
688 }
689 
690 
691 void AccessorPair::AccessorPairVerify() {
692  CHECK(IsAccessorPair());
693  VerifyPointer(getter());
694  VerifyPointer(setter());
695 }
696 
697 
698 void AccessCheckInfo::AccessCheckInfoVerify() {
699  CHECK(IsAccessCheckInfo());
700  VerifyPointer(named_callback());
701  VerifyPointer(indexed_callback());
702  VerifyPointer(data());
703 }
704 
705 
706 void InterceptorInfo::InterceptorInfoVerify() {
707  CHECK(IsInterceptorInfo());
708  VerifyPointer(getter());
709  VerifyPointer(setter());
710  VerifyPointer(query());
711  VerifyPointer(deleter());
712  VerifyPointer(enumerator());
713  VerifyPointer(data());
714 }
715 
716 
717 void CallHandlerInfo::CallHandlerInfoVerify() {
718  CHECK(IsCallHandlerInfo());
719  VerifyPointer(callback());
720  VerifyPointer(data());
721 }
722 
723 
724 void TemplateInfo::TemplateInfoVerify() {
725  VerifyPointer(tag());
726  VerifyPointer(property_list());
727 }
728 
729 void FunctionTemplateInfo::FunctionTemplateInfoVerify() {
730  CHECK(IsFunctionTemplateInfo());
731  TemplateInfoVerify();
732  VerifyPointer(serial_number());
733  VerifyPointer(call_code());
734  VerifyPointer(property_accessors());
735  VerifyPointer(prototype_template());
736  VerifyPointer(parent_template());
737  VerifyPointer(named_property_handler());
738  VerifyPointer(indexed_property_handler());
739  VerifyPointer(instance_template());
740  VerifyPointer(signature());
741  VerifyPointer(access_check_info());
742 }
743 
744 
745 void ObjectTemplateInfo::ObjectTemplateInfoVerify() {
746  CHECK(IsObjectTemplateInfo());
747  TemplateInfoVerify();
748  VerifyPointer(constructor());
749  VerifyPointer(internal_field_count());
750 }
751 
752 
753 void SignatureInfo::SignatureInfoVerify() {
754  CHECK(IsSignatureInfo());
755  VerifyPointer(receiver());
756  VerifyPointer(args());
757 }
758 
759 
760 void TypeSwitchInfo::TypeSwitchInfoVerify() {
761  CHECK(IsTypeSwitchInfo());
762  VerifyPointer(types());
763 }
764 
765 
766 void Script::ScriptVerify() {
767  CHECK(IsScript());
768  VerifyPointer(source());
769  VerifyPointer(name());
770  line_offset()->SmiVerify();
771  column_offset()->SmiVerify();
772  VerifyPointer(data());
773  VerifyPointer(wrapper());
774  type()->SmiVerify();
775  VerifyPointer(line_ends());
776  VerifyPointer(id());
777 }
778 
779 
780 #ifdef ENABLE_DEBUGGER_SUPPORT
781 void DebugInfo::DebugInfoVerify() {
782  CHECK(IsDebugInfo());
783  VerifyPointer(shared());
784  VerifyPointer(original_code());
785  VerifyPointer(code());
786  VerifyPointer(break_points());
787 }
788 
789 
790 void BreakPointInfo::BreakPointInfoVerify() {
791  CHECK(IsBreakPointInfo());
792  code_position()->SmiVerify();
793  source_position()->SmiVerify();
794  statement_position()->SmiVerify();
795  VerifyPointer(break_point_objects());
796 }
797 #endif // ENABLE_DEBUGGER_SUPPORT
798 
799 
800 void JSObject::IncrementSpillStatistics(SpillInformation* info) {
801  info->number_of_objects_++;
802  // Named properties
803  if (HasFastProperties()) {
804  info->number_of_objects_with_fast_properties_++;
805  info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex();
806  info->number_of_fast_unused_fields_ += map()->unused_property_fields();
807  } else {
808  StringDictionary* dict = property_dictionary();
809  info->number_of_slow_used_properties_ += dict->NumberOfElements();
810  info->number_of_slow_unused_properties_ +=
811  dict->Capacity() - dict->NumberOfElements();
812  }
813  // Indexed properties
814  switch (GetElementsKind()) {
816  case FAST_SMI_ELEMENTS:
819  case FAST_HOLEY_ELEMENTS:
820  case FAST_ELEMENTS: {
821  info->number_of_objects_with_fast_elements_++;
822  int holes = 0;
823  FixedArray* e = FixedArray::cast(elements());
824  int len = e->length();
825  Heap* heap = HEAP;
826  for (int i = 0; i < len; i++) {
827  if (e->get(i) == heap->the_hole_value()) holes++;
828  }
829  info->number_of_fast_used_elements_ += len - holes;
830  info->number_of_fast_unused_elements_ += holes;
831  break;
832  }
842  info->number_of_objects_with_fast_elements_++;
843  ExternalPixelArray* e = ExternalPixelArray::cast(elements());
844  info->number_of_fast_used_elements_ += e->length();
845  break;
846  }
847  case DICTIONARY_ELEMENTS: {
848  SeededNumberDictionary* dict = element_dictionary();
849  info->number_of_slow_used_elements_ += dict->NumberOfElements();
850  info->number_of_slow_unused_elements_ +=
851  dict->Capacity() - dict->NumberOfElements();
852  break;
853  }
855  break;
856  }
857 }
858 
859 
860 void JSObject::SpillInformation::Clear() {
861  number_of_objects_ = 0;
862  number_of_objects_with_fast_properties_ = 0;
863  number_of_objects_with_fast_elements_ = 0;
864  number_of_fast_used_fields_ = 0;
865  number_of_fast_unused_fields_ = 0;
866  number_of_slow_used_properties_ = 0;
867  number_of_slow_unused_properties_ = 0;
868  number_of_fast_used_elements_ = 0;
869  number_of_fast_unused_elements_ = 0;
870  number_of_slow_used_elements_ = 0;
871  number_of_slow_unused_elements_ = 0;
872 }
873 
875  PrintF("\n JSObject Spill Statistics (#%d):\n", number_of_objects_);
876 
877  PrintF(" - fast properties (#%d): %d (used) %d (unused)\n",
878  number_of_objects_with_fast_properties_,
879  number_of_fast_used_fields_, number_of_fast_unused_fields_);
880 
881  PrintF(" - slow properties (#%d): %d (used) %d (unused)\n",
882  number_of_objects_ - number_of_objects_with_fast_properties_,
883  number_of_slow_used_properties_, number_of_slow_unused_properties_);
884 
885  PrintF(" - fast elements (#%d): %d (used) %d (unused)\n",
886  number_of_objects_with_fast_elements_,
887  number_of_fast_used_elements_, number_of_fast_unused_elements_);
888 
889  PrintF(" - slow elements (#%d): %d (used) %d (unused)\n",
890  number_of_objects_ - number_of_objects_with_fast_elements_,
891  number_of_slow_used_elements_, number_of_slow_unused_elements_);
892 
893  PrintF("\n");
894 }
895 
896 
897 bool DescriptorArray::IsSortedNoDuplicates() {
898  String* current_key = NULL;
899  uint32_t current = 0;
900  for (int i = 0; i < number_of_descriptors(); i++) {
901  String* key = GetKey(i);
902  if (key == current_key) {
903  PrintDescriptors();
904  return false;
905  }
906  current_key = key;
907  uint32_t hash = GetKey(i)->Hash();
908  if (hash < current) {
909  PrintDescriptors();
910  return false;
911  }
912  current = hash;
913  }
914  return true;
915 }
916 
917 
918 static bool CheckOneBackPointer(Map* current_map, Object* target) {
919  return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map;
920 }
921 
922 
923 bool DescriptorArray::IsConsistentWithBackPointers(Map* current_map) {
924  for (int i = 0; i < number_of_descriptors(); ++i) {
925  switch (GetType(i)) {
926  case MAP_TRANSITION:
927  case CONSTANT_TRANSITION:
928  if (!CheckOneBackPointer(current_map, GetValue(i))) {
929  return false;
930  }
931  break;
932  case CALLBACKS: {
933  Object* object = GetValue(i);
934  if (object->IsAccessorPair()) {
935  AccessorPair* accessors = AccessorPair::cast(object);
936  if (!CheckOneBackPointer(current_map, accessors->getter())) {
937  return false;
938  }
939  if (!CheckOneBackPointer(current_map, accessors->setter())) {
940  return false;
941  }
942  }
943  break;
944  }
945  case NORMAL:
946  case FIELD:
947  case CONSTANT_FUNCTION:
948  case HANDLER:
949  case INTERCEPTOR:
950  case NULL_DESCRIPTOR:
951  break;
952  }
953  }
954  return true;
955 }
956 
957 
958 void JSFunctionResultCache::JSFunctionResultCacheVerify() {
959  JSFunction::cast(get(kFactoryIndex))->Verify();
960 
961  int size = Smi::cast(get(kCacheSizeIndex))->value();
962  ASSERT(kEntriesIndex <= size);
963  ASSERT(size <= length());
964  ASSERT_EQ(0, size % kEntrySize);
965 
966  int finger = Smi::cast(get(kFingerIndex))->value();
967  ASSERT(kEntriesIndex <= finger);
968  ASSERT((finger < size) || (finger == kEntriesIndex && finger == size));
969  ASSERT_EQ(0, finger % kEntrySize);
970 
972  for (int i = kEntriesIndex; i < size; i++) {
973  ASSERT(!get(i)->IsTheHole());
974  get(i)->Verify();
975  }
976  for (int i = size; i < length(); i++) {
977  ASSERT(get(i)->IsTheHole());
978  get(i)->Verify();
979  }
980  }
981 }
982 
983 
984 void NormalizedMapCache::NormalizedMapCacheVerify() {
985  FixedArray::cast(this)->Verify();
987  for (int i = 0; i < length(); i++) {
988  Object* e = get(i);
989  if (e->IsMap()) {
990  Map::cast(e)->SharedMapVerify();
991  } else {
992  ASSERT(e->IsUndefined());
993  }
994  }
995  }
996 }
997 
998 
999 void Map::ZapInstanceDescriptors() {
1000  DescriptorArray* descriptors = instance_descriptors();
1001  if (descriptors == GetHeap()->empty_descriptor_array()) return;
1002  MemsetPointer(descriptors->data_start(),
1003  GetHeap()->the_hole_value(),
1004  descriptors->length());
1005 }
1006 
1007 
1008 void Map::ZapPrototypeTransitions() {
1009  FixedArray* proto_transitions = prototype_transitions();
1010  MemsetPointer(proto_transitions->data_start(),
1011  GetHeap()->the_hole_value(),
1012  proto_transitions->length());
1013 }
1014 
1015 
1016 #endif // DEBUG
1017 
1018 } } // namespace v8::internal
static const int kStartPositionOffset
Definition: objects.h:6347
byte * Address
Definition: globals.h:172
bool FLAG_enable_slow_asserts
static const int kArgumentsOffset
Definition: objects.h:6343
#define SLOW_ASSERT(condition)
Definition: checks.h:276
static const int kCodeOffset
Definition: objects.h:5606
#define CHECK_EQ(expected, value)
Definition: checks.h:219
static const int kIrregexpMaxRegisterCountIndex
Definition: objects.h:6465
static const int kPrototypeOrInitialMapOffset
Definition: objects.h:5982
static const int kCacheSizeIndex
Definition: objects.h:3348
static const int kBuiltinsOffset
Definition: objects.h:6083
void PrintF(const char *format,...)
Definition: v8utils.cc:40
static const int kSize
Definition: objects.h:6151
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)
static AccessorPair * cast(Object *obj)
static JSBuiltinsObject * cast(Object *obj)
const int kVariableSizeSentinel
Definition: objects.h:182
static JSSet * cast(Object *obj)
SeededNumberDictionary * element_dictionary()
Definition: objects-inl.h:4632
static Map * cast(Object *obj)
static ByteArray * cast(Object *obj)
static FreeSpace * cast(Object *obj)
static Foreign * cast(Object *obj)
static const int kIrregexpASCIICodeIndex
Definition: objects.h:6450
static const int kIrregexpUC16CodeIndex
Definition: objects.h:6454
#define ASSERT(condition)
Definition: checks.h:270
v8::Handle< v8::Value > Print(const v8::Arguments &args)
static const int kIrregexpASCIICodeSavedIndex
Definition: objects.h:6458
static ExternalUnsignedShortArray * cast(Object *obj)
static const int kDebugInfoOffset
Definition: objects.h:5614
static JSRegExp * cast(Object *obj)
const intptr_t kCodeAlignment
Definition: v8globals.h:67
kPropertyAccessorsOffset kNamedPropertyHandlerOffset instance_template
Definition: objects-inl.h:3618
static SharedFunctionInfo * cast(Object *obj)
#define CHECK(condition)
Definition: checks.h:56
static const int kInstanceClassNameOffset
Definition: objects.h:5609
int isnan(double x)
static Code * cast(Object *obj)
static const int kIcTotalCountOffset
Definition: objects.h:6726
Object * GetValue(int descriptor_number)
Definition: objects-inl.h:1984
static Smi * cast(Object *object)
static bool IsAscii(const char *chars, int length)
Definition: objects.h:7198
static ExternalShortArray * cast(Object *obj)
static const int kMinLength
Definition: objects.h:7433
static JSFunctionProxy * cast(Object *obj)
String * GetKey(int descriptor_number)
Definition: objects-inl.h:1970
#define UNREACHABLE()
Definition: checks.h:50
static const int kIrregexpUC16CodeSavedIndex
Definition: objects.h:6461
static JSGlobalProxy * cast(Object *obj)
static const uint64_t kSignMask
Definition: double.h:43
static const int kAliasedContextSlot
Definition: objects.h:6763
static const int kStackFramesOffset
Definition: objects.h:6346
static SlicedString * cast(Object *obj)
static ExternalIntArray * cast(Object *obj)
int pre_allocated_property_fields()
Definition: objects-inl.h:2804
static const int kScopeInfoOffset
Definition: objects.h:5607
static Failure * cast(MaybeObject *object)
Definition: objects-inl.h:485
ElementsKind GetElementsKind()
Definition: objects-inl.h:4503
byte * instruction_start()
Definition: objects-inl.h:4376
const int kPointerSize
Definition: globals.h:234
static Oddball * cast(Object *obj)
bool IsAligned(T value, U alignment)
Definition: utils.h:206
static const int kIcWithTypeinfoCountOffset
Definition: objects.h:6727
static SeqAsciiString * cast(Object *obj)
static ExternalUnsignedByteArray * cast(Object *obj)
static const int kNameOffset
Definition: objects.h:5605
kPropertyAccessorsOffset named_property_handler
Definition: objects-inl.h:3614
static FixedDoubleArray * cast(Object *obj)
static ExternalPixelArray * cast(Object *obj)
static const int kMinLength
Definition: objects.h:7485
static const int kNextFunctionLinkOffset
Definition: objects.h:5989
static const int kIrregexpCaptureCountIndex
Definition: objects.h:6467
static JSMap * cast(Object *obj)
double get_scalar(int index)
Definition: objects-inl.h:1721
static JSMessageObject * cast(Object *obj)
Definition: objects-inl.h:4361
static const int kEndPositionOffset
Definition: objects.h:6348
static JSArray * cast(Object *obj)
static JSDate * cast(Object *obj)
Definition: objects-inl.h:4345
static ExternalDoubleArray * cast(Object *obj)
static ExternalFloatArray * cast(Object *obj)
static const int kFunctionDataOffset
Definition: objects.h:5611
static HeapNumber * cast(Object *obj)
#define STRUCT_LIST(V)
Definition: objects.h:429
static const int kContextOffset
Definition: objects.h:6035
static const int kAtomPatternIndex
Definition: objects.h:6443
static bool UsesNativeRegExp()
Definition: jsregexp.h:48
PropertyType GetType(int descriptor_number)
Definition: objects-inl.h:2009
static JSGlobalPropertyCell * cast(Object *obj)
Object * GetBackPointer()
Definition: objects-inl.h:3492
static JSValue * cast(Object *obj)
Definition: objects-inl.h:4327
void MemsetPointer(T **dest, U *value, int counter)
Definition: v8utils.h:146
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kThisPropertyAssignmentsOffset flag
Definition: objects-inl.h:3682
static JSWeakMap * cast(Object *obj)
#define HEAP
Definition: isolate.h:1408
static const int kStackTraceOffset
Definition: objects.h:6345
#define ASSERT_EQ(v1, v2)
Definition: checks.h:271
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 double canonical_not_the_hole_nan_as_double()
Definition: objects-inl.h:1714
static FixedArray * cast(Object *obj)
static const int kScriptOffset
Definition: objects.h:5613
static VisitorId GetVisitorId(int instance_type, int instance_size)
static ExternalByteArray * cast(Object *obj)
static const int kScriptOffset
Definition: objects.h:6344
static const int kSize
Definition: objects.h:6111
static ConsString * cast(Object *obj)
static JSModule * cast(Object *obj)
Definition: objects-inl.h:4317
static const int kMaxValue
Definition: objects.h:1006
int NextFreePropertyIndex()
Definition: objects.cc:4146
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)