PolymorphicAccess adds sizeof(CallerFrameAndPC) rather than subtracting it when calcu...
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Apr 2016 22:11:38 +0000 (22:11 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Apr 2016 22:11:38 +0000 (22:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156872

Reviewed by Geoffrey Garen.

The code that added sizeof(CallerFrameAndPC) emerged from a bad copy-paste in r189586. That was
the revision that created the PolymorphicAccess class. It moved code for generating a
getter/setter call from Repatch.cpp to PolymorphicAccess.cpp. You can see the code doing a
subtraction here:

    http://trac.webkit.org/changeset/189586/trunk/Source/JavaScriptCore/jit/Repatch.cpp

This makes the world right again.

* bytecode/PolymorphicAccess.cpp:
(JSC::AccessCase::generateImpl):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp

index 61465d4..6cf6ef2 100644 (file)
@@ -1,3 +1,22 @@
+2016-04-21  Filip Pizlo  <fpizlo@apple.com>
+
+        PolymorphicAccess adds sizeof(CallerFrameAndPC) rather than subtracting it when calculating stack height
+        https://bugs.webkit.org/show_bug.cgi?id=156872
+
+        Reviewed by Geoffrey Garen.
+        
+        The code that added sizeof(CallerFrameAndPC) emerged from a bad copy-paste in r189586. That was
+        the revision that created the PolymorphicAccess class. It moved code for generating a
+        getter/setter call from Repatch.cpp to PolymorphicAccess.cpp. You can see the code doing a
+        subtraction here:
+        
+            http://trac.webkit.org/changeset/189586/trunk/Source/JavaScriptCore/jit/Repatch.cpp
+        
+        This makes the world right again.
+
+        * bytecode/PolymorphicAccess.cpp:
+        (JSC::AccessCase::generateImpl):
+
 2016-04-21  Geoffrey Garen  <ggaren@apple.com>
 
         Build warning: CODE_SIGN_ENTITLEMENTS specified without specifying CODE_SIGN_IDENTITY
index 7bebae7..91e2240 100644 (file)
@@ -992,7 +992,7 @@ void AccessCase::generateImpl(AccessGenerationState& state)
             unsigned numberOfRegsForCall = JSStack::CallFrameHeaderSize + numberOfParameters;
 
             unsigned numberOfBytesForCall =
-                numberOfRegsForCall * sizeof(Register) + sizeof(CallerFrameAndPC);
+                numberOfRegsForCall * sizeof(Register) - sizeof(CallerFrameAndPC);
 
             unsigned alignedNumberOfBytesForCall =
                 WTF::roundUpToMultipleOf(stackAlignmentBytes(), numberOfBytesForCall);