Revision: 15352
Author:   [email protected]
Date:     Thu Jun 27 06:03:01 2013
Log:      Move phase_zone from CompilationInfo to CompilationPhase.

Each CompilationPhase has its own zone, used for phase local
allocations. The zone of CompilationInfo should only be used
for non phase local allocations.

[email protected]
BUG=

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

Modified:
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h
 /branches/bleeding_edge/src/lithium-allocator.h
 /branches/bleeding_edge/src/lithium.h

=======================================
--- /branches/bleeding_edge/src/compiler.cc     Wed Jun 26 09:17:12 2013
+++ /branches/bleeding_edge/src/compiler.cc     Thu Jun 27 06:03:01 2013
@@ -54,55 +54,50 @@


 CompilationInfo::CompilationInfo(Handle<Script> script,
-                                 Zone* zone,
-                                 Zone* phase_zone)
+                                 Zone* zone)
     : flags_(LanguageModeField::encode(CLASSIC_MODE)),
       script_(script),
       osr_ast_id_(BailoutId::None()) {
-  Initialize(script->GetIsolate(), BASE, zone, phase_zone);
+  Initialize(script->GetIsolate(), BASE, zone);
 }


 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
-                                 Zone* zone,
-                                 Zone* phase_zone)
+                                 Zone* zone)
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
       shared_info_(shared_info),
       script_(Handle<Script>(Script::cast(shared_info->script()))),
       osr_ast_id_(BailoutId::None()) {
-  Initialize(script_->GetIsolate(), BASE, zone, phase_zone);
+  Initialize(script_->GetIsolate(), BASE, zone);
 }


 CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
-                                 Zone* zone,
-                                 Zone* phase_zone)
+                                 Zone* zone)
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
       closure_(closure),
       shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
       script_(Handle<Script>(Script::cast(shared_info_->script()))),
       context_(closure->context()),
       osr_ast_id_(BailoutId::None()) {
-  Initialize(script_->GetIsolate(), BASE, zone, phase_zone);
+  Initialize(script_->GetIsolate(), BASE, zone);
 }


 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
                                  Isolate* isolate,
-                                 Zone* zone,
-                                 Zone* phase_zone)
+                                 Zone* zone)
     : flags_(LanguageModeField::encode(CLASSIC_MODE) |
              IsLazy::encode(true)),
       osr_ast_id_(BailoutId::None()) {
-  Initialize(isolate, STUB, zone, phase_zone);
+  Initialize(isolate, STUB, zone);
   code_stub_ = stub;
 }


 void CompilationInfo::Initialize(Isolate* isolate,
                                  Mode mode,
-                                 Zone* zone,
-                                 Zone* phase_zone) {
+                                 Zone* zone) {
   isolate_ = isolate;
   function_ = NULL;
   scope_ = NULL;
@@ -110,7 +105,6 @@
   extension_ = NULL;
   pre_parse_data_ = NULL;
   zone_ = zone;
-  phase_zone_ = phase_zone;
   deferred_handles_ = NULL;
   code_stub_ = NULL;
   prologue_offset_ = kPrologueOffsetNotSet;
@@ -1228,12 +1222,10 @@
 }


-CompilationPhase::CompilationPhase(const char* name,
-                                   Isolate* isolate,
-                                   Zone* zone)
-    : name_(name), isolate_(isolate), zone_(zone) {
+CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
+    : name_(name), info_(info), zone_(info->isolate()) {
   if (FLAG_hydrogen_stats) {
-    start_allocation_size_ = zone->allocation_size();
+    info_zone_start_allocation_size_ = info->zone()->allocation_size();
     start_ticks_ = OS::Ticks();
   }
 }
@@ -1241,9 +1233,10 @@

 CompilationPhase::~CompilationPhase() {
   if (FLAG_hydrogen_stats) {
-    unsigned size = zone()->allocation_size() - start_allocation_size_;
+    unsigned size = zone()->allocation_size();
+ size += info_->zone()->allocation_size() - info_zone_start_allocation_size_;
     int64_t ticks = OS::Ticks() - start_ticks_;
-    isolate_->GetHStatistics()->SaveTiming(name_, ticks, size);
+    isolate()->GetHStatistics()->SaveTiming(name_, ticks, size);
   }
 }

=======================================
--- /branches/bleeding_edge/src/compiler.h      Wed Jun 26 09:17:12 2013
+++ /branches/bleeding_edge/src/compiler.h      Thu Jun 27 06:03:01 2013
@@ -57,7 +57,7 @@
 // is constructed based on the resources available at compile-time.
 class CompilationInfo {
  public:
- CompilationInfo(Handle<JSFunction> closure, Zone* zone, Zone* phase_zone);
+  CompilationInfo(Handle<JSFunction> closure, Zone* zone);
   virtual ~CompilationInfo();

   Isolate* isolate() {
@@ -65,7 +65,6 @@
     return isolate_;
   }
   Zone* zone() { return zone_; }
-  Zone* phase_zone() { return phase_zone_; }
   bool is_lazy() const { return IsLazy::decode(flags_); }
   bool is_eval() const { return IsEval::decode(flags_); }
   bool is_global() const { return IsGlobal::decode(flags_); }
@@ -303,15 +302,12 @@

  protected:
   CompilationInfo(Handle<Script> script,
-                  Zone* zone,
-                  Zone* phase_zone);
+                  Zone* zone);
   CompilationInfo(Handle<SharedFunctionInfo> shared_info,
-                  Zone* zone,
-                  Zone* phase_zone);
+                  Zone* zone);
   CompilationInfo(HydrogenCodeStub* stub,
                   Isolate* isolate,
-                  Zone* zone,
-                  Zone* phase_zone);
+                  Zone* zone);

  private:
   Isolate* isolate_;
@@ -329,7 +325,7 @@
     DEPENDENCY_CHANGE_ABORT
   };

- void Initialize(Isolate* isolate, Mode mode, Zone* zone, Zone* phase_zone);
+  void Initialize(Isolate* isolate, Mode mode, Zone* zone);

   void SetMode(Mode mode) {
     ASSERT(V8::UseCrankshaft());
@@ -403,9 +399,6 @@
   // The zone from which the compilation pipeline working on this
   // CompilationInfo allocates.
   Zone* zone_;
-  // The phase zone where allocations local to a specific phase are
-  // performed; be aware that this zone is cleared after each phase
-  Zone* phase_zone_;

   DeferredHandles* deferred_handles_;

@@ -440,21 +433,17 @@
 class CompilationInfoWithZone: public CompilationInfo {
  public:
   explicit CompilationInfoWithZone(Handle<Script> script)
-      : CompilationInfo(script, &zone_, &phase_zone_),
-        zone_(script->GetIsolate()),
-        phase_zone_(script->GetIsolate()) {}
+      : CompilationInfo(script, &zone_),
+        zone_(script->GetIsolate()) {}
   explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info)
-      : CompilationInfo(shared_info, &zone_, &phase_zone_),
-        zone_(shared_info->GetIsolate()),
-        phase_zone_(shared_info->GetIsolate()) {}
+      : CompilationInfo(shared_info, &zone_),
+        zone_(shared_info->GetIsolate()) {}
   explicit CompilationInfoWithZone(Handle<JSFunction> closure)
-      : CompilationInfo(closure, &zone_, &phase_zone_),
-        zone_(closure->GetIsolate()),
-        phase_zone_(closure->GetIsolate()) {}
+      : CompilationInfo(closure, &zone_),
+        zone_(closure->GetIsolate()) {}
   CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
-      : CompilationInfo(stub, isolate, &zone_, &phase_zone_),
-        zone_(isolate),
-        phase_zone_(isolate) {}
+      : CompilationInfo(stub, isolate, &zone_),
+        zone_(isolate) {}

   // Virtual destructor because a CompilationInfoWithZone has to exit the
   // zone scope and get rid of dependent maps even when the destructor is
@@ -465,7 +454,6 @@

  private:
   Zone zone_;
-  Zone phase_zone_;
 };


@@ -631,21 +619,21 @@

 class CompilationPhase BASE_EMBEDDED {
  public:
-  CompilationPhase(const char* name, Isolate* isolate, Zone* zone);
+  CompilationPhase(const char* name, CompilationInfo* info);
   ~CompilationPhase();

  protected:
   bool ShouldProduceTraceOutput() const;

   const char* name() const { return name_; }
-  Isolate* isolate() const { return isolate_; }
-  Zone* zone() const { return zone_; }
+  Isolate* isolate() const { return info_->isolate(); }
+  Zone* zone() { return &zone_; }

  private:
   const char* name_;
-  Isolate* isolate_;
-  Zone* zone_;
-  unsigned start_allocation_size_;
+  CompilationInfo* info_;
+  Zone zone_;
+  unsigned info_zone_start_allocation_size_;
   int64_t start_ticks_;

   DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Wed Jun 26 10:37:55 2013
+++ /branches/bleeding_edge/src/hydrogen.cc     Thu Jun 27 06:03:01 2013
@@ -963,7 +963,7 @@
 HGraph* HGraphBuilder::CreateGraph() {
   graph_ = new(zone()) HGraph(info_);
   if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_);
-  CompilationPhase phase("H_Block building", isolate(), zone());
+  CompilationPhase phase("H_Block building", info_);
   set_current_block(graph()->entry_block());
   if (!BuildGraph()) return NULL;
   graph()->FinalizeUniqueValueIds();
@@ -2384,7 +2384,7 @@


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

   ZoneList<HBasicBlock*> reverse_result(8, zone());
@@ -7932,7 +7932,7 @@
   }

   // Parse and allocate variables.
- CompilationInfo target_info(target, zone(), current_info()->phase_zone());
+  CompilationInfo target_info(target, zone());
   Handle<SharedFunctionInfo> target_shared(target->shared());
   if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info)) {
     if (target_info.isolate()->has_pending_exception()) {
=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Wed Jun 26 10:37:55 2013
+++ /branches/bleeding_edge/src/hydrogen.h      Thu Jun 27 06:03:01 2013
@@ -1958,7 +1958,7 @@
 class HPhase : public CompilationPhase {
  public:
   HPhase(const char* name, HGraph* graph)
-      : CompilationPhase(name, graph->isolate(), graph->zone()),
+      : CompilationPhase(name, graph->info()),
         graph_(graph) { }
   ~HPhase();

=======================================
--- /branches/bleeding_edge/src/lithium-allocator.h     Wed Jun 26 01:43:27 2013
+++ /branches/bleeding_edge/src/lithium-allocator.h     Thu Jun 27 06:03:01 2013
@@ -648,7 +648,7 @@
 class LAllocatorPhase : public CompilationPhase {
  public:
   LAllocatorPhase(const char* name, LAllocator* allocator)
-      : CompilationPhase(name, allocator->isolate(), allocator->zone()),
+      : CompilationPhase(name, allocator->graph()->info()),
         allocator_(allocator) { }
   ~LAllocatorPhase();

=======================================
--- /branches/bleeding_edge/src/lithium.h       Wed Jun 26 01:43:27 2013
+++ /branches/bleeding_edge/src/lithium.h       Thu Jun 27 06:03:01 2013
@@ -762,7 +762,7 @@
 class LPhase : public CompilationPhase {
  public:
   LPhase(const char* name, LChunk* chunk)
-      : CompilationPhase(name, chunk->isolate(), chunk->zone()),
+      : CompilationPhase(name, chunk->info()),
         chunk_(chunk) { }
   ~LPhase();

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