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

Unified Diff: runtime/vm/native_entry.h

Issue 12744006: Added check that the object being stored as a return value in the NativeArguments array is a Dart i… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/vm/native_entry.h
===================================================================
--- runtime/vm/native_entry.h (revision 19851)
+++ runtime/vm/native_entry.h (working copy)
@@ -28,6 +28,15 @@
#define NATIVE_ENTRY_FUNCTION(name) BootstrapNatives::DN_##name
+#ifdef DEBUG
+#define SET_NATIVE_RETVAL(args, value) \
+ RawObject* retval = value; \
+ ASSERT(retval->IsDartInstance()); \
+ arguments->SetReturnUnsafe(retval);
+#else
+#define SET_NATIVE_RETVAL(arguments, value) \
+ arguments->SetReturnUnsafe(value);
+#endif
#define DEFINE_NATIVE_ENTRY(name, argument_count) \
static RawObject* DN_Helper##name(Isolate* isolate, \
@@ -41,8 +50,8 @@
{ \
StackZone zone(arguments->isolate()); \
HANDLESCOPE(arguments->isolate()); \
- arguments->SetReturnUnsafe( \
- DN_Helper##name(arguments->isolate(), arguments)); \
+ SET_NATIVE_RETVAL(arguments, \
+ DN_Helper##name(arguments->isolate(), arguments)); \
if (FLAG_deoptimize_alot) DeoptimizeAll(); \
} \
VERIFY_ON_TRANSITION; \

Powered by Google App Engine
This is Rietveld 408576698