Title: [159705] trunk
Revision
159705
Author
fpi...@apple.com
Date
2013-11-22 12:18:18 -0800 (Fri, 22 Nov 2013)

Log Message

BytecodeGenerator should align the stack according to native conventions
https://bugs.webkit.org/show_bug.cgi?id=124735

Source/_javascript_Core: 

Reviewed by Mark Lam.
        
Rolling this back in because it actually fixed fast/dom/gc-attribute-node.html, but
our infrastructure misleads peole into thinking that fixing a test constitutes
breaking it.

* bytecompiler/BytecodeGenerator.h:
(JSC::CallArguments::registerOffset):
(JSC::CallArguments::argumentCountIncludingThis):
* bytecompiler/NodesCodegen.cpp:
(JSC::CallArguments::CallArguments):

LayoutTests: 

Reviewed by Mark Lam.

* platform/mac/fast/dom/gc-attribute-node-expected.txt: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (159704 => 159705)


--- trunk/LayoutTests/ChangeLog	2013-11-22 20:06:42 UTC (rev 159704)
+++ trunk/LayoutTests/ChangeLog	2013-11-22 20:18:18 UTC (rev 159705)
@@ -1,3 +1,12 @@
+2013-11-22  Filip Pizlo  <fpi...@apple.com>
+
+        BytecodeGenerator should align the stack according to native conventions
+        https://bugs.webkit.org/show_bug.cgi?id=124735
+
+        Reviewed by Mark Lam.
+
+        * platform/mac/fast/dom/gc-attribute-node-expected.txt: Removed.
+
 2013-11-22  Hans Muller  <hmul...@adobe.com>
 
         [CSS Shapes] When the <box> value is set, derive radii from border-radius

Deleted: trunk/LayoutTests/platform/mac/fast/dom/gc-attribute-node-expected.txt (159704 => 159705)


--- trunk/LayoutTests/platform/mac/fast/dom/gc-attribute-node-expected.txt	2013-11-22 20:06:42 UTC (rev 159704)
+++ trunk/LayoutTests/platform/mac/fast/dom/gc-attribute-node-expected.txt	2013-11-22 20:18:18 UTC (rev 159705)
@@ -1,11 +0,0 @@
-Tests that attribute node wrappers are not prematurely garbage collected
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS a.prop is "set"
-FAIL a.prop should be set (of type string). Was undefined (of type undefined).
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Modified: trunk/Source/_javascript_Core/ChangeLog (159704 => 159705)


--- trunk/Source/_javascript_Core/ChangeLog	2013-11-22 20:06:42 UTC (rev 159704)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-11-22 20:18:18 UTC (rev 159705)
@@ -1,5 +1,22 @@
 2013-11-21  Filip Pizlo  <fpi...@apple.com>
 
+        BytecodeGenerator should align the stack according to native conventions
+        https://bugs.webkit.org/show_bug.cgi?id=124735
+
+        Reviewed by Mark Lam.
+        
+        Rolling this back in because it actually fixed fast/dom/gc-attribute-node.html, but
+        our infrastructure misleads peole into thinking that fixing a test constitutes
+        breaking it.
+
+        * bytecompiler/BytecodeGenerator.h:
+        (JSC::CallArguments::registerOffset):
+        (JSC::CallArguments::argumentCountIncludingThis):
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::CallArguments::CallArguments):
+
+2013-11-21  Filip Pizlo  <fpi...@apple.com>
+
         Get rid of CodeBlock::dumpStatistics()
         https://bugs.webkit.org/show_bug.cgi?id=124762
 

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (159704 => 159705)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2013-11-22 20:06:42 UTC (rev 159704)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2013-11-22 20:18:18 UTC (rev 159705)
@@ -1739,10 +1739,10 @@
     UnlinkedValueProfile profile = ""
     ASSERT(dst);
     ASSERT(dst != ignoredResult());
-    instructions().append(dst->index()); // result
-    instructions().append(func->index()); // func
-    instructions().append(callArguments.argumentCountIncludingThis()); // argCount
-    instructions().append(callArguments.registerOffset()); // registerOffset
+    instructions().append(dst->index());
+    instructions().append(func->index());
+    instructions().append(callArguments.argumentCountIncludingThis());
+    instructions().append(callArguments.stackOffset());
 #if ENABLE(LLINT)
     instructions().append(m_codeBlock->addLLIntCallLinkInfo());
 #else
@@ -1853,9 +1853,9 @@
     UnlinkedValueProfile profile = ""
     ASSERT(dst != ignoredResult());
     instructions().append(dst->index());
-    instructions().append(func->index()); // func
-    instructions().append(callArguments.argumentCountIncludingThis()); // argCount
-    instructions().append(callArguments.registerOffset()); // registerOffset
+    instructions().append(func->index());
+    instructions().append(callArguments.argumentCountIncludingThis());
+    instructions().append(callArguments.stackOffset());
 #if ENABLE(LLINT)
     instructions().append(m_codeBlock->addLLIntCallLinkInfo());
 #else

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (159704 => 159705)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2013-11-22 20:06:42 UTC (rev 159704)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2013-11-22 20:18:18 UTC (rev 159705)
@@ -69,17 +69,16 @@
 
         RegisterID* thisRegister() { return m_argv[0].get(); }
         RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); }
-        unsigned registerOffset() { return -m_argv.last()->index() + CallFrame::offsetFor(argumentCountIncludingThis()); }
-        unsigned argumentCountIncludingThis() { return m_argv.size(); }
+        unsigned stackOffset() { return -m_argv[0]->index() + JSStack::CallFrameHeaderSize; }
+        unsigned argumentCountIncludingThis() { return m_argv.size() - m_padding; }
         RegisterID* profileHookRegister() { return m_profileHookRegister.get(); }
         ArgumentsNode* argumentsNode() { return m_argumentsNode; }
 
     private:
-        void newArgument(BytecodeGenerator&);
-
         RefPtr<RegisterID> m_profileHookRegister;
         ArgumentsNode* m_argumentsNode;
         Vector<RefPtr<RegisterID>, 8, UnsafeVectorOverflow> m_argv;
+        unsigned m_padding;
     };
 
     struct FinallyContext {

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (159704 => 159705)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2013-11-22 20:06:42 UTC (rev 159704)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2013-11-22 20:18:18 UTC (rev 159705)
@@ -44,6 +44,7 @@
 #include "RegExpCache.h"
 #include "RegExpObject.h"
 #include "SamplingTool.h"
+#include "StackAlignment.h"
 #include <wtf/Assertions.h>
 #include <wtf/RefCountedLeakCounter.h>
 #include <wtf/Threading.h>
@@ -420,6 +421,7 @@
 
 CallArguments::CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode, unsigned additionalArguments)
     : m_argumentsNode(argumentsNode)
+    , m_padding(0)
 {
     if (generator.shouldEmitProfileHooks())
         m_profileHookRegister = generator.newTemporary();
@@ -435,15 +437,13 @@
         m_argv[i] = generator.newTemporary();
         ASSERT(static_cast<size_t>(i) == m_argv.size() - 1 || m_argv[i]->index() == m_argv[i + 1]->index() - 1);
     }
+    
+    while (stackOffset() % stackAlignmentRegisters()) {
+        m_argv.insert(0, generator.newTemporary());
+        m_padding++;
+    }
 }
 
-inline void CallArguments::newArgument(BytecodeGenerator& generator)
-{
-    RefPtr<RegisterID> tmp = generator.newTemporary();
-    ASSERT(m_argv.isEmpty() || tmp->index() == m_argv.last()->index() + 1); // Calling convention assumes that all arguments are contiguous.
-    m_argv.append(tmp.release());
-}
-
 // ------------------------------ EvalFunctionCallNode ----------------------------------
 
 RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to