Bug 843733 part 2 - Use IonAllocPolicy allocator instead of the system one. r=mjronseb
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Mon, 04 Mar 2013 23:17:09 -0800
changeset 123877 edcb3f098cceee6263e4fec3a9b3c327dc65951b
parent 123876 db2af0e84527a85607b7fe03c364441ccfaad516
child 123878 15aea6ea0f6dbadd21946c4c541ef3eac47aa149
push id1401
push userpastithas@mozilla.com
push dateThu, 07 Mar 2013 07:26:45 +0000
treeherderfx-team@ee4879719f78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjronseb
bugs843733
milestone22.0a1
Bug 843733 part 2 - Use IonAllocPolicy allocator instead of the system one. r=mjronseb
js/src/ion/shared/IonAssemblerBufferWithConstantPools.h
--- a/js/src/ion/shared/IonAssemblerBufferWithConstantPools.h
+++ b/js/src/ion/shared/IonAssemblerBufferWithConstantPools.h
@@ -143,20 +143,24 @@ struct Pool
     }
 
     bool reset() {
         numEntries = 0;
         buffSize = 8;
         poolData = static_cast<uint8_t*>(malloc_(buffSize * immSize));
         if (poolData == NULL)
             return false;
-        other = new Pool(other->maxOffset, other->immSize, other->instSize, other->bias,
-                         other->alignment, other->isBackref, other->canDedup);
-        if (other == NULL)
+
+        void *otherSpace = malloc_(sizeof(Pool));
+        if (otherSpace == NULL)
             return false;
+
+        other = new (otherSpace) Pool(other->maxOffset, other->immSize, other->instSize,
+                                      other->bias, other->alignment, other->isBackref,
+                                      other->canDedup);
         new (&loadOffsets) LoadOffsets;
 
         limitingUser = BufferOffset();
         limitingUsee = -1;
         return true;
 
     }
     // WARNING: This will not always align values. It will only