- Revision
- 170714
- Author
- [email protected]
- Date
- 2014-07-02 12:48:16 -0700 (Wed, 02 Jul 2014)
Log Message
WebCore JIT: rename registerCount to something less generic and add new types for lists of registers and lists of stack references
https://bugs.webkit.org/show_bug.cgi?id=134552
Reviewed by Alex Christensen.
Little cleanup:
-The name registerCount was a little too generic. Rename that to "maximumRegisterCount" to avoid confusion.
-Add a new type RegisterVector for any vector holding registers. This is just to avoid repeating the inline
size everywhere, no functional change.
-Same idea for the stack: welcome StackReferenceVector!
* cssjit/FunctionCall.h:
(WebCore::FunctionCall::saveAllocatedCallerSavedRegisters):
Remove the appendVector here. It was unnecessarily cautious, StackAllocator already protect us
from mistakes.
* cssjit/RegisterAllocator.h:
(WebCore::RegisterAllocator::allocatedRegisters):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
Changing from the count of "calleeSavedRegisterCount" to "maximumRegisterCount" will cause
calleeSavedRegisterStackReferences to always overallocate.
The code generator is never on the heap, so that should not change anything.
* cssjit/StackAllocator.h:
(WebCore::StackAllocator::push):
(WebCore::StackAllocator::pop):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170713 => 170714)
--- trunk/Source/WebCore/ChangeLog 2014-07-02 19:40:52 UTC (rev 170713)
+++ trunk/Source/WebCore/ChangeLog 2014-07-02 19:48:16 UTC (rev 170714)
@@ -1,3 +1,33 @@
+2014-07-02 Benjamin Poulain <[email protected]>
+
+ WebCore JIT: rename registerCount to something less generic and add new types for lists of registers and lists of stack references
+ https://bugs.webkit.org/show_bug.cgi?id=134552
+
+ Reviewed by Alex Christensen.
+
+ Little cleanup:
+ -The name registerCount was a little too generic. Rename that to "maximumRegisterCount" to avoid confusion.
+ -Add a new type RegisterVector for any vector holding registers. This is just to avoid repeating the inline
+ size everywhere, no functional change.
+ -Same idea for the stack: welcome StackReferenceVector!
+
+ * cssjit/FunctionCall.h:
+ (WebCore::FunctionCall::saveAllocatedCallerSavedRegisters):
+ Remove the appendVector here. It was unnecessarily cautious, StackAllocator already protect us
+ from mistakes.
+
+ * cssjit/RegisterAllocator.h:
+ (WebCore::RegisterAllocator::allocatedRegisters):
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
+ Changing from the count of "calleeSavedRegisterCount" to "maximumRegisterCount" will cause
+ calleeSavedRegisterStackReferences to always overallocate.
+ The code generator is never on the heap, so that should not change anything.
+
+ * cssjit/StackAllocator.h:
+ (WebCore::StackAllocator::push):
+ (WebCore::StackAllocator::pop):
+
2014-07-02 Dan Bernstein <[email protected]>
Remove some code only needed for versions of Safari that are no longer supported
Modified: trunk/Source/WebCore/cssjit/FunctionCall.h (170713 => 170714)
--- trunk/Source/WebCore/cssjit/FunctionCall.h 2014-07-02 19:40:52 UTC (rev 170713)
+++ trunk/Source/WebCore/cssjit/FunctionCall.h 2014-07-02 19:48:16 UTC (rev 170714)
@@ -162,13 +162,12 @@
{
ASSERT(m_savedRegisterStackReferences.isEmpty());
ASSERT(m_savedRegisters.isEmpty());
- const Vector<JSC::MacroAssembler::RegisterID, registerCount>& allocatedRegisters = m_registerAllocator.allocatedRegisters();
+ const RegisterVector& allocatedRegisters = m_registerAllocator.allocatedRegisters();
for (auto registerID : allocatedRegisters) {
if (RegisterAllocator::isCallerSavedRegister(registerID))
m_savedRegisters.append(registerID);
}
- Vector<StackAllocator::StackReference, registerCount> stackReferences = m_stackAllocator.push(m_savedRegisters);
- m_savedRegisterStackReferences.appendVector(stackReferences);
+ m_savedRegisterStackReferences = m_stackAllocator.push(m_savedRegisters);
}
void restoreAllocatedCallerSavedRegisters()
@@ -182,8 +181,8 @@
StackAllocator& m_stackAllocator;
Vector<std::pair<JSC::MacroAssembler::Call, JSC::FunctionPtr>, 32>& m_callRegistry;
- Vector<JSC::MacroAssembler::RegisterID, registerCount> m_savedRegisters;
- Vector<StackAllocator::StackReference, registerCount> m_savedRegisterStackReferences;
+ RegisterVector m_savedRegisters;
+ StackAllocator::StackReferenceVector m_savedRegisterStackReferences;
JSC::FunctionPtr m_functionAddress;
unsigned m_argumentCount;
Modified: trunk/Source/WebCore/cssjit/RegisterAllocator.h (170713 => 170714)
--- trunk/Source/WebCore/cssjit/RegisterAllocator.h 2014-07-02 19:40:52 UTC (rev 170713)
+++ trunk/Source/WebCore/cssjit/RegisterAllocator.h 2014-07-02 19:48:16 UTC (rev 170714)
@@ -96,8 +96,10 @@
#error RegisterAllocator has no defined registers for the architecture.
#endif
static const unsigned calleeSavedRegisterCount = WTF_ARRAY_LENGTH(calleeSavedRegisters);
-static const unsigned registerCount = calleeSavedRegisterCount + WTF_ARRAY_LENGTH(callerSavedRegisters);
+static const unsigned maximumRegisterCount = calleeSavedRegisterCount + WTF_ARRAY_LENGTH(callerSavedRegisters);
+typedef Vector<JSC::MacroAssembler::RegisterID, maximumRegisterCount> RegisterVector;
+
class RegisterAllocator {
public:
RegisterAllocator();
@@ -171,7 +173,7 @@
return registers;
}
- const Vector<JSC::MacroAssembler::RegisterID, registerCount>& allocatedRegisters() const { return m_allocatedRegisters; }
+ const RegisterVector& allocatedRegisters() const { return m_allocatedRegisters; }
static bool isValidRegister(JSC::MacroAssembler::RegisterID registerID)
{
@@ -205,8 +207,8 @@
}
private:
- Deque<JSC::MacroAssembler::RegisterID, registerCount> m_registers;
- Vector<JSC::MacroAssembler::RegisterID, registerCount> m_allocatedRegisters;
+ Deque<JSC::MacroAssembler::RegisterID, maximumRegisterCount> m_registers;
+ RegisterVector m_allocatedRegisters;
Vector<JSC::MacroAssembler::RegisterID, calleeSavedRegisterCount> m_reservedCalleeSavedRegisters;
};
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (170713 => 170714)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2014-07-02 19:40:52 UTC (rev 170713)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2014-07-02 19:48:16 UTC (rev 170714)
@@ -265,7 +265,7 @@
bool generatePrologue();
void generateEpilogue();
- Vector<StackAllocator::StackReference, registerCount> m_prologueStackReferences;
+ StackAllocator::StackReferenceVector m_prologueStackReferences;
Assembler m_assembler;
RegisterAllocator m_registerAllocator;
@@ -1166,7 +1166,7 @@
void SelectorCodeGenerator::generateSelectorChecker()
{
- Vector<StackAllocator::StackReference, calleeSavedRegisterCount> calleeSavedRegisterStackReferences;
+ StackAllocator::StackReferenceVector calleeSavedRegisterStackReferences;
bool reservedCalleeSavedRegisters = false;
unsigned availableRegisterCount = m_registerAllocator.availableRegisterCount();
unsigned minimumRegisterCountForAttributes = minimumRegisterRequirements(m_selectorFragments);
@@ -1176,7 +1176,7 @@
bool needsEpilogue = generatePrologue();
- ASSERT(minimumRegisterCountForAttributes <= registerCount);
+ ASSERT(minimumRegisterCountForAttributes <= maximumRegisterCount);
if (availableRegisterCount < minimumRegisterCountForAttributes) {
reservedCalleeSavedRegisters = true;
calleeSavedRegisterStackReferences = m_stackAllocator.push(m_registerAllocator.reserveCalleeSavedRegisters(minimumRegisterCountForAttributes - availableRegisterCount));
Modified: trunk/Source/WebCore/cssjit/StackAllocator.h (170713 => 170714)
--- trunk/Source/WebCore/cssjit/StackAllocator.h 2014-07-02 19:40:52 UTC (rev 170713)
+++ trunk/Source/WebCore/cssjit/StackAllocator.h 2014-07-02 19:48:16 UTC (rev 170714)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -48,6 +48,8 @@
unsigned m_offsetFromTop;
};
+ typedef Vector<StackReference, maximumRegisterCount> StackReferenceVector;
+
StackAllocator(JSC::MacroAssembler& assembler)
: m_assembler(assembler)
, m_offsetFromTop(0)
@@ -69,10 +71,10 @@
return StackReference(m_offsetFromTop);
}
- Vector<StackReference, registerCount> push(const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
+ StackReferenceVector push(const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
{
RELEASE_ASSERT(!m_hasFunctionCallPadding);
- Vector<StackReference, registerCount> stackReferences;
+ StackReferenceVector stackReferences;
#if CPU(ARM64)
unsigned pushRegisterCount = registerIDs.size();
for (unsigned i = 0; i < pushRegisterCount - 1; i += 2) {
@@ -98,7 +100,7 @@
return StackReference(m_offsetFromTop);
}
- void pop(const Vector<StackReference>& stackReferences, const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
+ void pop(const StackReferenceVector& stackReferences, const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
{
RELEASE_ASSERT(!m_hasFunctionCallPadding);