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

Unified Diff: vm/dart_api_impl.cc

Issue 11087070: - Get rid of RawClosure class and use RawInstance for closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 2 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
Index: vm/dart_api_impl.cc
===================================================================
--- vm/dart_api_impl.cc (revision 13487)
+++ vm/dart_api_impl.cc (working copy)
@@ -2376,21 +2376,22 @@
// different signature classes for closures.
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- return obj.IsClosure();
+ const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, object);
+ return (!closure_obj.IsNull() && closure_obj.IsClosure());
}
DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- const Closure& closure_obj = Api::UnwrapClosureHandle(isolate, closure);
- if (closure_obj.IsNull()) {
- RETURN_TYPE_ERROR(isolate, closure, Closure);
+ const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure);
+ if (closure_obj.IsNull() || !closure_obj.IsClosure()) {
+ RETURN_TYPE_ERROR(isolate, closure, Instance);
}
+
ASSERT(ClassFinalizer::AllClassesFinalized());
- RawFunction* rf = closure_obj.function();
+ RawFunction* rf = Closure::function(closure_obj);
return Api::NewHandle(isolate, rf);
}
@@ -2400,9 +2401,9 @@
Dart_Handle* arguments) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- const Closure& closure_obj = Api::UnwrapClosureHandle(isolate, closure);
- if (closure_obj.IsNull()) {
- RETURN_TYPE_ERROR(isolate, closure, Closure);
+ const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure);
+ if (closure_obj.IsNull() || !closure_obj.IsClosure()) {
+ RETURN_TYPE_ERROR(isolate, closure, Instance);
}
if (number_of_arguments < 0) {
return Api::NewError(
@@ -2428,26 +2429,6 @@
}
-DART_EXPORT int64_t Dart_ClosureSmrck(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Closure& obj =
- Closure::CheckedHandle(isolate, Api::UnwrapHandle(object));
- const Integer& smrck = Integer::Handle(isolate, obj.smrck());
- return smrck.IsNull() ? 0 : smrck.AsInt64Value();
-}
-
-
-DART_EXPORT void Dart_ClosureSetSmrck(Dart_Handle object, int64_t value) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Closure& obj =
- Closure::CheckedHandle(isolate, Api::UnwrapHandle(object));
- const Integer& smrck = Integer::Handle(isolate, Integer::New(value));
- obj.set_smrck(smrck);
-}
-
-
// --- Classes and Interfaces ---

Powered by Google App Engine
This is Rietveld 408576698