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

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

Issue 9186058: Make the "sticky error" an Error instead of a String. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 | « runtime/vm/longjump.h ('k') | runtime/vm/longjump_test.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 #include "vm/longjump.h" 5 #include "vm/longjump.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 #include "vm/object_store.h" 12 #include "vm/object_store.h"
13 #include "vm/os.h" 13 #include "vm/os.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 jmp_buf* LongJump::Set() { 17 jmp_buf* LongJump::Set() {
18 top_ = Isolate::Current()->top_resource(); 18 top_ = Isolate::Current()->top_resource();
19 return &environment_; 19 return &environment_;
20 } 20 }
21 21
22 22
23 void LongJump::Jump(int value, const char* msg) { 23 void LongJump::Jump(int value, const Error& error) {
24 // A zero is the default return value from setting up a LongJump using Set. 24 // A zero is the default return value from setting up a LongJump using Set.
25 ASSERT(value != 0); 25 ASSERT(value != 0);
26 26
27 Isolate* isolate = Isolate::Current(); 27 Isolate* isolate = Isolate::Current();
28 28
29 // Remember the message in the sticky error message of this isolate. 29 // Remember the error in the sticky error of this isolate.
30 const String& error = String::Handle(String::New(msg));
31 isolate->object_store()->set_sticky_error(error); 30 isolate->object_store()->set_sticky_error(error);
32 31
33 // Destruct all the active StackResource objects. 32 // Destruct all the active StackResource objects.
34 StackResource* current_resource = isolate->top_resource(); 33 StackResource* current_resource = isolate->top_resource();
35 while (current_resource != top_) { 34 while (current_resource != top_) {
36 current_resource->~StackResource(); 35 current_resource->~StackResource();
37 current_resource = isolate->top_resource(); 36 current_resource = isolate->top_resource();
38 } 37 }
39 longjmp(environment_, value); 38 longjmp(environment_, value);
40 UNREACHABLE(); 39 UNREACHABLE();
41 } 40 }
42 41
43 } // namespace dart 42 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/longjump.h ('k') | runtime/vm/longjump_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698