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

Unified Diff: runtime/vm/native_entry.h

Issue 8476002: Fix more co19 crashes. Introduce GET_NATIVE_ARGUMENT that throws an illegal argument exception if... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/string.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/native_entry.h
===================================================================
--- runtime/vm/native_entry.h (revision 1200)
+++ runtime/vm/native_entry.h (working copy)
@@ -52,7 +52,22 @@
#define DECLARE_NATIVE_ENTRY(name, argument_count) \
extern void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments arguments);
+// Natives should throw an exception if an illegal argument is passed.
+// type name = value.
+#define GET_NATIVE_ARGUMENT(type, name, value) \
+ type& name = type::Handle(); \
+ { \
+ const Instance& __instance__ = Instance::CheckedHandle(value); \
+ if (!__instance__.Is##type()) { \
+ GrowableArray<const Object*> __args__; \
+ __args__.Add(&__instance__); \
+ Exceptions::ThrowByType(Exceptions::kIllegalArgument, __args__); \
+ } \
+ name ^= __instance__.raw(); \
+ }
+
+
// Helper class for resolving and handling native functions.
class NativeEntry : public AllStatic {
public:
« no previous file with comments | « runtime/lib/string.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698