From c93cd8301ea57269ba5bf9d632a72b96b6bc9737 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 25 Nov 2011 17:09:06 -0800 Subject: [PATCH] Bug 692342 - Introduce deprecated_IsPointer() to handle the cases that are too mucky to figure out right now. r=mrbkap --- js/xpconnect/src/XPCWrappedJSClass.cpp | 8 ++++---- xpcom/reflect/xptinfo/public/xptinfo.h | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 681361b60589..7cbd41aeb7be 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -1471,7 +1471,7 @@ pre_call_clean_up: continue; const nsXPTType& type = param.GetType(); - if (!type.IsPointer()) + if (!type.deprecated_IsPointer()) continue; void* p; if (!(p = nativeParams[i].val.p)) @@ -1488,7 +1488,7 @@ pre_call_clean_up: if (NS_SUCCEEDED(mInfo->GetTypeForParam(methodIndex, ¶m, 1, &datum_type)) && - datum_type.IsPointer() && + datum_type.deprecated_IsPointer() && GetArraySizeFromParam(cx, info, param, methodIndex, i, nativeParams, &array_count) && array_count) { @@ -1700,7 +1700,7 @@ pre_call_clean_up: if (!param.IsOut()) continue; const nsXPTType& type = param.GetType(); - if (!type.IsPointer()) + if (!type.deprecated_IsPointer()) continue; void* p; if (!(p = nativeParams[k].val.p)) @@ -1715,7 +1715,7 @@ pre_call_clean_up: if (NS_SUCCEEDED(mInfo->GetTypeForParam(methodIndex, ¶m, 1, &datum_type)) && - datum_type.IsPointer() && + datum_type.deprecated_IsPointer() && GetArraySizeFromParam(cx, info, param, methodIndex, k, nativeParams, &array_count) && array_count) { diff --git a/xpcom/reflect/xptinfo/public/xptinfo.h b/xpcom/reflect/xptinfo/public/xptinfo.h index 387c191a21fa..d5536558f376 100644 --- a/xpcom/reflect/xptinfo/public/xptinfo.h +++ b/xpcom/reflect/xptinfo/public/xptinfo.h @@ -77,9 +77,24 @@ public: bool IsReference() const {return 0 != (XPT_TDP_IS_REFERENCE(flags));} - bool IsArithmetic() const // terminology from Harbison/Steele + // 'Arithmetic' here roughly means that the value is self-contained and + // doesn't depend on anything else in memory (ie: not a pointer, not an + // XPCOM object, not a jsval, etc). + // + // Supposedly this terminology comes from Harbison/Steele, but it's still + // a rather crappy name. We'd change it if it wasn't used all over the + // place in xptcall. :-( + bool IsArithmetic() const {return flags <= T_WCHAR;} + // We used to abuse 'pointer' flag bit in typelib format quite extensively. + // We've gotten rid of most of the cases, but there's still a fair amount + // of refactoring to be done in XPCWrappedJSClass before we can safely stop + // asking about this. In the mean time, we've got a temporary version of + // IsPointer() that should be equivalent to what's in the typelib. + bool deprecated_IsPointer() const + {return !IsArithmetic() && TagPart() != T_JSVAL;} + bool IsInterfacePointer() const { switch (TagPart()) { default: