Unreviewed, rolling out r170605.
[WebKit-https.git] / Source / WebCore / cssjit / StackAllocator.h
index 872118b..10cdbfe 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(CSS_SELECTOR_JIT)
 
-#include "RegisterAllocator.h"
 #include <JavaScriptCore/MacroAssembler.h>
 
 namespace WebCore {
@@ -69,11 +68,14 @@ public:
         return StackReference(m_offsetFromTop);
     }
 
-    void push(Vector<StackReference, registerCount>& stackReferences, const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
+    Vector<StackReference> push(const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
     {
         RELEASE_ASSERT(!m_hasFunctionCallPadding);
+        unsigned registerCount = registerIDs.size();
+        Vector<StackReference> stackReferences;
+        stackReferences.reserveInitialCapacity(registerCount);
 #if CPU(ARM64)
-        for (unsigned i = 0; i < registerIDs.size() - 1; i += 2) {
+        for (unsigned i = 0; i < registerCount - 1; i += 2) {
             m_assembler.pushPair(registerIDs[i + 1], registerIDs[i]);
             m_offsetFromTop += stackUnitInBytes();
             stackReferences.append(StackReference(m_offsetFromTop - stackUnitInBytes() / 2));
@@ -85,6 +87,7 @@ public:
         for (auto registerID : registerIDs)
             stackReferences.append(push(registerID));
 #endif
+        return stackReferences;
     }
 
     StackReference push(JSC::MacroAssembler::RegisterID registerID)