[Qt][ARM]ARMAssembler needs buildfix afert r123417
https://bugs.webkit.org/show_bug.cgi?id=92086
Reviewed by Csaba Osztrogonác.
The ARM implementation of this should be optimized code path
is covered by a non-optimized code path. This patch fixes this,
and adds a new function which returns with the offset range.
* assembler/ARMAssembler.h:
(JSC::ARMAssembler::readPointer):
(ARMAssembler):
(JSC::ARMAssembler::repatchInt32):
(JSC::ARMAssembler::repatchCompact):
* assembler/MacroAssemblerARM.h:
(MacroAssemblerARM):
(JSC::MacroAssemblerARM::isCompactPtrAlignedAddressOffset):
(JSC::MacroAssemblerARM::load32WithCompactAddressOffsetPatch):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123735 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 0ffcb95..3855a7c 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,24 @@
+2012-07-26 Zoltan Herczeg <zherczeg@webkit.org>
+
+ [Qt][ARM]ARMAssembler needs buildfix afert r123417
+ https://bugs.webkit.org/show_bug.cgi?id=92086
+
+ Reviewed by Csaba Osztrogonác.
+
+ The ARM implementation of this should be optimized code path
+ is covered by a non-optimized code path. This patch fixes this,
+ and adds a new function which returns with the offset range.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::readPointer):
+ (ARMAssembler):
+ (JSC::ARMAssembler::repatchInt32):
+ (JSC::ARMAssembler::repatchCompact):
+ * assembler/MacroAssemblerARM.h:
+ (MacroAssemblerARM):
+ (JSC::MacroAssemblerARM::isCompactPtrAlignedAddressOffset):
+ (JSC::MacroAssemblerARM::load32WithCompactAddressOffsetPatch):
+
2012-07-25 Mark Hahnenberg <mhahnenberg@apple.com>
Build fix for 32-bit after r123682
diff --git a/Source/JavaScriptCore/assembler/ARMAssembler.h b/Source/JavaScriptCore/assembler/ARMAssembler.h
index a0d7d27..87aed85 100644
--- a/Source/JavaScriptCore/assembler/ARMAssembler.h
+++ b/Source/JavaScriptCore/assembler/ARMAssembler.h
@@ -817,11 +817,11 @@
// Read pointers
static void* readPointer(void* from)
{
- ARMWord* insn = reinterpret_cast<ARMWord*>(from);
- ARMWord* addr = getLdrImmAddress(insn);
- return *reinterpret_cast<void**>(addr);
+ ARMWord* instruction = reinterpret_cast<ARMWord*>(from);
+ ARMWord* address = getLdrImmAddress(instruction);
+ return *reinterpret_cast<void**>(address);
}
-
+
// Patch pointers
static void linkPointer(void* code, AssemblerLabel from, void* to)
@@ -829,14 +829,20 @@
patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
}
- static void repatchInt32(void* from, int32_t to)
+ static void repatchInt32(void* where, int32_t to)
{
- patchPointerInternal(reinterpret_cast<intptr_t>(from), reinterpret_cast<void*>(to));
+ patchPointerInternal(reinterpret_cast<intptr_t>(where), reinterpret_cast<void*>(to));
}
-
+
static void repatchCompact(void* where, int32_t value)
{
- repatchInt32(where, value);
+ ARMWord* instruction = reinterpret_cast<ARMWord*>(where);
+ ASSERT((*instruction & 0x0f700000) == LoadUint32);
+ if (value >= 0)
+ *instruction = (*instruction & 0xff7ff000) | DT_UP | value;
+ else
+ *instruction = (*instruction & 0xff7ff000) | -value;
+ cacheFlush(instruction, sizeof(ARMWord));
}
static void repatchPointer(void* from, void* to)
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARM.h b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
index 2773b02..530f62b 100644
--- a/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
@@ -41,7 +41,6 @@
COMPILE_ASSERT(!(DoubleConditionBitSpecial & DoubleConditionMask), DoubleConditionBitSpecial_should_not_interfere_with_ARMAssembler_Condition_codes);
public:
typedef ARMRegisters::FPRegisterID FPRegisterID;
- static const int MaximumCompactPtrAlignedAddressOffset = 0x7FFFFFFF;
enum RelationalCondition {
Equal = ARMAssembler::EQ,
@@ -408,11 +407,20 @@
m_assembler.dtr_ur(ARMAssembler::LoadUint32, dest, address.base, ARMRegisters::S0);
return dataLabel;
}
-
+
+ static bool isCompactPtrAlignedAddressOffset(ptrdiff_t value)
+ {
+ return value >= -4095 && value <= 4095;
+ }
+
DataLabelCompact load32WithCompactAddressOffsetPatch(Address address, RegisterID dest)
{
DataLabelCompact dataLabel(this);
- load32WithAddressOffsetPatch(address, dest);
+ ASSERT(isCompactPtrAlignedAddressOffset(address.offset));
+ if (address.offset >= 0)
+ m_assembler.dtr_u(ARMAssembler::LoadUint32, dest, address.base, address.offset);
+ else
+ m_assembler.dtr_d(ARMAssembler::LoadUint32, dest, address.base, address.offset);
return dataLabel;
}