~ubuntu-branches/ubuntu/saucy/libv8/saucy

« back to all changes in this revision

Viewing changes to src/profile-generator.h

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2012-04-07 16:26:13 UTC
  • mfrom: (15.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120407162613-dqo1m6w9r3fh8tst
Tags: 3.8.9.16-3
* mipsel build fixes :
  + v8_use_mips_abi_hardfloat=false, this lowers EABI requirements.
  + v8_can_use_fpu_instructions=false, detect if FPU is present.
  + set -Wno-unused-but-set-variable only on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
455
455
    kProperty = v8::HeapGraphEdge::kProperty,
456
456
    kInternal = v8::HeapGraphEdge::kInternal,
457
457
    kHidden = v8::HeapGraphEdge::kHidden,
458
 
    kShortcut = v8::HeapGraphEdge::kShortcut
 
458
    kShortcut = v8::HeapGraphEdge::kShortcut,
 
459
    kWeak = v8::HeapGraphEdge::kWeak
459
460
  };
460
461
 
461
462
  HeapGraphEdge() { }
465
466
 
466
467
  Type type() { return static_cast<Type>(type_); }
467
468
  int index() {
468
 
    ASSERT(type_ == kElement || type_ == kHidden);
 
469
    ASSERT(type_ == kElement || type_ == kHidden || type_ == kWeak);
469
470
    return index_;
470
471
  }
471
472
  const char* name() {
588
589
  int EntrySize() { return EntriesSize(1, children_count_, retainers_count_); }
589
590
  int RetainedSize(bool exact);
590
591
 
591
 
  void Print(int max_depth, int indent);
 
592
  void Print(
 
593
      const char* prefix, const char* edge_name, int max_depth, int indent);
592
594
 
593
595
  Handle<HeapObject> GetHeapObject();
594
596
 
661
663
  HeapEntry* root() { return root_entry_; }
662
664
  HeapEntry* gc_roots() { return gc_roots_entry_; }
663
665
  HeapEntry* natives_root() { return natives_root_entry_; }
 
666
  HeapEntry* gc_subroot(int index) { return gc_subroot_entries_[index]; }
664
667
  List<HeapEntry*>* entries() { return &entries_; }
665
668
  int raw_entries_size() { return raw_entries_size_; }
666
669
 
674
677
                      int retainers_count);
675
678
  HeapEntry* AddRootEntry(int children_count);
676
679
  HeapEntry* AddGcRootsEntry(int children_count, int retainers_count);
 
680
  HeapEntry* AddGcSubrootEntry(int tag,
 
681
                               int children_count,
 
682
                               int retainers_count);
677
683
  HeapEntry* AddNativesRootEntry(int children_count, int retainers_count);
678
684
  void ClearPaint();
679
685
  HeapEntry* GetEntryById(uint64_t id);
695
701
  HeapEntry* root_entry_;
696
702
  HeapEntry* gc_roots_entry_;
697
703
  HeapEntry* natives_root_entry_;
 
704
  HeapEntry* gc_subroot_entries_[VisitorSynchronization::kNumberOfSyncTags];
698
705
  char* raw_entries_;
699
706
  List<HeapEntry*> entries_;
700
707
  bool entries_sorted_;
716
723
  void MoveObject(Address from, Address to);
717
724
 
718
725
  static uint64_t GenerateId(v8::RetainedObjectInfo* info);
 
726
  static inline uint64_t GetNthGcSubrootId(int delta);
719
727
 
 
728
  static const int kObjectIdStep = 2;
720
729
  static const uint64_t kInternalRootObjectId;
721
730
  static const uint64_t kGcRootsObjectId;
722
731
  static const uint64_t kNativesRootObjectId;
 
732
  static const uint64_t kGcRootsFirstSubrootId;
723
733
  static const uint64_t kFirstAvailableObjectId;
724
734
 
725
735
 private:
740
750
 
741
751
  static uint32_t AddressHash(Address addr) {
742
752
    return ComputeIntegerHash(
743
 
        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)));
 
753
        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)),
 
754
        v8::internal::kZeroHashSeed);
744
755
  }
745
756
 
746
757
  bool initial_fill_mode_;
823
834
  int total_children_count() { return total_children_count_; }
824
835
  int total_retainers_count() { return total_retainers_count_; }
825
836
 
826
 
  static HeapEntry *const kHeapEntryPlaceholder;
 
837
  static HeapEntry* const kHeapEntryPlaceholder;
827
838
 
828
839
 private:
829
840
  struct EntryInfo {
841
852
 
842
853
  static uint32_t Hash(HeapThing thing) {
843
854
    return ComputeIntegerHash(
844
 
        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(thing)));
 
855
        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(thing)),
 
856
        v8::internal::kZeroHashSeed);
845
857
  }
846
858
  static bool HeapThingsMatch(HeapThing key1, HeapThing key2) {
847
859
    return key1 == key2;
969
981
                          HeapEntry* parent,
970
982
                          int index,
971
983
                          Object* child);
 
984
  void SetWeakReference(HeapObject* parent_obj,
 
985
                        HeapEntry* parent_entry,
 
986
                        int index,
 
987
                        Object* child_obj,
 
988
                        int field_offset);
972
989
  void SetPropertyReference(HeapObject* parent_obj,
973
990
                            HeapEntry* parent,
974
991
                            String* reference_name,
981
998
                                    Object* child);
982
999
  void SetRootShortcutReference(Object* child);
983
1000
  void SetRootGcRootsReference();
984
 
  void SetGcRootsReference(Object* child);
 
1001
  void SetGcRootsReference(VisitorSynchronization::SyncTag tag);
 
1002
  void SetGcSubrootReference(
 
1003
      VisitorSynchronization::SyncTag tag, bool is_weak, Object* child);
985
1004
  void TagObject(Object* obj, const char* tag);
986
1005
 
987
1006
  HeapEntry* GetEntry(Object* obj);
988
1007
 
 
1008
  static inline HeapObject* GetNthGcSubrootObject(int delta);
 
1009
  static inline int GetGcSubrootOrder(HeapObject* subroot);
 
1010
 
989
1011
  Heap* heap_;
990
1012
  HeapSnapshot* snapshot_;
991
1013
  HeapSnapshotsCollection* collection_;
994
1016
  HeapObjectsSet objects_tags_;
995
1017
 
996
1018
  static HeapObject* const kGcRootsObject;
 
1019
  static HeapObject* const kFirstGcSubrootObject;
 
1020
  static HeapObject* const kLastGcSubrootObject;
997
1021
 
998
1022
  friend class IndexedReferencesExtractor;
 
1023
  friend class GcSubrootsEnumerator;
999
1024
  friend class RootsReferencesExtractor;
1000
1025
 
1001
1026
  DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer);
1024
1049
  void VisitSubtreeWrapper(Object** p, uint16_t class_id);
1025
1050
 
1026
1051
  static uint32_t InfoHash(v8::RetainedObjectInfo* info) {
1027
 
    return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash()));
 
1052
    return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash()),
 
1053
                              v8::internal::kZeroHashSeed);
1028
1054
  }
1029
1055
  static bool RetainedInfosMatch(void* key1, void* key2) {
1030
1056
    return key1 == key2 ||
1102
1128
 
1103
1129
  INLINE(static uint32_t ObjectHash(const void* key)) {
1104
1130
    return ComputeIntegerHash(
1105
 
        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)));
 
1131
        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)),
 
1132
        v8::internal::kZeroHashSeed);
1106
1133
  }
1107
1134
 
1108
1135
  void EnumerateNodes();