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

Side by Side Diff: runtime/vm/zone.cc

Issue 19974002: Reuse the top ApiLocalScope so that we do not allocate and free an ApiLocalScope (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/handles_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/zone.h" 5 #include "vm/zone.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/handles_impl.h"
10 #include "vm/heap.h" 11 #include "vm/heap.h"
11 #include "vm/isolate.h" 12 #include "vm/isolate.h"
12 #include "vm/os.h" 13 #include "vm/os.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 DEFINE_DEBUG_FLAG(bool, trace_zones, 17 DEFINE_DEBUG_FLAG(bool, trace_zones,
17 false, "Traces allocation sizes in the zone."); 18 false, "Traces allocation sizes in the zone.");
18 19
19 20
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Segment::DeleteSegmentList(large_segments_); 108 Segment::DeleteSegmentList(large_segments_);
108 109
109 // Reset zone state. 110 // Reset zone state.
110 #ifdef DEBUG 111 #ifdef DEBUG
111 memset(initial_buffer_.pointer(), kZapDeletedByte, initial_buffer_.size()); 112 memset(initial_buffer_.pointer(), kZapDeletedByte, initial_buffer_.size());
112 #endif 113 #endif
113 position_ = initial_buffer_.start(); 114 position_ = initial_buffer_.start();
114 limit_ = initial_buffer_.end(); 115 limit_ = initial_buffer_.end();
115 head_ = NULL; 116 head_ = NULL;
116 large_segments_ = NULL; 117 large_segments_ = NULL;
118 previous_ = NULL;
119 handles_.Reset();
117 } 120 }
118 121
119 122
120 intptr_t Zone::SizeInBytes() const { 123 intptr_t Zone::SizeInBytes() const {
121 intptr_t size = 0; 124 intptr_t size = 0;
122 for (Segment* s = large_segments_; s != NULL; s = s->next()) { 125 for (Segment* s = large_segments_; s != NULL; s = s->next()) {
123 size += s->size(); 126 size += s->size();
124 } 127 }
125 if (head_ == NULL) { 128 if (head_ == NULL) {
126 return size + (position_ - initial_buffer_.start()); 129 return size + (position_ - initial_buffer_.start());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 va_list args2; 259 va_list args2;
257 va_start(args2, format); 260 va_start(args2, format);
258 OS::VSNPrint(buffer, (len + 1), format, args2); 261 OS::VSNPrint(buffer, (len + 1), format, args2);
259 va_end(args2); 262 va_end(args2);
260 263
261 return buffer; 264 return buffer;
262 } 265 }
263 266
264 267
265 } // namespace dart 268 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/handles_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698