OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 GET_NON_NULL_NATIVE_ARGUMENT(Bool, paused, arguments->NativeArgAt(3)); | 220 GET_NON_NULL_NATIVE_ARGUMENT(Bool, paused, arguments->NativeArgAt(3)); |
221 if (closure.IsClosure()) { | 221 if (closure.IsClosure()) { |
222 Function& func = Function::Handle(); | 222 Function& func = Function::Handle(); |
223 func = Closure::function(closure); | 223 func = Closure::function(closure); |
224 if (func.IsImplicitClosureFunction() && func.is_static()) { | 224 if (func.IsImplicitClosureFunction() && func.is_static()) { |
225 #if defined(DEBUG) | 225 #if defined(DEBUG) |
226 Context& ctx = Context::Handle(); | 226 Context& ctx = Context::Handle(); |
227 ctx = Closure::context(closure); | 227 ctx = Closure::context(closure); |
228 ASSERT(ctx.num_variables() == 0); | 228 ASSERT(ctx.num_variables() == 0); |
229 #endif | 229 #endif |
| 230 // Get the parent function so that we get the right function name. |
| 231 func = func.parent_function(); |
230 Spawn(isolate, new IsolateSpawnState(port.Id(), | 232 Spawn(isolate, new IsolateSpawnState(port.Id(), |
231 func, | 233 func, |
232 message, | 234 message, |
233 paused.value())); | 235 paused.value())); |
234 return Object::null(); | 236 return Object::null(); |
235 } | 237 } |
236 } | 238 } |
237 const String& msg = String::Handle(String::New( | 239 const String& msg = String::Handle(String::New( |
238 "Isolate.spawn expects to be passed a static or top-level function")); | 240 "Isolate.spawn expects to be passed a static or top-level function")); |
239 Exceptions::ThrowArgumentError(msg); | 241 Exceptions::ThrowArgumentError(msg); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 MessageWriter writer(&data, &allocator, false); | 302 MessageWriter writer(&data, &allocator, false); |
301 writer.WriteMessage(msg); | 303 writer.WriteMessage(msg); |
302 | 304 |
303 PortMap::PostMessage(new Message(port.Id(), | 305 PortMap::PostMessage(new Message(port.Id(), |
304 data, writer.BytesWritten(), | 306 data, writer.BytesWritten(), |
305 Message::kOOBPriority)); | 307 Message::kOOBPriority)); |
306 return Object::null(); | 308 return Object::null(); |
307 } | 309 } |
308 | 310 |
309 } // namespace dart | 311 } // namespace dart |
OLD | NEW |