Reviewers: dcarney,

Message:
plz review

Description:
Explicitly initialize MarkCompactCollector and ExternalStringTable

BUG=none
[email protected]
LOG=n

Please review this at https://codereview.chromium.org/143063003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+6, -6 lines):
  M src/heap.h
  M src/heap.cc
  M src/mark-compact.h
  M src/mark-compact.cc


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 5c6eb18c5d0972f48636c847832b600eb5e64a55..8b033d60afb1af728db37b2bb7808a311d1fe151 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -134,6 +134,7 @@ Heap::Heap()
       last_gc_end_timestamp_(0.0),
       marking_time_(0.0),
       sweeping_time_(0.0),
+      mark_compact_collector_(this),
       store_buffer_(this),
       marking_(this),
       incremental_marking_(this),
@@ -152,6 +153,7 @@ Heap::Heap()
       allocation_sites_scratchpad_length(0),
       promotion_queue_(this),
       configured_(false),
+      external_string_table_(this),
       chunks_queued_for_free_(NULL),
       relocation_mutex_(NULL) {
   // Allow build-time customization of the max semispace size. Building
@@ -177,8 +179,6 @@ Heap::Heap()
   native_contexts_list_ = NULL;
   array_buffers_list_ = Smi::FromInt(0);
   allocation_sites_list_ = Smi::FromInt(0);
-  mark_compact_collector_.heap_ = this;
-  external_string_table_.heap_ = this;
   // Put a dummy entry in the remembered pages so we can find the list the
   // minidump even if there are no real unmapped pages.
   RememberUnmappedPage(NULL, false);
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index 49c536b5169d994bbc2ae3c4b5c7964c0c9d87ce..8c0bc0dc283e83c7ceb2f95724de5b0fb240717b 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -462,7 +462,7 @@ class ExternalStringTable {
   void TearDown();

  private:
-  ExternalStringTable() { }
+  explicit ExternalStringTable(Heap* heap) : heap_(heap) { }

   friend class Heap;

Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index c7e98b7bab704c79eb6889437fe260644fdc9604..7a76d1b334c4165e7e189713a908e982415e3046 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -56,7 +56,7 @@ const char* Marking::kImpossibleBitPattern = "01";
// -------------------------------------------------------------------------
 // MarkCompactCollector

-MarkCompactCollector::MarkCompactCollector() :  // NOLINT
+MarkCompactCollector::MarkCompactCollector(Heap* heap) :  // NOLINT
 #ifdef DEBUG
       state_(IDLE),
 #endif
@@ -70,7 +70,7 @@ MarkCompactCollector::MarkCompactCollector() :  // NOLINT
       sequential_sweeping_(false),
       tracer_(NULL),
       migration_slots_buffer_(NULL),
-      heap_(NULL),
+      heap_(heap),
       code_flusher_(NULL),
       encountered_weak_collections_(NULL),
       have_code_to_deoptimize_(false) { }
Index: src/mark-compact.h
diff --git a/src/mark-compact.h b/src/mark-compact.h
index 2a1d97dc2aefc98c382a27419c2a575e6e53cedb..01ecbf8ec9093e91024372e3f780daa5108e5e57 100644
--- a/src/mark-compact.h
+++ b/src/mark-compact.h
@@ -744,7 +744,7 @@ class MarkCompactCollector {
   void MarkAllocationSite(AllocationSite* site);

  private:
-  MarkCompactCollector();
+  explicit MarkCompactCollector(Heap* heap);
   ~MarkCompactCollector();

   bool MarkInvalidatedCode();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to