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

Unified Diff: runtime/vm/stack_frame.cc

Issue 354063004: Allow StackFrameIterator to be used on a different thread than the isolate whose stack frames are b… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/stack_frame.cc
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index 45637246dc0d5ea2e03709a905e2fd553ac6a26c..ee6cd13f4868ef44bce38bb275c1c741c457d736 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -28,6 +28,7 @@ bool StackFrame::IsStubFrame() const {
const char* StackFrame::ToCString() const {
+ ASSERT(isolate_ == Isolate::Current());
Zone* zone = Isolate::Current()->current_zone();
if (IsDartFrame()) {
const Code& code = Code::Handle(LookupDartCode());
@@ -66,6 +67,7 @@ RawContext* EntryFrame::SavedContext() const {
void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
+ ASSERT(isolate() == Isolate::Current());
// Visit objects between SP and (FP - callee_save_area).
ASSERT(visitor != NULL);
RawObject** first = reinterpret_cast<RawObject**>(sp());
@@ -82,6 +84,7 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
// these handles are not traversed. The use of handles is mainly to
// be able to reuse the handle based code and avoid having to add
// helper functions to the raw object interface.
+ ASSERT(isolate_ == Isolate::Current());
ASSERT(visitor != NULL);
NoGCScope no_gc;
Code code;
@@ -159,6 +162,7 @@ void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
RawFunction* StackFrame::LookupDartFunction() const {
+ ASSERT(isolate_ == Isolate::Current());
const Code& code = Code::Handle(LookupDartCode());
if (!code.IsNull()) {
return code.function();
@@ -168,6 +172,7 @@ RawFunction* StackFrame::LookupDartFunction() const {
RawCode* StackFrame::LookupDartCode() const {
+ ASSERT(isolate_ == Isolate::Current());
// We add a no gc scope to ensure that the code below does not trigger
// a GC as we are handling raw object references here. It is possible
// that the code is called while a GC is in progress, that is ok.
@@ -278,14 +283,35 @@ void StackFrameIterator::SetupNextExitFrameData() {
}
-StackFrameIterator::StackFrameIterator(bool validate)
- : validate_(validate), entry_(), exit_(), current_frame_(NULL) {
+StackFrameIterator::StackFrameIterator(bool validate, Isolate* isolate)
+ : validate_(validate),
+ entry_(isolate),
+ exit_(isolate),
+ frames_(isolate),
+ current_frame_(NULL),
+ isolate_(isolate) {
+#if !defined(TARGET_OS_WINDOWS)
+ // On Windows, the call to InInvocationStub may be called from the thread
+ // suspender.
siva 2014/06/30 23:26:44 This comment I feel should be more detailed explai
Cutch 2014/07/01 14:26:09 Done.
+ ASSERT(isolate_ == Isolate::Current());
+#endif
siva 2014/06/30 23:26:44 The #ifdef looks weird here, maybe you could code
Cutch 2014/07/01 14:26:09 Done.
SetupLastExitFrameData(); // Setup data for last exit frame.
}
-StackFrameIterator::StackFrameIterator(uword last_fp, bool validate)
- : validate_(validate), entry_(), exit_(), current_frame_(NULL) {
+StackFrameIterator::StackFrameIterator(uword last_fp, bool validate,
+ Isolate* isolate)
+ : validate_(validate),
+ entry_(isolate),
+ exit_(isolate),
+ frames_(isolate),
+ current_frame_(NULL),
+ isolate_(isolate) {
+#if !defined(TARGET_OS_WINDOWS)
+ // On Windows, the call to InInvocationStub may be called from the thread
+ // suspender.
+ ASSERT(isolate_ == Isolate::Current());
+#endif
frames_.fp_ = last_fp;
frames_.sp_ = 0;
frames_.pc_ = 0;
@@ -293,8 +319,18 @@ StackFrameIterator::StackFrameIterator(uword last_fp, bool validate)
StackFrameIterator::StackFrameIterator(uword fp, uword sp, uword pc,
- bool validate)
- : validate_(validate), entry_(), exit_(), current_frame_(NULL) {
+ bool validate, Isolate* isolate)
+ : validate_(validate),
+ entry_(isolate),
+ exit_(isolate),
+ frames_(isolate),
+ current_frame_(NULL),
+ isolate_(isolate) {
+#if !defined(TARGET_OS_WINDOWS)
+ // On Windows, the call to InInvocationStub may be called from the thread
+ // suspender.
+ ASSERT(isolate_ == Isolate::Current());
+#endif
frames_.fp_ = fp;
frames_.sp_ = sp;
frames_.pc_ = pc;
« runtime/vm/stack_frame.h ('K') | « runtime/vm/stack_frame.h ('k') | runtime/vm/stub_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698