<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170714] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170714">170714</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-02 12:48:16 -0700 (Wed, 02 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>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):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssjitFunctionCallh">trunk/Source/WebCore/cssjit/FunctionCall.h</a></li>
<li><a href="#trunkSourceWebCorecssjitRegisterAllocatorh">trunk/Source/WebCore/cssjit/RegisterAllocator.h</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCorecssjitStackAllocatorh">trunk/Source/WebCore/cssjit/StackAllocator.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170713 => 170714)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-07-02 Benjamin Poulain <benjamin@webkit.org>
+
+ 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):
+
</ins><span class="cx"> 2014-07-02 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove some code only needed for versions of Safari that are no longer supported
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitFunctionCallh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/FunctionCall.h (170713 => 170714)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -162,13 +162,12 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_savedRegisterStackReferences.isEmpty());
</span><span class="cx"> ASSERT(m_savedRegisters.isEmpty());
</span><del>- const Vector<JSC::MacroAssembler::RegisterID, registerCount>& allocatedRegisters = m_registerAllocator.allocatedRegisters();
</del><ins>+ const RegisterVector& allocatedRegisters = m_registerAllocator.allocatedRegisters();
</ins><span class="cx"> for (auto registerID : allocatedRegisters) {
</span><span class="cx"> if (RegisterAllocator::isCallerSavedRegister(registerID))
</span><span class="cx"> m_savedRegisters.append(registerID);
</span><span class="cx"> }
</span><del>- Vector<StackAllocator::StackReference, registerCount> stackReferences = m_stackAllocator.push(m_savedRegisters);
- m_savedRegisterStackReferences.appendVector(stackReferences);
</del><ins>+ m_savedRegisterStackReferences = m_stackAllocator.push(m_savedRegisters);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void restoreAllocatedCallerSavedRegisters()
</span><span class="lines">@@ -182,8 +181,8 @@
</span><span class="cx"> StackAllocator& m_stackAllocator;
</span><span class="cx"> Vector<std::pair<JSC::MacroAssembler::Call, JSC::FunctionPtr>, 32>& m_callRegistry;
</span><span class="cx">
</span><del>- Vector<JSC::MacroAssembler::RegisterID, registerCount> m_savedRegisters;
- Vector<StackAllocator::StackReference, registerCount> m_savedRegisterStackReferences;
</del><ins>+ RegisterVector m_savedRegisters;
+ StackAllocator::StackReferenceVector m_savedRegisterStackReferences;
</ins><span class="cx">
</span><span class="cx"> JSC::FunctionPtr m_functionAddress;
</span><span class="cx"> unsigned m_argumentCount;
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitRegisterAllocatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/RegisterAllocator.h (170713 => 170714)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -96,8 +96,10 @@
</span><span class="cx"> #error RegisterAllocator has no defined registers for the architecture.
</span><span class="cx"> #endif
</span><span class="cx"> static const unsigned calleeSavedRegisterCount = WTF_ARRAY_LENGTH(calleeSavedRegisters);
</span><del>-static const unsigned registerCount = calleeSavedRegisterCount + WTF_ARRAY_LENGTH(callerSavedRegisters);
</del><ins>+static const unsigned maximumRegisterCount = calleeSavedRegisterCount + WTF_ARRAY_LENGTH(callerSavedRegisters);
</ins><span class="cx">
</span><ins>+typedef Vector<JSC::MacroAssembler::RegisterID, maximumRegisterCount> RegisterVector;
+
</ins><span class="cx"> class RegisterAllocator {
</span><span class="cx"> public:
</span><span class="cx"> RegisterAllocator();
</span><span class="lines">@@ -171,7 +173,7 @@
</span><span class="cx"> return registers;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- const Vector<JSC::MacroAssembler::RegisterID, registerCount>& allocatedRegisters() const { return m_allocatedRegisters; }
</del><ins>+ const RegisterVector& allocatedRegisters() const { return m_allocatedRegisters; }
</ins><span class="cx">
</span><span class="cx"> static bool isValidRegister(JSC::MacroAssembler::RegisterID registerID)
</span><span class="cx"> {
</span><span class="lines">@@ -205,8 +207,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- Deque<JSC::MacroAssembler::RegisterID, registerCount> m_registers;
- Vector<JSC::MacroAssembler::RegisterID, registerCount> m_allocatedRegisters;
</del><ins>+ Deque<JSC::MacroAssembler::RegisterID, maximumRegisterCount> m_registers;
+ RegisterVector m_allocatedRegisters;
</ins><span class="cx"> Vector<JSC::MacroAssembler::RegisterID, calleeSavedRegisterCount> m_reservedCalleeSavedRegisters;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (170713 => 170714)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -265,7 +265,7 @@
</span><span class="cx">
</span><span class="cx"> bool generatePrologue();
</span><span class="cx"> void generateEpilogue();
</span><del>- Vector<StackAllocator::StackReference, registerCount> m_prologueStackReferences;
</del><ins>+ StackAllocator::StackReferenceVector m_prologueStackReferences;
</ins><span class="cx">
</span><span class="cx"> Assembler m_assembler;
</span><span class="cx"> RegisterAllocator m_registerAllocator;
</span><span class="lines">@@ -1166,7 +1166,7 @@
</span><span class="cx">
</span><span class="cx"> void SelectorCodeGenerator::generateSelectorChecker()
</span><span class="cx"> {
</span><del>- Vector<StackAllocator::StackReference, calleeSavedRegisterCount> calleeSavedRegisterStackReferences;
</del><ins>+ StackAllocator::StackReferenceVector calleeSavedRegisterStackReferences;
</ins><span class="cx"> bool reservedCalleeSavedRegisters = false;
</span><span class="cx"> unsigned availableRegisterCount = m_registerAllocator.availableRegisterCount();
</span><span class="cx"> unsigned minimumRegisterCountForAttributes = minimumRegisterRequirements(m_selectorFragments);
</span><span class="lines">@@ -1176,7 +1176,7 @@
</span><span class="cx">
</span><span class="cx"> bool needsEpilogue = generatePrologue();
</span><span class="cx">
</span><del>- ASSERT(minimumRegisterCountForAttributes <= registerCount);
</del><ins>+ ASSERT(minimumRegisterCountForAttributes <= maximumRegisterCount);
</ins><span class="cx"> if (availableRegisterCount < minimumRegisterCountForAttributes) {
</span><span class="cx"> reservedCalleeSavedRegisters = true;
</span><span class="cx"> calleeSavedRegisterStackReferences = m_stackAllocator.push(m_registerAllocator.reserveCalleeSavedRegisters(minimumRegisterCountForAttributes - availableRegisterCount));
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitStackAllocatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/StackAllocator.h (170713 => 170714)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -48,6 +48,8 @@
</span><span class="cx"> unsigned m_offsetFromTop;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+ typedef Vector<StackReference, maximumRegisterCount> StackReferenceVector;
+
</ins><span class="cx"> StackAllocator(JSC::MacroAssembler& assembler)
</span><span class="cx"> : m_assembler(assembler)
</span><span class="cx"> , m_offsetFromTop(0)
</span><span class="lines">@@ -69,10 +71,10 @@
</span><span class="cx"> return StackReference(m_offsetFromTop);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Vector<StackReference, registerCount> push(const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
</del><ins>+ StackReferenceVector push(const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
</ins><span class="cx"> {
</span><span class="cx"> RELEASE_ASSERT(!m_hasFunctionCallPadding);
</span><del>- Vector<StackReference, registerCount> stackReferences;
</del><ins>+ StackReferenceVector stackReferences;
</ins><span class="cx"> #if CPU(ARM64)
</span><span class="cx"> unsigned pushRegisterCount = registerIDs.size();
</span><span class="cx"> for (unsigned i = 0; i < pushRegisterCount - 1; i += 2) {
</span><span class="lines">@@ -98,7 +100,7 @@
</span><span class="cx"> return StackReference(m_offsetFromTop);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void pop(const Vector<StackReference>& stackReferences, const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
</del><ins>+ void pop(const StackReferenceVector& stackReferences, const Vector<JSC::MacroAssembler::RegisterID>& registerIDs)
</ins><span class="cx"> {
</span><span class="cx"> RELEASE_ASSERT(!m_hasFunctionCallPadding);
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>