diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:48 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:57 +0100 |
commit | 4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch) | |
tree | bed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Source/JavaScriptCore/assembler/MacroAssembler.h | |
parent | 01485457c9a5da3f1121015afd25bb53af77662e (diff) | |
download | qtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz |
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec
Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/assembler/MacroAssembler.h')
-rw-r--r-- | Source/JavaScriptCore/assembler/MacroAssembler.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/assembler/MacroAssembler.h b/Source/JavaScriptCore/assembler/MacroAssembler.h index 642b5ca6b..3d57340f9 100644 --- a/Source/JavaScriptCore/assembler/MacroAssembler.h +++ b/Source/JavaScriptCore/assembler/MacroAssembler.h @@ -266,12 +266,14 @@ public: { return PatchableJump(branchTest32(cond, reg, mask)); } - +#endif // !CPU(ARM_THUMB2) + +#if !CPU(ARM) PatchableJump patchableBranch32(RelationalCondition cond, RegisterID reg, TrustedImm32 imm) { return PatchableJump(branch32(cond, reg, imm)); } -#endif +#endif // !(CPU(ARM) void jump(Label target) { @@ -306,7 +308,12 @@ public: ASSERT(condition == Equal || condition == NotEqual); return condition; } - + + static const unsigned BlindingModulus = 64; + bool shouldConsiderBlinding() + { + return !(random() & (BlindingModulus - 1)); + } // Ptr methods // On 32-bit platforms (i.e. x86), these methods directly map onto their 32-bit equivalents. @@ -837,26 +844,25 @@ public: using MacroAssemblerBase::and64; using MacroAssemblerBase::convertInt32ToDouble; using MacroAssemblerBase::store64; - bool shouldBlindDouble(double value) { // Don't trust NaN or +/-Infinity if (!isfinite(value)) - return true; + return shouldConsiderBlinding(); // Try to force normalisation, and check that there's no change // in the bit pattern if (bitwise_cast<uint64_t>(value * 1.0) != bitwise_cast<uint64_t>(value)) - return true; + return shouldConsiderBlinding(); value = abs(value); // Only allow a limited set of fractional components double scaledValue = value * 8; if (scaledValue / 8 != value) - return true; + return shouldConsiderBlinding(); double frac = scaledValue - floor(scaledValue); if (frac != 0.0) - return true; + return shouldConsiderBlinding(); return value > 0xff; } @@ -885,8 +891,14 @@ public: default: { if (value <= 0xff) return false; + if (~value <= 0xff) + return false; } } + + if (!shouldConsiderBlinding()) + return false; + return shouldBlindForSpecificArch(value); } @@ -938,6 +950,9 @@ public: default: { if (value <= 0xff) return false; + if (~value <= 0xff) + return false; + JSValue jsValue = JSValue::decode(value); if (jsValue.isInt32()) return shouldBlind(Imm32(jsValue.asInt32())); @@ -948,6 +963,10 @@ public: return false; } } + + if (!shouldConsiderBlinding()) + return false; + return shouldBlindForSpecificArch(value); } @@ -1066,7 +1085,13 @@ public: default: if (value <= 0xff) return false; + if (~value <= 0xff) + return false; } + + if (!shouldConsiderBlinding()) + return false; + return shouldBlindForSpecificArch(value); #endif } |