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

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

Issue 10389023: Fixed compilation time measurement, restructure some code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « no previous file | runtime/vm/code_generator_ia32.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 #ifndef VM_ALLOCATION_H_ 5 #ifndef VM_ALLOCATION_H_
6 #define VM_ALLOCATION_H_ 6 #define VM_ALLOCATION_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/base_isolate.h" 9 #include "vm/base_isolate.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 24 matching lines...) Expand all
35 // objects location on the stack. Use stack resource objects if objects 35 // objects location on the stack. Use stack resource objects if objects
36 // need to be destroyed even in the case of exceptions when a Longjump is done 36 // need to be destroyed even in the case of exceptions when a Longjump is done
37 // to a stack frame above the frame where these objects were allocated. 37 // to a stack frame above the frame where these objects were allocated.
38 class StackResource { 38 class StackResource {
39 public: 39 public:
40 explicit StackResource(BaseIsolate* isolate) 40 explicit StackResource(BaseIsolate* isolate)
41 : isolate_(isolate), previous_(NULL) { 41 : isolate_(isolate), previous_(NULL) {
42 // We can only have longjumps and exceptions when there is a current 42 // We can only have longjumps and exceptions when there is a current
43 // isolate. If there is no current isolate, we don't need to 43 // isolate. If there is no current isolate, we don't need to
44 // protect this case. 44 // protect this case.
45 if (isolate) { 45 if (isolate != NULL) {
46 previous_ = isolate->top_resource(); 46 previous_ = isolate->top_resource();
47 isolate->set_top_resource(this); 47 isolate->set_top_resource(this);
48 } 48 }
49 } 49 }
50 50
51 virtual ~StackResource() { 51 virtual ~StackResource() {
52 if (isolate()) { 52 if (isolate() != NULL) {
53 StackResource* top = isolate()->top_resource(); 53 StackResource* top = isolate()->top_resource();
54 ASSERT(top == this); 54 ASSERT(top == this);
55 isolate()->set_top_resource(previous_); 55 isolate()->set_top_resource(previous_);
56 } 56 }
57 #if defined(DEBUG) 57 #if defined(DEBUG)
58 BaseIsolate::AssertCurrent(isolate()); 58 if (isolate() != NULL) {
59 BaseIsolate::AssertCurrent(isolate());
60 }
59 #endif 61 #endif
60 } 62 }
61 63
62 BaseIsolate* isolate() const { return isolate_; } 64 BaseIsolate* isolate() const { return isolate_; }
63 65
64 // The delete operator should be private instead of public, but unfortunately 66 // The delete operator should be private instead of public, but unfortunately
65 // the compiler complains when compiling the destructors for subclasses. 67 // the compiler complains when compiling the destructors for subclasses.
66 void operator delete(void* pointer) { UNREACHABLE(); } 68 void operator delete(void* pointer) { UNREACHABLE(); }
67 69
68 private: 70 private:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // deallocated by invoking DeleteAll() on the zone they live in. 109 // deallocated by invoking DeleteAll() on the zone they live in.
108 void operator delete(void* pointer) { UNREACHABLE(); } 110 void operator delete(void* pointer) { UNREACHABLE(); }
109 111
110 private: 112 private:
111 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); 113 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated);
112 }; 114 };
113 115
114 } // namespace dart 116 } // namespace dart
115 117
116 #endif // VM_ALLOCATION_H_ 118 #endif // VM_ALLOCATION_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698