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

Unified Diff: runtime/vm/code_generator.cc

Issue 9420038: Heartbeat implementation of dart:mirrors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « runtime/vm/bootstrap_nocorelib.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 5107)
+++ runtime/vm/code_generator.cc (working copy)
@@ -12,6 +12,7 @@
#include "vm/debugger.h"
#include "vm/exceptions.h"
#include "vm/object_store.h"
+#include "vm/message.h"
#include "vm/resolver.h"
#include "vm/runtime_entry.h"
#include "vm/stack_frame.h"
@@ -1127,6 +1128,20 @@
}
+static RawInstance* DeserializeMessage(void* data) {
+ // Create a snapshot object using the buffer.
+ const Snapshot* snapshot = Snapshot::SetupFromBuffer(data);
+ ASSERT(snapshot->IsMessageSnapshot());
+
+ // Read object back from the snapshot.
+ SnapshotReader reader(snapshot, Isolate::Current());
+ Instance& instance = Instance::Handle();
+ instance ^= reader.ReadObject();
+ return instance.raw();
+}
+
+
+
DEFINE_RUNTIME_ENTRY(StackOverflow, 0) {
ASSERT(arguments.Count() ==
kStackOverflowRuntimeEntry.argument_count());
@@ -1145,7 +1160,28 @@
uword interrupt_bits = isolate->GetAndClearInterrupts();
if (interrupt_bits & Isolate::kMessageInterrupt) {
- // UNIMPLEMENTED();
+ while (true) {
+ // TODO(turnidge): This code is duplicated elsewhere. Consolidate.
+ Message* message =
+ isolate->message_handler()->queue()->DequeueNoWaitWithPriority(
+ Message::kOOBPriority);
+ if (message == NULL) {
+ // No more OOB messages to handle.
+ break;
+ }
+ const Instance& msg =
+ Instance::Handle(DeserializeMessage(message->data()));
+ // For now the only OOB messages are Mirrors messages.
+ const Object& result = Object::Handle(
+ DartLibraryCalls::HandleMirrorsMessage(
+ message->dest_port(), message->reply_port(), msg));
+ delete message;
+ if (result.IsError()) {
+ // TODO(turnidge): Propagating the error is probably wrong here.
+ Exceptions::PropagateError(result);
+ }
+ ASSERT(result.IsNull());
+ }
}
if (interrupt_bits & Isolate::kApiInterrupt) {
Dart_IsolateInterruptCallback callback = isolate->InterruptCallback();
« no previous file with comments | « runtime/vm/bootstrap_nocorelib.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698