| OLD | NEW | 
|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef V8_COMPILER_ZONE_POOL_H_ | 5 #ifndef V8_COMPILER_ZONE_POOL_H_ | 
| 6 #define V8_COMPILER_ZONE_POOL_H_ | 6 #define V8_COMPILER_ZONE_POOL_H_ | 
| 7 | 7 | 
| 8 #include <map> | 8 #include <map> | 
| 9 #include <set> | 9 #include <set> | 
| 10 #include <vector> | 10 #include <vector> | 
| 11 | 11 | 
| 12 #include "src/zone.h" | 12 #include "src/zone.h" | 
| 13 | 13 | 
| 14 namespace v8 { | 14 namespace v8 { | 
| 15 namespace internal { | 15 namespace internal { | 
| 16 namespace compiler { | 16 namespace compiler { | 
| 17 | 17 | 
| 18 class ZonePool final { | 18 class ZonePool final { | 
| 19  public: | 19  public: | 
| 20   class Scope final { | 20   class Scope final { | 
| 21    public: | 21    public: | 
| 22     explicit Scope(ZonePool* zone_pool) : zone_pool_(zone_pool), zone_(NULL) {} | 22     explicit Scope(ZonePool* zone_pool) | 
|  | 23         : zone_pool_(zone_pool), zone_(nullptr) {} | 
| 23     ~Scope() { Destroy(); } | 24     ~Scope() { Destroy(); } | 
| 24 | 25 | 
| 25     Zone* zone() { | 26     Zone* zone() { | 
| 26       if (zone_ == NULL) zone_ = zone_pool_->NewEmptyZone(); | 27       if (zone_ == nullptr) zone_ = zone_pool_->NewEmptyZone(); | 
| 27       return zone_; | 28       return zone_; | 
| 28     } | 29     } | 
| 29     void Destroy() { | 30     void Destroy() { | 
| 30       if (zone_ != NULL) zone_pool_->ReturnZone(zone_); | 31       if (zone_ != nullptr) zone_pool_->ReturnZone(zone_); | 
| 31       zone_ = NULL; | 32       zone_ = nullptr; | 
| 32     } | 33     } | 
| 33 | 34 | 
| 34    private: | 35    private: | 
| 35     ZonePool* const zone_pool_; | 36     ZonePool* const zone_pool_; | 
| 36     Zone* zone_; | 37     Zone* zone_; | 
| 37     DISALLOW_COPY_AND_ASSIGN(Scope); | 38     DISALLOW_COPY_AND_ASSIGN(Scope); | 
| 38   }; | 39   }; | 
| 39 | 40 | 
| 40   class StatsScope final { | 41   class StatsScope final { | 
| 41    public: | 42    public: | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 83   size_t total_deleted_bytes_; | 84   size_t total_deleted_bytes_; | 
| 84 | 85 | 
| 85   DISALLOW_COPY_AND_ASSIGN(ZonePool); | 86   DISALLOW_COPY_AND_ASSIGN(ZonePool); | 
| 86 }; | 87 }; | 
| 87 | 88 | 
| 88 }  // namespace compiler | 89 }  // namespace compiler | 
| 89 }  // namespace internal | 90 }  // namespace internal | 
| 90 }  // namespace v8 | 91 }  // namespace v8 | 
| 91 | 92 | 
| 92 #endif | 93 #endif | 
| OLD | NEW | 
|---|