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

Unified Diff: runtime/vm/isolate.h

Issue 9924015: Use the ThreadPool for all isolates and native ports. Previously, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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/isolate.h
===================================================================
--- runtime/vm/isolate.h (revision 6423)
+++ runtime/vm/isolate.h (working copy)
@@ -33,7 +33,6 @@
class StubCode;
class Zone;
-
class Isolate : public BaseIsolate {
public:
~Isolate();
@@ -144,8 +143,7 @@
// value to trigger interrupts.
uword stack_limit() const { return stack_limit_; }
- // The true stack limit for this isolate. This does not change
- // after isolate initialization.
+ // The true stack limit for this isolate.
uword saved_stack_limit() const { return saved_stack_limit_; }
enum {
@@ -161,8 +159,8 @@
MessageHandler* message_handler() const { return message_handler_; }
void set_message_handler(MessageHandler* value) { message_handler_ = value; }
- // Returns null on success, a RawError on failure.
- RawError* StandardRunLoop();
+ uword spawn_data() const { return spawn_data_; }
+ void set_spawn_data(uword value) { spawn_data_ = value; }
intptr_t ast_node_id() const { return ast_node_id_; }
void set_ast_node_id(int value) { ast_node_id_ = value; }
@@ -217,6 +215,7 @@
uword stack_limit_;
uword saved_stack_limit_;
MessageHandler* message_handler_;
+ uword spawn_data_;
GcPrologueCallbacks gc_prologue_callbacks_;
GcEpilogueCallbacks gc_epilogue_callbacks_;
@@ -226,6 +225,53 @@
DISALLOW_COPY_AND_ASSIGN(Isolate);
};
+// When we are starting to execute code in a new isolate, we use the
+// StartIsolateScope.
siva 2012/04/18 22:05:00 It is not necessarily a new isolate right, anytime
turnidge 2012/04/19 19:46:55 Done.
+class StartIsolateScope {
+ public:
+ explicit StartIsolateScope(Isolate* new_isolate)
+ : saved_isolate_(Isolate::Current()) {
+ if (saved_isolate_ != new_isolate) {
+ ASSERT(Isolate::Current() == NULL);
+ Isolate::SetCurrent(new_isolate);
+ new_isolate->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(this));
+ }
+ }
+
+ ~StartIsolateScope() {
siva 2012/04/18 22:05:00 Should we set the stack limit of the isolate we ar
turnidge 2012/04/19 19:46:55 Done. Had to rework ShutdownIsolate a bit in lib/
+ Isolate::SetCurrent(saved_isolate_);
+ }
+
+ private:
+ Isolate* saved_isolate_;
+
+ DISALLOW_COPY_AND_ASSIGN(StartIsolateScope);
+};
+
+// When we need to temporarily become another isolate, we use the
+// SwitchIsolateScope. It is not permitted to run dart code while in
+// a SwitchIsolateScope.
+class SwitchIsolateScope {
+ public:
+ explicit SwitchIsolateScope(Isolate* new_isolate)
+ : saved_isolate_(Isolate::Current()) {
+ Isolate::SetCurrent(new_isolate);
+ if (new_isolate != NULL) {
+ // Don't allow dart code to execute.
+ new_isolate->SetStackLimit(~static_cast<uword>(0));
+ }
+ }
+
+ ~SwitchIsolateScope() {
+ Isolate::SetCurrent(saved_isolate_);
siva 2012/04/18 22:05:00 Shouldn't we be restoring the stack limit of new_i
turnidge 2012/04/19 19:46:55 Done.
+ }
+
+ private:
+ Isolate* saved_isolate_;
+
+ DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope);
+};
+
} // namespace dart
#endif // VM_ISOLATE_H_

Powered by Google App Engine
This is Rietveld 408576698