CodeBlock::m_numCalleeRegisters need to honor native stack alignment.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Nov 2013 03:12:13 +0000 (03:12 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Nov 2013 03:12:13 +0000 (03:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124754.

Reviewed by Filip Pizlo.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::newRegister):
* dfg/DFGVirtualRegisterAllocationPhase.cpp:
(JSC::DFG::VirtualRegisterAllocationPhase::run):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159670 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp

index c79dd9b..22d79ed 100644 (file)
@@ -1,3 +1,15 @@
+2013-11-21  Mark Lam  <mark.lam@apple.com>
+
+        CodeBlock::m_numCalleeRegisters need to honor native stack alignment.
+        https://bugs.webkit.org/show_bug.cgi?id=124754.
+
+        Reviewed by Filip Pizlo.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::newRegister):
+        * dfg/DFGVirtualRegisterAllocationPhase.cpp:
+        (JSC::DFG::VirtualRegisterAllocationPhase::run):
+
 2013-11-21  Mark Rowe  <mrowe@apple.com>
 
         <https://webkit.org/b/124702> Stop overriding VALID_ARCHS.
index 2dfe493..9f2eb17 100644 (file)
@@ -38,6 +38,7 @@
 #include "LowLevelInterpreter.h"
 #include "Operations.h"
 #include "Options.h"
+#include "StackAlignment.h"
 #include "StrongInlines.h"
 #include "UnlinkedCodeBlock.h"
 #include <wtf/StdLibExtras.h>
@@ -545,7 +546,9 @@ RegisterID* BytecodeGenerator::createLazyRegisterIfNecessary(RegisterID* reg)
 RegisterID* BytecodeGenerator::newRegister()
 {
     m_calleeRegisters.append(virtualRegisterForLocal(m_calleeRegisters.size()));
-    m_codeBlock->m_numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size());
+    int numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size());
+    numCalleeRegisters = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numCalleeRegisters);
+    m_codeBlock->m_numCalleeRegisters = numCalleeRegisters;
     return &m_calleeRegisters.last();
 }
 
index 321e394..5260c92 100644 (file)
@@ -31,6 +31,8 @@
 #include "DFGGraph.h"
 #include "DFGScoreBoard.h"
 #include "JSCellInlines.h"
+#include "StackAlignment.h"
+#include <wtf/StdLibExtras.h>
 
 namespace JSC { namespace DFG {
 
@@ -132,6 +134,7 @@ public:
             if (requiredCalleeRegisters > calleeRegisters)
                 calleeRegisters = requiredCalleeRegisters;
         }
+        calleeRegisters = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), calleeRegisters);
         if ((unsigned)codeBlock()->m_numCalleeRegisters < calleeRegisters)
             codeBlock()->m_numCalleeRegisters = calleeRegisters;
 #if DFG_ENABLE(DEBUG_VERBOSE)