OLD | NEW |
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/message.h" | 5 #include "vm/message.h" |
6 | 6 |
7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
8 #include "vm/json_stream.h" | 8 #include "vm/json_stream.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/port.h" | 10 #include "vm/port.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 intptr_t depth = 0; | 189 intptr_t depth = 0; |
190 while (it.HasNext()) { | 190 while (it.HasNext()) { |
191 Message* current = it.Next(); | 191 Message* current = it.Next(); |
192 JSONObject message(&messages); | 192 JSONObject message(&messages); |
193 message.AddProperty("type", "Message"); | 193 message.AddProperty("type", "Message"); |
194 message.AddPropertyF("name", "Isolate Message (%" Px ")", current->Id()); | 194 message.AddPropertyF("name", "Isolate Message (%" Px ")", current->Id()); |
195 message.AddPropertyF("messageObjectId", "messages/%" Px "", | 195 message.AddPropertyF("messageObjectId", "messages/%" Px "", |
196 current->Id()); | 196 current->Id()); |
197 message.AddProperty("size", current->len()); | 197 message.AddProperty("size", current->len()); |
198 message.AddProperty("index", depth++); | 198 message.AddProperty("index", depth++); |
199 message.AddProperty("_destinationPort", | 199 message.AddPropertyF("_destinationPort", "%" Pd64 "", |
200 static_cast<intptr_t>(current->dest_port())); | 200 static_cast<int64_t>(current->dest_port())); |
201 message.AddProperty("_priority", | 201 message.AddProperty("_priority", |
202 Message::PriorityAsString(current->priority())); | 202 Message::PriorityAsString(current->priority())); |
203 // TODO(johnmccutchan): Move port -> handler map out of Dart and into the | 203 // TODO(johnmccutchan): Move port -> handler map out of Dart and into the |
204 // VM, that way we can lookup the handler without invoking Dart code. | 204 // VM, that way we can lookup the handler without invoking Dart code. |
205 msg_handler = DartLibraryCalls::LookupHandler(current->dest_port()); | 205 msg_handler = DartLibraryCalls::LookupHandler(current->dest_port()); |
206 if (msg_handler.IsInstance() && Instance::Cast(msg_handler).IsClosure()) { | 206 if (msg_handler.IsInstance() && Instance::Cast(msg_handler).IsClosure()) { |
207 // Grab function from closure. | 207 // Grab function from closure. |
208 msg_handler = Closure::function(Instance::Cast(msg_handler)); | 208 msg_handler = Closure::function(Instance::Cast(msg_handler)); |
209 } | 209 } |
210 if (msg_handler.IsFunction()) { | 210 if (msg_handler.IsFunction()) { |
211 const Function& function = Function::Cast(msg_handler); | 211 const Function& function = Function::Cast(msg_handler); |
212 message.AddProperty("handler", function); | 212 message.AddProperty("handler", function); |
213 | 213 |
214 const Script& script = Script::Handle(function.script()); | 214 const Script& script = Script::Handle(function.script()); |
215 if (!script.IsNull()) { | 215 if (!script.IsNull()) { |
216 message.AddLocation(script, function.token_pos(), | 216 message.AddLocation(script, function.token_pos(), |
217 function.end_token_pos()); | 217 function.end_token_pos()); |
218 } | 218 } |
219 } | 219 } |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 } // namespace dart | 223 } // namespace dart |
OLD | NEW |