Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Unified Diff: runtime/vm/zone.cc

Issue 11040062: Renamed Zone->StackZone, BaseZone->Zone, in preparation for changing isolate->get_zone() to return … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review changes Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/zone.h ('k') | runtime/vm/zone_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/zone.cc
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc
index 88ee0c06e2cbc3b29978bd4e4f0e4766f6a4cf7a..461fd874a66ad003b98eaa047bbd430f7c3fc5b4 100644
--- a/runtime/vm/zone.cc
+++ b/runtime/vm/zone.cc
@@ -19,7 +19,7 @@ DEFINE_DEBUG_FLAG(bool, trace_zone_sizes,
// Zone segments represent chunks of memory: They have starting
// address encoded in the this pointer and a size in bytes. They are
// chained together to form the backing storage for an expanding zone.
-class BaseZone::Segment {
+class Zone::Segment {
public:
Segment* next() const { return next_; }
intptr_t size() const { return size_; }
@@ -44,7 +44,7 @@ class BaseZone::Segment {
};
-void BaseZone::Segment::DeleteSegmentList(Segment* head) {
+void Zone::Segment::DeleteSegmentList(Segment* head) {
Segment* current = head;
while (current != NULL) {
Segment* next = current->next();
@@ -58,8 +58,7 @@ void BaseZone::Segment::DeleteSegmentList(Segment* head) {
}
-BaseZone::Segment* BaseZone::Segment::New(intptr_t size,
- BaseZone::Segment* next) {
+Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) {
ASSERT(size >= 0);
Segment* result = reinterpret_cast<Segment*>(new uint8_t[size]);
if (result != NULL) {
@@ -74,12 +73,13 @@ BaseZone::Segment* BaseZone::Segment::New(intptr_t size,
}
-BaseZone::BaseZone()
+Zone::Zone()
: initial_buffer_(buffer_, kInitialChunkSize),
position_(initial_buffer_.start()),
limit_(initial_buffer_.end()),
head_(NULL),
- large_segments_(NULL) {
+ large_segments_(NULL),
+ handles_() {
#ifdef DEBUG
// Zap the entire initial buffer.
memset(initial_buffer_.pointer(), kZapUninitializedByte,
@@ -88,7 +88,7 @@ BaseZone::BaseZone()
}
-BaseZone::~BaseZone() {
+Zone::~Zone() {
DeleteAll();
#if defined(DEBUG)
if (FLAG_trace_zone_sizes) {
@@ -98,7 +98,7 @@ BaseZone::~BaseZone() {
}
-void BaseZone::DeleteAll() {
+void Zone::DeleteAll() {
// Traverse the chained list of segments, zapping (in debug mode)
// and freeing every zone segment.
Segment::DeleteSegmentList(head_);
@@ -115,7 +115,7 @@ void BaseZone::DeleteAll() {
}
-intptr_t BaseZone::SizeInBytes() const {
+intptr_t Zone::SizeInBytes() const {
intptr_t size = 0;
for (Segment* s = large_segments_; s != NULL; s = s->next()) {
size += s->size();
@@ -131,7 +131,7 @@ intptr_t BaseZone::SizeInBytes() const {
}
-uword BaseZone::AllocateExpand(intptr_t size) {
+uword Zone::AllocateExpand(intptr_t size) {
#if defined(DEBUG)
ASSERT(size >= 0);
if (FLAG_trace_zone_sizes) {
@@ -164,7 +164,7 @@ uword BaseZone::AllocateExpand(intptr_t size) {
}
-uword BaseZone::AllocateLargeSegment(intptr_t size) {
+uword Zone::AllocateLargeSegment(intptr_t size) {
#if defined(DEBUG)
ASSERT(size >= 0);
// Make sure the requested size is already properly aligned and that
@@ -184,7 +184,7 @@ uword BaseZone::AllocateLargeSegment(intptr_t size) {
}
-char* BaseZone::MakeCopyOfString(const char* str) {
+char* Zone::MakeCopyOfString(const char* str) {
intptr_t len = strlen(str) + 1; // '\0'-terminated.
char* copy = Alloc<char>(len);
strncpy(copy, str, len);
@@ -193,7 +193,7 @@ char* BaseZone::MakeCopyOfString(const char* str) {
#if defined(DEBUG)
-void BaseZone::DumpZoneSizes() {
+void Zone::DumpZoneSizes() {
intptr_t size = 0;
for (Segment* s = large_segments_; s != NULL; s = s->next()) {
size += s->size();
@@ -204,10 +204,9 @@ void BaseZone::DumpZoneSizes() {
#endif
-Zone::Zone(BaseIsolate* isolate)
+StackZone::StackZone(BaseIsolate* isolate)
: StackResource(isolate),
zone_(),
- handles_(),
previous_(NULL) {
// Assert that there is no current zone as we only want to scope
// zones when transitioning from generated dart code to dart VM
@@ -217,14 +216,14 @@ Zone::Zone(BaseIsolate* isolate)
}
-Zone::~Zone() {
+StackZone::~StackZone() {
ASSERT(isolate()->current_zone() == this);
isolate()->set_current_zone(previous_);
}
-void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) {
- Zone* zone = this;
+void StackZone::VisitObjectPointers(ObjectPointerVisitor* visitor) {
+ StackZone* zone = this;
while (zone != NULL) {
zone->handles()->VisitObjectPointers(visitor);
zone = zone->previous_;
@@ -232,7 +231,7 @@ void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) {
}
-char* Zone::PrintToString(const char* format, ...) {
+char* StackZone::PrintToString(const char* format, ...) {
va_list args;
va_start(args, format);
intptr_t len = OS::VSNPrint(NULL, 0, format, args);
« no previous file with comments | « runtime/vm/zone.h ('k') | runtime/vm/zone_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698