Reserve space for the IonCode pointer (no bug, r=dvander)
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 23 Jan 2012 10:35:01 +0100
changeset 105649 66c3c687e1aaac034df67f3350ba8709bcab5ac7
parent 105648 6ba07330f431d6f08ea4bc8ad067e6fee2e4a979
child 105650 ff07f77952625e90c8899a266838a215bd42b55b
push id14706
push usereakhgari@mozilla.com
push dateTue, 11 Sep 2012 20:39:52 +0000
treeherdermozilla-inbound@d50bf1edaabe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Reserve space for the IonCode pointer (no bug, r=dvander)
js/src/ion/IonLinker.h
--- a/js/src/ion/IonLinker.h
+++ b/js/src/ion/IonLinker.h
@@ -71,18 +71,21 @@ class Linker
         size_t bytesNeeded = masm.bytesNeeded() + sizeof(IonCode *) + CodeAlignment;
         if (bytesNeeded >= MAX_BUFFER_SIZE)
             return fail(cx);
 
         uint8 *result = (uint8 *)comp->execAlloc()->alloc(bytesNeeded, &pool, JSC::METHOD_CODE);
         if (!result)
             return fail(cx);
 
+        // The IonCode pointer will be stored right before the code buffer.
+        uint8 *codeStart = result + sizeof(IonCode *);
+
         // Bump the code up to a nice alignment.
-        uint8 *codeStart = (uint8 *)AlignBytes((uintptr_t)result, CodeAlignment);
+        codeStart = (uint8 *)AlignBytes((uintptr_t)codeStart, CodeAlignment);
         uint32 headerSize = codeStart - result;
         IonCode *code = IonCode::New(cx, codeStart,
                                      bytesNeeded - headerSize, pool);
         if (!code)
             return NULL;
         code->copyFrom(masm);
         return code;
     }