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

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

Issue 944783002: Save top StackResource in entry frame. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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/allocation.h ('k') | runtime/vm/base_isolate.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/zone.h" 9 #include "vm/zone.h"
10 10
(...skipping 18 matching lines...) Expand all
29 return Allocate(size, isolate->current_zone()); 29 return Allocate(size, isolate->current_zone());
30 } 30 }
31 31
32 32
33 void* ZoneAllocated::operator new(uword size, Zone* zone) { 33 void* ZoneAllocated::operator new(uword size, Zone* zone) {
34 ASSERT(zone == Isolate::Current()->current_zone()); 34 ASSERT(zone == Isolate::Current()->current_zone());
35 return Allocate(size, zone); 35 return Allocate(size, zone);
36 } 36 }
37 37
38 38
39 void StackResource::Unwind(Isolate* isolate, uword stack_pointer) { 39 void StackResource::UnwindAbove(Isolate* isolate, StackResource* new_top) {
40 while (isolate->top_resource() != NULL &&
41 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) {
42 isolate->top_resource()->~StackResource();
43 }
44 #if defined(DEBUG)
45 // All remaining stack resources should be below stack_pointer.
46 StackResource* current = isolate->top_resource();
47 while (current != NULL) {
48 ASSERT(reinterpret_cast<uword>(current) >= stack_pointer);
49 current = current->previous_;
50 }
51 #endif // DEBUG
52 }
53
54
55 void StackResource::Unwind(Isolate* isolate, StackResource* new_top) {
56 StackResource* current_resource = isolate->top_resource(); 40 StackResource* current_resource = isolate->top_resource();
57 while (current_resource != new_top) { 41 while (current_resource != new_top) {
58 current_resource->~StackResource(); 42 current_resource->~StackResource();
59 current_resource = isolate->top_resource(); 43 current_resource = isolate->top_resource();
60 } 44 }
61 } 45 }
62 46
63 } // namespace dart 47 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/allocation.h ('k') | runtime/vm/base_isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698