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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 10800065: Added ClosureMirror to dart:mirrors. Added Dart_ClosureFunction to the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) { 2384 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) {
2385 // We can't use a fast class index check here because there are many 2385 // We can't use a fast class index check here because there are many
2386 // different signature classes for closures. 2386 // different signature classes for closures.
2387 Isolate* isolate = Isolate::Current(); 2387 Isolate* isolate = Isolate::Current();
2388 DARTSCOPE(isolate); 2388 DARTSCOPE(isolate);
2389 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); 2389 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
2390 return obj.IsClosure(); 2390 return obj.IsClosure();
2391 } 2391 }
2392 2392
2393 2393
2394 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) {
2395 Isolate* isolate = Isolate::Current();
2396 DARTSCOPE(isolate);
2397 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(closure));
2398 if (obj.IsNull()) {
2399 return Api::NewError("Null object passed to Dart_ClosureFunction");
2400 }
2401 if (!obj.IsClosure()) {
2402 return Api::NewError("Invalid closure passed to Dart_ClosureFunction");
2403 }
2404 ASSERT(ClassFinalizer::AllClassesFinalized());
2405
2406 const Closure& closure_obj = Closure::Cast(obj);
2407 RawFunction* rf = closure_obj.function();
2408 return Api::NewHandle(isolate, rf);
2409 }
2410
2411
2394 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, 2412 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure,
2395 int number_of_arguments, 2413 int number_of_arguments,
2396 Dart_Handle* arguments) { 2414 Dart_Handle* arguments) {
2397 Isolate* isolate = Isolate::Current(); 2415 Isolate* isolate = Isolate::Current();
2398 DARTSCOPE(isolate); 2416 DARTSCOPE(isolate);
2399 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(closure)); 2417 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(closure));
2400 if (obj.IsNull()) { 2418 if (obj.IsNull()) {
2401 return Api::NewError("Null object passed in to invoke closure"); 2419 return Api::NewError("Null object passed in to invoke closure");
2402 } 2420 }
2403 if (!obj.IsClosure()) { 2421 if (!obj.IsClosure()) {
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
4149 *buffer_size = 0; 4167 *buffer_size = 0;
4150 } 4168 }
4151 } 4169 }
4152 4170
4153 4171
4154 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { 4172 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) {
4155 Dart::set_flow_graph_writer(function); 4173 Dart::set_flow_graph_writer(function);
4156 } 4174 }
4157 4175
4158 } // namespace dart 4176 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698