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

Unified Diff: runtime/lib/isolate.cc

Issue 9693051: Add type checking to some native function arguments (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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: runtime/lib/isolate.cc
===================================================================
--- runtime/lib/isolate.cc (revision 5412)
+++ runtime/lib/isolate.cc (working copy)
@@ -257,7 +257,7 @@
DEFINE_NATIVE_ENTRY(IsolateNatives_start, 2) {
Isolate* preserved_isolate = Isolate::Current();
- const Instance& runnable = Instance::CheckedHandle(arguments->At(0));
+ GET_NATIVE_ARGUMENT(Instance, runnable, arguments->At(0));
Ivan Posva 2012/03/13 18:19:53 Please make a note that the second argument is ign
const Class& runnable_class = Class::Handle(runnable.clazz());
const char* class_name = String::Handle(runnable_class.Name()).ToCString();
const Library& library = Library::Handle(runnable_class.library());
@@ -341,20 +341,21 @@
DEFINE_NATIVE_ENTRY(ReceivePortImpl_closeInternal, 1) {
- intptr_t id = Smi::CheckedHandle(arguments->At(0)).Value();
- PortMap::ClosePort(id);
+ GET_NATIVE_ARGUMENT(Smi, id, arguments->At(0));
+ PortMap::ClosePort(id.Value());
}
DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 3) {
- intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value();
- intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value();
+ GET_NATIVE_ARGUMENT(Smi, send_id, arguments->At(0));
+ GET_NATIVE_ARGUMENT(Smi, reply_id, arguments->At(1));
// TODO(iposva): Allow for arbitrary messages to be sent.
- uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2)));
+ GET_NATIVE_ARGUMENT(Instance, obj, arguments->At(2));
+ uint8_t* data = SerializeObject(obj);
// TODO(turnidge): Throw an exception when the return value is false?
PortMap::PostMessage(new Message(
- send_id, reply_id, data, Message::kNormalPriority));
+ send_id.Value(), reply_id.Value(), data, Message::kNormalPriority));
}
} // namespace dart
« runtime/lib/date.cc ('K') | « runtime/lib/error.cc ('k') | runtime/lib/string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698