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

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

Issue 2360963005: Relax zone allocation assertion (Closed)
Patch Set: fschneider pre-review Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/thread.h » ('j') | 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/allocation.h" 5 #include "vm/allocation.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/thread.h" 9 #include "vm/thread.h"
10 #include "vm/zone.h" 10 #include "vm/zone.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 static void* Allocate(uword size, Zone* zone) { 14 static void* Allocate(uword size, Zone* zone) {
15 ASSERT(zone != NULL); 15 ASSERT(zone != NULL);
16 if (size > static_cast<uword>(kIntptrMax)) { 16 if (size > static_cast<uword>(kIntptrMax)) {
17 FATAL1("ZoneAllocated object has unexpectedly large size %" Pu "", size); 17 FATAL1("ZoneAllocated object has unexpectedly large size %" Pu "", size);
18 } 18 }
19 return reinterpret_cast<void*>(zone->AllocUnsafe(size)); 19 return reinterpret_cast<void*>(zone->AllocUnsafe(size));
20 } 20 }
21 21
22 22
23 void* ZoneAllocated::operator new(uword size) { 23 void* ZoneAllocated::operator new(uword size) {
24 return Allocate(size, Thread::Current()->zone()); 24 return Allocate(size, Thread::Current()->zone());
25 } 25 }
26 26
27 27
28 void* ZoneAllocated::operator new(uword size, Zone* zone) { 28 void* ZoneAllocated::operator new(uword size, Zone* zone) {
29 ASSERT(zone == Thread::Current()->zone()); 29 ASSERT(Thread::Current()->ZoneIsOwnedByThread(zone));
30 return Allocate(size, zone); 30 return Allocate(size, zone);
31 } 31 }
32 32
33 33
34 StackResource::~StackResource() { 34 StackResource::~StackResource() {
35 if (thread_ != NULL) { 35 if (thread_ != NULL) {
36 StackResource* top = thread_->top_resource(); 36 StackResource* top = thread_->top_resource();
37 ASSERT(top == this); 37 ASSERT(top == this);
38 thread_->set_top_resource(previous_); 38 thread_->set_top_resource(previous_);
39 } 39 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 thread()->IncrementNoSafepointScopeDepth(); 80 thread()->IncrementNoSafepointScopeDepth();
81 } 81 }
82 82
83 83
84 NoSafepointScope::~NoSafepointScope() { 84 NoSafepointScope::~NoSafepointScope() {
85 thread()->DecrementNoSafepointScopeDepth(); 85 thread()->DecrementNoSafepointScopeDepth();
86 } 86 }
87 #endif // defined(DEBUG) 87 #endif // defined(DEBUG)
88 88
89 } // namespace dart 89 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698