Title: [158205] trunk/Source/_javascript_Core
Revision
158205
Author
[email protected]
Date
2013-10-29 12:02:46 -0700 (Tue, 29 Oct 2013)

Log Message

Fix CPU(ARM_TRADITIONAL) build after r157690.
https://bugs.webkit.org/show_bug.cgi?id=123247

Patch by Julien Brianceau <[email protected]> on 2013-10-29
Reviewed by Michael Saboff.

Since r157690, the executableCopy function has been removed from AssemblerBuffer.h
and the copy of executable code occurs in the linkCode function (in LinkBuffer.cpp).
As the constant pool for jumps is updated in the executableCopy function of ARM_TRADITIONAL,
this part of code still needs to be called and absolute jumps must be corrected to anticipate
the copy of the executable code through memcpy.

* assembler/ARMAssembler.cpp:
(JSC::ARMAssembler::prepareExecutableCopy): Rename executableCopy to prepareExecutableCopy
and correct absolute jump values using the delta between the source and destination buffers.
* assembler/ARMAssembler.h:
* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::linkCode): Call prepareExecutableCopy just before the memcpy.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (158204 => 158205)


--- trunk/Source/_javascript_Core/ChangeLog	2013-10-29 18:56:46 UTC (rev 158204)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-10-29 19:02:46 UTC (rev 158205)
@@ -1,3 +1,23 @@
+2013-10-29  Julien Brianceau  <[email protected]>
+
+        Fix CPU(ARM_TRADITIONAL) build after r157690.
+        https://bugs.webkit.org/show_bug.cgi?id=123247
+
+        Reviewed by Michael Saboff.
+
+        Since r157690, the executableCopy function has been removed from AssemblerBuffer.h
+        and the copy of executable code occurs in the linkCode function (in LinkBuffer.cpp).
+        As the constant pool for jumps is updated in the executableCopy function of ARM_TRADITIONAL,
+        this part of code still needs to be called and absolute jumps must be corrected to anticipate
+        the copy of the executable code through memcpy.
+
+        * assembler/ARMAssembler.cpp:
+        (JSC::ARMAssembler::prepareExecutableCopy): Rename executableCopy to prepareExecutableCopy
+        and correct absolute jump values using the delta between the source and destination buffers.
+        * assembler/ARMAssembler.h:
+        * assembler/LinkBuffer.cpp:
+        (JSC::LinkBuffer::linkCode): Call prepareExecutableCopy just before the memcpy.
+
 2013-10-28  Filip Pizlo  <[email protected]>
 
         OSRExit::m_watchpointIndex should be in OSRExitCompilationInfo

Modified: trunk/Source/_javascript_Core/assembler/ARMAssembler.cpp (158204 => 158205)


--- trunk/Source/_javascript_Core/assembler/ARMAssembler.cpp	2013-10-29 18:56:46 UTC (rev 158204)
+++ trunk/Source/_javascript_Core/assembler/ARMAssembler.cpp	2013-10-29 19:02:46 UTC (rev 158205)
@@ -391,15 +391,15 @@
     dataTransferFloat(transferType, srcDst, ARMRegisters::S1, offset);
 }
 
-PassRefPtr<ExecutableMemoryHandle> ARMAssembler::executableCopy(VM& vm, void* ownerUID, JITCompilationEffort effort)
+void ARMAssembler::prepareExecutableCopy(void* to)
 {
     // 64-bit alignment is required for next constant pool and JIT code as well
     m_buffer.flushWithoutBarrier(true);
     if (!m_buffer.isAligned(8))
         bkpt(0);
 
-    RefPtr<ExecutableMemoryHandle> result = m_buffer.executableCopy(vm, ownerUID, effort);
-    char* data = ""
+    char* data = ""
+    ptrdiff_t delta = reinterpret_cast<char*>(to) - data;
 
     for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) {
         // The last bit is set if the constant must be placed on constant pool.
@@ -415,11 +415,9 @@
                     continue;
                 }
             }
-            *addr = reinterpret_cast<ARMWord>(data + *addr);
+            *addr = reinterpret_cast<ARMWord>(data + delta + *addr);
         }
     }
-
-    return result;
 }
 
 #if OS(LINUX) && COMPILER(RVCT)

Modified: trunk/Source/_javascript_Core/assembler/ARMAssembler.h (158204 => 158205)


--- trunk/Source/_javascript_Core/assembler/ARMAssembler.h	2013-10-29 18:56:46 UTC (rev 158204)
+++ trunk/Source/_javascript_Core/assembler/ARMAssembler.h	2013-10-29 19:02:46 UTC (rev 158205)
@@ -808,7 +808,7 @@
             return loadBranchTarget(ARMRegisters::pc, cc, useConstantPool);
         }
 
-        PassRefPtr<ExecutableMemoryHandle> executableCopy(VM&, void* ownerUID, JITCompilationEffort);
+        void prepareExecutableCopy(void* to);
 
         unsigned debugOffset() { return m_buffer.debugOffset(); }
 

Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp (158204 => 158205)


--- trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp	2013-10-29 18:56:46 UTC (rev 158204)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp	2013-10-29 19:02:46 UTC (rev 158205)
@@ -147,6 +147,9 @@
     if (!m_didAllocate)
         return;
     ASSERT(m_code);
+#if CPU(ARM_TRADITIONAL)
+    m_assembler->m_assembler.prepareExecutableCopy(m_code);
+#endif
     memcpy(m_code, buffer.data(), buffer.codeSize());
 #elif CPU(ARM_THUMB2)
     copyCompactAndLinkCode<uint16_t>(ownerUID, effort);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to