Revision f230a1cf deps/v8/src/objects-debug.cc

View differences:

deps/v8/src/objects-debug.cc
95 95
    case FIXED_DOUBLE_ARRAY_TYPE:
96 96
      FixedDoubleArray::cast(this)->FixedDoubleArrayVerify();
97 97
      break;
98
    case CONSTANT_POOL_ARRAY_TYPE:
99
      ConstantPoolArray::cast(this)->ConstantPoolArrayVerify();
100
      break;
98 101
    case BYTE_ARRAY_TYPE:
99 102
      ByteArray::cast(this)->ByteArrayVerify();
100 103
      break;
......
303 306
}
304 307

  
305 308

  
309
bool JSObject::ElementsAreSafeToExamine() {
310
  return (FLAG_use_gvn && FLAG_use_allocation_folding) ||
311
      reinterpret_cast<Map*>(elements()) !=
312
      GetHeap()->one_pointer_filler_map();
313
}
314

  
315

  
306 316
void JSObject::JSObjectVerify() {
307 317
  VerifyHeapPointer(properties());
308 318
  VerifyHeapPointer(elements());
......
330 340
    }
331 341
  }
332 342

  
333
  // TODO(hpayer): deal gracefully with partially constructed JSObjects, when
334
  // allocation folding is turned off.
335
  if (reinterpret_cast<Map*>(elements()) !=
336
      GetHeap()->one_pointer_filler_map()) {
343
  // If a GC was caused while constructing this object, the elements
344
  // pointer may point to a one pointer filler map.
345
  if (ElementsAreSafeToExamine()) {
337 346
    CHECK_EQ((map()->has_fast_smi_or_object_elements() ||
338 347
              (elements() == GetHeap()->empty_fixed_array())),
339 348
             (elements()->map() == GetHeap()->fixed_array_map() ||
......
438 447
}
439 448

  
440 449

  
450
void ConstantPoolArray::ConstantPoolArrayVerify() {
451
  CHECK(IsConstantPoolArray());
452
}
453

  
454

  
441 455
void JSGeneratorObject::JSGeneratorObjectVerify() {
442 456
  // In an expression like "new g()", there can be a point where a generator
443 457
  // object is allocated but its fields are all undefined, as it hasn't yet been
......
664 678
}
665 679

  
666 680

  
667
void Code::VerifyEmbeddedMapsDependency() {
681
void Code::VerifyEmbeddedObjectsDependency() {
668 682
  int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
669 683
  for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
670
    RelocInfo::Mode mode = it.rinfo()->rmode();
671
    if (mode == RelocInfo::EMBEDDED_OBJECT &&
672
      it.rinfo()->target_object()->IsMap()) {
673
      Map* map = Map::cast(it.rinfo()->target_object());
674
      if (map->CanTransition()) {
684
    Object* obj = it.rinfo()->target_object();
685
    if (IsWeakEmbeddedObject(kind(), obj)) {
686
      if (obj->IsMap()) {
687
        Map* map = Map::cast(obj);
675 688
        CHECK(map->dependent_code()->Contains(
676 689
            DependentCode::kWeaklyEmbeddedGroup, this));
690
      } else if (obj->IsJSObject()) {
691
        Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table();
692
        WeakHashTable* table = WeakHashTable::cast(raw_table);
693
        CHECK(DependentCode::cast(table->Lookup(obj))->Contains(
694
            DependentCode::kWeaklyEmbeddedGroup, this));
677 695
      }
678 696
    }
679 697
  }
......
683 701
void JSArray::JSArrayVerify() {
684 702
  JSObjectVerify();
685 703
  CHECK(length()->IsNumber() || length()->IsUndefined());
686
  // TODO(hpayer): deal gracefully with partially constructed JSObjects, when
687
  // allocation folding is turned off.
688
  if (reinterpret_cast<Map*>(elements()) !=
689
      GetHeap()->one_pointer_filler_map()) {
704
  // If a GC was caused while constructing this array, the elements
705
  // pointer may point to a one pointer filler map.
706
  if (ElementsAreSafeToExamine()) {
690 707
    CHECK(elements()->IsUndefined() ||
691 708
          elements()->IsFixedArray() ||
692 709
          elements()->IsFixedDoubleArray());

Also available in: Unified diff