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

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

Issue 1291803009: Enable concurrent optimization test after migrating scopes to Thread* (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update ASSERT in LongJumpScope. Created 5 years, 4 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/vm/isolate.cc ('k') | runtime/vm/object.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 #include "vm/simulator.h" 14 #include "vm/simulator.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 jmp_buf* LongJumpScope::Set() { 18 jmp_buf* LongJumpScope::Set() {
19 ASSERT(top_ == NULL); 19 ASSERT(top_ == NULL);
20 top_ = Thread::Current()->top_resource(); 20 top_ = Thread::Current()->top_resource();
21 return &environment_; 21 return &environment_;
22 } 22 }
23 23
24 24
25 bool LongJumpScope::IsSafeToJump() { 25 bool LongJumpScope::IsSafeToJump() {
26 // We do not want to jump past Dart frames. Note that this code 26 // We do not want to jump past Dart frames. Note that this code
27 // assumes the stack grows from high to low. 27 // assumes the stack grows from high to low.
28 Thread* thread = Thread::Current(); 28 Thread* thread = Thread::Current();
29 Isolate* isolate = thread->isolate();
29 uword jumpbuf_addr = Isolate::GetCurrentStackPointer(); 30 uword jumpbuf_addr = Isolate::GetCurrentStackPointer();
30 #if defined(USING_SIMULATOR) 31 #if defined(USING_SIMULATOR)
31 Isolate* isolate = thread->isolate();
32 ASSERT(isolate->MutatorThreadIsCurrentThread());
33 uword top_exit_frame_info = isolate->simulator()->top_exit_frame_info(); 32 uword top_exit_frame_info = isolate->simulator()->top_exit_frame_info();
34 #else 33 #else
35 uword top_exit_frame_info = thread->top_exit_frame_info(); 34 uword top_exit_frame_info = thread->top_exit_frame_info();
36 #endif 35 #endif
36 if (!isolate->MutatorThreadIsCurrentThread()) {
37 // A helper thread does not execute Dart code, so it's safe to jump.
38 ASSERT(top_exit_frame_info == 0);
39 return true;
40 }
37 return ((top_exit_frame_info == 0) || (jumpbuf_addr < top_exit_frame_info)); 41 return ((top_exit_frame_info == 0) || (jumpbuf_addr < top_exit_frame_info));
38 } 42 }
39 43
40 44
41 void LongJumpScope::Jump(int value, const Error& error) { 45 void LongJumpScope::Jump(int value, const Error& error) {
42 // A zero is the default return value from setting up a LongJumpScope 46 // A zero is the default return value from setting up a LongJumpScope
43 // using Set. 47 // using Set.
44 ASSERT(value != 0); 48 ASSERT(value != 0);
45 ASSERT(IsSafeToJump()); 49 ASSERT(IsSafeToJump());
46 50
(...skipping 10 matching lines...) Expand all
57 // Remember the error in the sticky error of this isolate. 61 // Remember the error in the sticky error of this isolate.
58 isolate->object_store()->set_sticky_error(error); 62 isolate->object_store()->set_sticky_error(error);
59 63
60 // Destruct all the active StackResource objects. 64 // Destruct all the active StackResource objects.
61 StackResource::UnwindAbove(thread, top_); 65 StackResource::UnwindAbove(thread, top_);
62 longjmp(environment_, value); 66 longjmp(environment_, value);
63 UNREACHABLE(); 67 UNREACHABLE();
64 } 68 }
65 69
66 } // namespace dart 70 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698