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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 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
« no previous file with comments | « runtime/platform/utils_win.h ('k') | runtime/vm/allocation.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #ifndef RUNTIME_VM_ALLOCATION_H_ 5 #ifndef RUNTIME_VM_ALLOCATION_H_
6 #define RUNTIME_VM_ALLOCATION_H_ 6 #define RUNTIME_VM_ALLOCATION_H_
7 7
8 #include "platform/allocation.h" 8 #include "platform/allocation.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/base_isolate.h" 10 #include "vm/base_isolate.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 private: 43 private:
44 void Init(Thread* thread); 44 void Init(Thread* thread);
45 45
46 Thread* thread_; 46 Thread* thread_;
47 StackResource* previous_; 47 StackResource* previous_;
48 48
49 DISALLOW_ALLOCATION(); 49 DISALLOW_ALLOCATION();
50 DISALLOW_IMPLICIT_CONSTRUCTORS(StackResource); 50 DISALLOW_IMPLICIT_CONSTRUCTORS(StackResource);
51 }; 51 };
52 52
53
54 // Zone allocated objects cannot be individually deallocated, but have 53 // Zone allocated objects cannot be individually deallocated, but have
55 // to rely on the destructor of Zone which is called when the Zone 54 // to rely on the destructor of Zone which is called when the Zone
56 // goes out of scope to reclaim memory. 55 // goes out of scope to reclaim memory.
57 class ZoneAllocated { 56 class ZoneAllocated {
58 public: 57 public:
59 ZoneAllocated() {} 58 ZoneAllocated() {}
60 59
61 // Implicitly allocate the object in the current zone. 60 // Implicitly allocate the object in the current zone.
62 void* operator new(uword size); 61 void* operator new(uword size);
63 62
64 // Allocate the object in the given zone, which must be the current zone. 63 // Allocate the object in the given zone, which must be the current zone.
65 void* operator new(uword size, Zone* zone); 64 void* operator new(uword size, Zone* zone);
66 65
67 // Ideally, the delete operator should be protected instead of 66 // Ideally, the delete operator should be protected instead of
68 // public, but unfortunately the compiler sometimes synthesizes 67 // public, but unfortunately the compiler sometimes synthesizes
69 // (unused) destructors for classes derived from ZoneObject, which 68 // (unused) destructors for classes derived from ZoneObject, which
70 // require the operator to be visible. MSVC requires the delete 69 // require the operator to be visible. MSVC requires the delete
71 // operator to be public. 70 // operator to be public.
72 71
73 // Disallow explicit deallocation of nodes. Nodes can only be 72 // Disallow explicit deallocation of nodes. Nodes can only be
74 // deallocated by invoking DeleteAll() on the zone they live in. 73 // deallocated by invoking DeleteAll() on the zone they live in.
75 void operator delete(void* pointer) { UNREACHABLE(); } 74 void operator delete(void* pointer) { UNREACHABLE(); }
76 75
77 private: 76 private:
78 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); 77 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated);
79 }; 78 };
80 79
81
82 // Within a NoSafepointScope, the thread must not reach any safepoint. Used 80 // Within a NoSafepointScope, the thread must not reach any safepoint. Used
83 // around code that manipulates raw object pointers directly without handles. 81 // around code that manipulates raw object pointers directly without handles.
84 #if defined(DEBUG) 82 #if defined(DEBUG)
85 class NoSafepointScope : public StackResource { 83 class NoSafepointScope : public StackResource {
86 public: 84 public:
87 NoSafepointScope(); 85 NoSafepointScope();
88 ~NoSafepointScope(); 86 ~NoSafepointScope();
89 87
90 private: 88 private:
91 DISALLOW_COPY_AND_ASSIGN(NoSafepointScope); 89 DISALLOW_COPY_AND_ASSIGN(NoSafepointScope);
92 }; 90 };
93 #else // defined(DEBUG) 91 #else // defined(DEBUG)
94 class NoSafepointScope : public ValueObject { 92 class NoSafepointScope : public ValueObject {
95 public: 93 public:
96 NoSafepointScope() {} 94 NoSafepointScope() {}
97 95
98 private: 96 private:
99 DISALLOW_COPY_AND_ASSIGN(NoSafepointScope); 97 DISALLOW_COPY_AND_ASSIGN(NoSafepointScope);
100 }; 98 };
101 #endif // defined(DEBUG) 99 #endif // defined(DEBUG)
102 100
103 } // namespace dart 101 } // namespace dart
104 102
105 #endif // RUNTIME_VM_ALLOCATION_H_ 103 #endif // RUNTIME_VM_ALLOCATION_H_
OLDNEW
« no previous file with comments | « runtime/platform/utils_win.h ('k') | runtime/vm/allocation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698