Bug 1311748: Remove extra pointer dereference from MainThreadHandoff::FixArrayElements; r?jimm draft
authorAaron Klotz <aklotz@mozilla.com>
Thu, 03 Nov 2016 11:25:26 -0600
changeset 433481 2fd096140370a618ad4e41a0f0fbe3d157798896
parent 433377 6fd8c03b5a25cd47ea0777f740bf931a9ff5eae2
child 433482 58e83cad970713ec59632b0d54153a60c00220c2
child 434981 a652622a33ddee7f85615e1073ab16ee117c7c53
push id34601
push useraklotz@mozilla.com
push dateThu, 03 Nov 2016 20:22:47 +0000
reviewersjimm
bugs1311748
milestone52.0a1
Bug 1311748: Remove extra pointer dereference from MainThreadHandoff::FixArrayElements; r?jimm MozReview-Commit-ID: 2hLgQ1km07J
ipc/mscom/MainThreadHandoff.cpp
--- a/ipc/mscom/MainThreadHandoff.cpp
+++ b/ipc/mscom/MainThreadHandoff.cpp
@@ -253,21 +253,20 @@ MainThreadHandoff::FixArrayElements(ICal
     // ICallFrame::GetParam is not able to coerce the param into a VARIANT.
     // That's ok, we can try to do it ourselves.
     CALLFRAMEPARAMINFO paramInfo;
     hr = aFrame->GetParamInfo(aArrayData.mArrayParamIndex, &paramInfo);
     if (FAILED(hr)) {
       return hr;
     }
     PVOID stackBase = aFrame->GetStackLocation();
-    // We dereference twice because we need to obtain the value of a parameter
-    // from a stack offset (one), and since that is an outparam, we need to
-    // find the value that is actually being returned (two).
-    arrayPtr = **reinterpret_cast<PVOID**>(reinterpret_cast<PBYTE>(stackBase) +
-                                           paramInfo.stackOffset);
+    // We dereference because we need to obtain the value of a parameter
+    // from a stack offset. This pointer is the base of the array.
+    arrayPtr = *reinterpret_cast<PVOID*>(reinterpret_cast<PBYTE>(stackBase) +
+                                         paramInfo.stackOffset);
   } else if (FAILED(hr)) {
     return hr;
   } else {
     arrayPtr = ResolveArrayPtr(paramVal);
   }
 
   MOZ_ASSERT(arrayPtr);
   if (!arrayPtr) {