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

Side by Side Diff: runtime/lib/isolate.cc

Issue 73893004: Revert "Fix VM not accepting static methods for Isolate.spawn." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return port.raw(); 213 return port.raw();
214 } 214 }
215 215
216 216
217 DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 1) { 217 DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 1) {
218 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); 218 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
219 bool throw_exception = false; 219 bool throw_exception = false;
220 Function& func = Function::Handle(); 220 Function& func = Function::Handle();
221 if (closure.IsClosure()) { 221 if (closure.IsClosure()) {
222 func = Closure::function(closure); 222 func = Closure::function(closure);
223 if (!(func.IsImplicitClosureFunction() && func.is_static())) { 223 const Class& cls = Class::Handle(func.Owner());
224 if (!func.IsClosureFunction() || !func.is_static() || !cls.IsTopLevel()) {
224 throw_exception = true; 225 throw_exception = true;
225 } 226 }
226 } else { 227 } else {
227 throw_exception = true; 228 throw_exception = true;
228 } 229 }
229 if (throw_exception) { 230 if (throw_exception) {
230 const String& msg = String::Handle(String::New( 231 const String& msg = String::Handle(String::New(
231 "Isolate.spawn expects to be passed a static or top-level function")); 232 "Isolate.spawn expects to be passed a top-level function"));
232 Exceptions::ThrowArgumentError(msg); 233 Exceptions::ThrowArgumentError(msg);
233 } 234 }
234 235
235 #if defined(DEBUG) 236 #if defined(DEBUG)
236 Context& ctx = Context::Handle(); 237 Context& ctx = Context::Handle();
237 ctx = Closure::context(closure); 238 ctx = Closure::context(closure);
238 ASSERT(ctx.num_variables() == 0); 239 ASSERT(ctx.num_variables() == 0);
239 #endif 240 #endif
240 241
241 return Spawn(arguments, new IsolateSpawnState(func)); 242 return Spawn(arguments, new IsolateSpawnState(func));
(...skipping 26 matching lines...) Expand all
268 269
269 // The control port is being accessed as a regular port from Dart code. This 270 // The control port is being accessed as a regular port from Dart code. This
270 // is most likely due to the _startIsolate code in dart:isolate. Account for 271 // is most likely due to the _startIsolate code in dart:isolate. Account for
271 // this by increasing the number of open control ports. 272 // this by increasing the number of open control ports.
272 isolate->message_handler()->increment_control_ports(); 273 isolate->message_handler()->increment_control_ports();
273 274
274 return port.raw(); 275 return port.raw();
275 } 276 }
276 277
277 } // namespace dart 278 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698