Prepare css jit for arm64 and other architectures.
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 May 2014 00:25:25 +0000 (00:25 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 May 2014 00:25:25 +0000 (00:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133394

Reviewed by Benjamin Poulain.

* cssjit/FunctionCall.h:
(WebCore::FunctionCall::swapArguments):
* cssjit/RegisterAllocator.h:
Use a designated temporary register on arm64 to prevent using a deallocated argument register to swap argument registers in.
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
Added assertion to make sure there are enough registers.

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

Source/WebCore/ChangeLog
Source/WebCore/cssjit/FunctionCall.h
Source/WebCore/cssjit/RegisterAllocator.h
Source/WebCore/cssjit/SelectorCompiler.cpp

index c6cb44e..e4ae905 100644 (file)
@@ -1,3 +1,18 @@
+2014-05-29  Alex Christensen  <achristensen@webkit.org>
+
+        Prepare css jit for arm64 and other architectures.
+        https://bugs.webkit.org/show_bug.cgi?id=133394
+
+        Reviewed by Benjamin Poulain.
+
+        * cssjit/FunctionCall.h:
+        (WebCore::FunctionCall::swapArguments):
+        * cssjit/RegisterAllocator.h:
+        Use a designated temporary register on arm64 to prevent using a deallocated argument register to swap argument registers in.
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
+        Added assertion to make sure there are enough registers.
+
 2014-05-29  Benjamin Poulain  <benjamin@webkit.org>
 
         CSS JIT: add support for the pseudo classes :hover and :active
index 976a300..1ba345c 100644 (file)
@@ -88,9 +88,14 @@ private:
         // x86 can swap without a temporary register. On other architectures, we need allocate a temporary register to switch the values.
 #if CPU(X86) || CPU(X86_64)
         m_assembler.swap(a, b);
+#elif CPU(ARM64)
+        m_assembler.move(a, tempRegister);
+        m_assembler.move(b, a);
+        m_assembler.move(tempRegister, b);
 #else
         if (m_registerAllocator.availableRegisterCount()) {
             // Usually we can just use a free register.
+            // FIXME: We need to make sure that tempValue is not a or b.
             LocalRegister tempValue(m_registerAllocator);
             m_assembler.move(a, tempValue);
             m_assembler.move(b, a);
index 40d255b..9d0eb03 100644 (file)
@@ -51,11 +51,11 @@ static const JSC::MacroAssembler::RegisterID callerSavedRegisters[] = {
     JSC::ARM64Registers::x12,
     JSC::ARM64Registers::x13,
     JSC::ARM64Registers::x14,
-    JSC::ARM64Registers::x15,
 };
 static const JSC::MacroAssembler::RegisterID calleeSavedRegisters[] = {
     JSC::ARM64Registers::x19
 };
+static const JSC::MacroAssembler::RegisterID tempRegister = JSC::ARM64Registers::x15;
 #elif CPU(X86_64)
 static const JSC::MacroAssembler::RegisterID callerSavedRegisters[] = {
     JSC::X86Registers::eax,
index d771a4e..725c496 100644 (file)
@@ -985,6 +985,7 @@ void SelectorCodeGenerator::generateSelectorChecker()
     bool reservedCalleeSavedRegisters = false;
     unsigned availableRegisterCount = m_registerAllocator.availableRegisterCount();
     unsigned minimumRegisterCountForAttributes = minimumRegisterRequirements(m_selectorFragments);
+    ASSERT(minimumRegisterCountForAttributes <= registerCount);
     if (availableRegisterCount < minimumRegisterCountForAttributes) {
         reservedCalleeSavedRegisters = true;
         calleeSavedRegisterStackReferences = m_stackAllocator.push(m_registerAllocator.reserveCalleeSavedRegisters(minimumRegisterCountForAttributes - availableRegisterCount));