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

Side by Side Diff: dart/runtime/vm/longjump.h

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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 | « dart/runtime/vm/json_stream.cc ('k') | dart/runtime/vm/longjump.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_LONGJUMP_H_ 5 #ifndef VM_LONGJUMP_H_
6 #define VM_LONGJUMP_H_ 6 #define VM_LONGJUMP_H_
7 7
8 #include <setjmp.h> 8 #include <setjmp.h>
9 9
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
11 #include "vm/isolate.h"
11 12
12 namespace dart { 13 namespace dart {
13 14
14 class Error; 15 class Error;
15 16
16 class LongJump : public ValueObject { 17 class LongJumpScope : public StackResource {
17 public: 18 public:
18 LongJump() : top_(NULL) { } 19 LongJumpScope()
20 : StackResource(Isolate::Current()),
21 top_(NULL),
22 base_(Isolate::Current()->long_jump_base()) {
23 Isolate::Current()->set_long_jump_base(this);
24 }
25
26 ~LongJumpScope() {
27 Isolate::Current()->set_long_jump_base(base_);
28 }
19 29
20 jmp_buf* Set(); 30 jmp_buf* Set();
21 void Jump(int value, const Error& error); 31 void Jump(int value, const Error& error);
22 32
23 // Would it be safe to use this longjump? 33 // Would it be safe to use this longjump?
24 // 34 //
25 // Checks to make sure that the jump would not cross Dart frames. 35 // Checks to make sure that the jump would not cross Dart frames.
26 bool IsSafeToJump(); 36 bool IsSafeToJump();
27 37
28 private: 38 private:
29 jmp_buf environment_; 39 jmp_buf environment_;
30 StackResource* top_; 40 StackResource* top_;
41 LongJumpScope* base_;
31 42
32 DISALLOW_COPY_AND_ASSIGN(LongJump); 43 DISALLOW_COPY_AND_ASSIGN(LongJumpScope);
33 }; 44 };
34 45
35 } // namespace dart 46 } // namespace dart
36 47
37 #endif // VM_LONGJUMP_H_ 48 #endif // VM_LONGJUMP_H_
OLDNEW
« no previous file with comments | « dart/runtime/vm/json_stream.cc ('k') | dart/runtime/vm/longjump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698