Revision: 15197
Author:   [email protected]
Date:     Wed Jun 19 00:48:41 2013
Log:      Make Zone::allocation_size work with parallel zones.

[email protected]

Review URL: https://codereview.chromium.org/16858018
http://code.google.com/p/v8/source/detail?r=15197

Modified:
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h
 /branches/bleeding_edge/src/zone.cc
 /branches/bleeding_edge/src/zone.h

=======================================
--- /branches/bleeding_edge/src/compiler.cc     Thu Jun 13 04:09:19 2013
+++ /branches/bleeding_edge/src/compiler.cc     Wed Jun 19 00:48:41 2013
@@ -367,7 +367,7 @@
   // performance of the hydrogen-based compiler.
bool should_recompile = !info()->shared_info()->has_deoptimization_support();
   if (should_recompile || FLAG_hydrogen_stats) {
-    HPhase phase(HPhase::kFullCodeGen, isolate());
+    HPhase phase(HPhase::kFullCodeGen, isolate(), info()->zone());
     CompilationInfoWithZone unoptimized(info()->shared_info());
     // Note that we use the same AST that we will use for generating the
     // optimized code.
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Tue Jun 18 06:32:06 2013
+++ /branches/bleeding_edge/src/hydrogen.cc     Wed Jun 19 00:48:41 2013
@@ -963,7 +963,7 @@
 HGraph* HGraphBuilder::CreateGraph() {
   graph_ = new(zone()) HGraph(info_);
   if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_);
-  HPhase phase("H_Block building", isolate());
+  HPhase phase("H_Block building", isolate(), zone());
   set_current_block(graph()->entry_block());
   if (!BuildGraph()) return NULL;
   graph()->FinalizeUniqueValueIds();
@@ -2384,7 +2384,7 @@


 void HGraph::OrderBlocks() {
-  HPhase phase("H_Block ordering", isolate());
+  HPhase phase("H_Block ordering", isolate(), zone());
   BitVector visited(blocks_.length(), zone());

   ZoneList<HBasicBlock*> reverse_result(8, zone());
@@ -11575,33 +11575,35 @@
 const char* const HPhase::kFullCodeGen = "Full code generator";


-HPhase::HPhase(const char* name, Isolate* isolate) {
-  Init(isolate, name, NULL, NULL, NULL);
+HPhase::HPhase(const char* name, Isolate* isolate, Zone* zone) {
+  Init(isolate, name, zone, NULL, NULL, NULL);
 }


 HPhase::HPhase(const char* name, HGraph* graph) {
-  Init(graph->isolate(), name, graph, NULL, NULL);
+  Init(graph->isolate(), name, graph->zone(), graph, NULL, NULL);
 }


 HPhase::HPhase(const char* name, LChunk* chunk) {
-  Init(chunk->isolate(), name, NULL, chunk, NULL);
+  Init(chunk->isolate(), name, chunk->zone(), NULL, chunk, NULL);
 }


 HPhase::HPhase(const char* name, LAllocator* allocator) {
-  Init(allocator->isolate(), name, NULL, NULL, allocator);
+ Init(allocator->isolate(), name, allocator->zone(), NULL, NULL, allocator);
 }


 void HPhase::Init(Isolate* isolate,
                   const char* name,
+                  Zone* zone,
                   HGraph* graph,
                   LChunk* chunk,
                   LAllocator* allocator) {
   isolate_ = isolate;
   name_ = name;
+  zone_ = zone;
   graph_ = graph;
   chunk_ = chunk;
   allocator_ = allocator;
@@ -11610,7 +11612,7 @@
   }
   if (FLAG_hydrogen_stats) {
     start_ticks_ = OS::Ticks();
-    start_allocation_size_ = Zone::allocation_size_;
+    start_allocation_size_ = zone_->allocation_size();
   }
 }

@@ -11618,7 +11620,7 @@
 HPhase::~HPhase() {
   if (FLAG_hydrogen_stats) {
     int64_t ticks = OS::Ticks() - start_ticks_;
-    unsigned size = Zone::allocation_size_ - start_allocation_size_;
+    unsigned size = zone_->allocation_size() - start_allocation_size_;
     isolate_->GetHStatistics()->SaveTiming(name_, ticks, size);
   }

=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Fri Jun 14 07:16:03 2013
+++ /branches/bleeding_edge/src/hydrogen.h      Wed Jun 19 00:48:41 2013
@@ -1935,7 +1935,7 @@
  public:
   static const char* const kFullCodeGen;

-  HPhase(const char* name, Isolate* isolate);
+  HPhase(const char* name, Isolate* isolate, Zone* zone);
   HPhase(const char* name, HGraph* graph);
   HPhase(const char* name, LChunk* chunk);
   HPhase(const char* name, LAllocator* allocator);
@@ -1944,12 +1944,14 @@
  private:
   void Init(Isolate* isolate,
             const char* name,
+            Zone* zone,
             HGraph* graph,
             LChunk* chunk,
             LAllocator* allocator);

   Isolate* isolate_;
   const char* name_;
+  Zone* zone_;
   HGraph* graph_;
   LChunk* chunk_;
   LAllocator* allocator_;
=======================================
--- /branches/bleeding_edge/src/zone.cc Wed Jun 20 01:58:41 2012
+++ /branches/bleeding_edge/src/zone.cc Wed Jun 19 00:48:41 2013
@@ -69,6 +69,7 @@

 Zone::Zone(Isolate* isolate)
     : zone_excess_limit_(256 * MB),
+      allocation_size_(0),
       segment_bytes_allocated_(0),
       position_(0),
       limit_(0),
@@ -76,7 +77,7 @@
       segment_head_(NULL),
       isolate_(isolate) {
 }
-unsigned Zone::allocation_size_ = 0;
+

 ZoneScope::~ZoneScope() {
   if (ShouldDeleteOnExit()) zone_->DeleteAll();
=======================================
--- /branches/bleeding_edge/src/zone.h  Wed Jun 20 01:58:41 2012
+++ /branches/bleeding_edge/src/zone.h  Wed Jun 19 00:48:41 2013
@@ -85,10 +85,10 @@
   inline bool excess_allocation();

   inline void adjust_segment_bytes_allocated(int delta);
+
+  inline unsigned allocation_size() { return allocation_size_; }

   inline Isolate* isolate() { return isolate_; }
-
-  static unsigned allocation_size_;

  private:
   friend class Isolate;
@@ -111,6 +111,9 @@
   // Report zone excess when allocation exceeds this limit.
   int zone_excess_limit_;

+  // The number of bytes allocated in this zone so far.
+  unsigned allocation_size_;
+
   // The number of bytes allocated in segments.  Note that this number
   // includes memory allocated from the OS but not yet allocated from
   // the zone.

--
--
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