Diff
Modified: trunk/Source/_javascript_Core/API/JSCallbackObject.h (225619 => 225620)
--- trunk/Source/_javascript_Core/API/JSCallbackObject.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/API/JSCallbackObject.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -27,7 +27,7 @@
#ifndef JSCallbackObject_h
#define JSCallbackObject_h
-#include "JSCScrambledPtr.h"
+#include "JSCPoisonedPtr.h"
#include "JSObjectRef.h"
#include "JSValueRef.h"
#include "JSObject.h"
@@ -234,7 +234,7 @@
static EncodedJSValue callbackGetter(ExecState*, EncodedJSValue, PropertyName);
std::unique_ptr<JSCallbackObjectData> m_callbackObjectData;
- ClassInfoScrambledPtr m_classInfo;
+ PoisonedClassInfoPtr m_classInfo;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/API/JSObjectRef.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/API/JSObjectRef.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/API/JSObjectRef.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -431,7 +431,7 @@
if (vm.currentlyDestructingCallbackObject != jsObject)
return jsObject->classInfo(vm);
- return vm.currentlyDestructingCallbackObjectClassInfo.descrambled();
+ return vm.currentlyDestructingCallbackObjectClassInfo.unpoisoned();
}
void* JSObjectGetPrivate(JSObjectRef object)
Modified: trunk/Source/_javascript_Core/ChangeLog (225619 => 225620)
--- trunk/Source/_javascript_Core/ChangeLog 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1,3 +1,67 @@
+2017-12-06 Mark Lam <mark....@apple.com>
+
+ Refactoring: Rename ScrambledPtr to Poisoned.
+ https://bugs.webkit.org/show_bug.cgi?id=180514
+
+ Reviewed by Saam Barati.
+
+ * API/JSCallbackObject.h:
+ * API/JSObjectRef.cpp:
+ (classInfoPrivate):
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * Sources.txt:
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::FunctionPtr::FunctionPtr):
+ (JSC::FunctionPtr::value const):
+ (JSC::FunctionPtr::executableAddress const):
+ (JSC::ReturnAddressPtr::ReturnAddressPtr):
+ (JSC::ReturnAddressPtr::value const):
+ (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
+ (JSC::MacroAssemblerCodePtr::createFromExecutableAddress):
+ (JSC::MacroAssemblerCodePtr::poisonedPtr const):
+ (JSC::MacroAssemblerCodePtr:: const):
+ (JSC::MacroAssemblerCodePtr::operator! const):
+ (JSC::MacroAssemblerCodePtr::operator== const):
+ (JSC::MacroAssemblerCodePtr::emptyValue):
+ (JSC::MacroAssemblerCodePtr::deletedValue):
+ (JSC::MacroAssemblerCodePtr::scrambledPtr const): Deleted.
+ * b3/B3LowerMacros.cpp:
+ * b3/testb3.cpp:
+ (JSC::B3::testInterpreter):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::checkArray):
+ (JSC::DFG::SpeculativeJIT::compileCheckSubClass):
+ (JSC::DFG::SpeculativeJIT::compileNewStringObject):
+ (JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::compileNewStringObject):
+ (JSC::FTL::DFG::LowerDFGToB3::compileCheckSubClass):
+ * jit/AssemblyHelpers.h:
+ (JSC::AssemblyHelpers::emitAllocateDestructibleObject):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::loadArgumentWithSpecificClass):
+ * jit/ThunkGenerators.cpp:
+ (JSC::virtualThunkFor):
+ (JSC::boundThisNoArgsFunctionCallGenerator):
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::handleHostCall):
+ (JSC::LLInt::setUpCall):
+ * llint/LowLevelInterpreter64.asm:
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreading):
+ * runtime/JSCPoisonedPtr.cpp: Copied from Source/_javascript_Core/runtime/JSCScrambledPtr.cpp.
+ (JSC::initializePoison):
+ (JSC::initializeScrambledPtrKeys): Deleted.
+ * runtime/JSCPoisonedPtr.h: Copied from Source/_javascript_Core/runtime/JSCScrambledPtr.h.
+ * runtime/JSCScrambledPtr.cpp: Removed.
+ * runtime/JSCScrambledPtr.h: Removed.
+ * runtime/JSDestructibleObject.h:
+ (JSC::JSDestructibleObject::classInfo const):
+ * runtime/JSSegmentedVariableObject.h:
+ (JSC::JSSegmentedVariableObject::classInfo const):
+ * runtime/Structure.h:
+ * runtime/VM.h:
+
2017-12-02 Darin Adler <da...@apple.com>
Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (225619 => 225620)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1720,7 +1720,7 @@
FE1C0FFD1B193E9800B53FCA /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1C0FFC1B193E9800B53FCA /* Exception.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE20CE9E15F04A9500DF3430 /* LLIntCLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = FE20CE9C15F04A9500DF3430 /* LLIntCLoop.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE2A87601F02381600EB31B2 /* MinimumReservedZoneSize.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2A875F1F02381600EB31B2 /* MinimumReservedZoneSize.h */; };
- FE2B0B691FD227E00075DA5F /* JSCScrambledPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2B0B671FD0D2960075DA5F /* JSCScrambledPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ FE2B0B691FD227E00075DA5F /* JSCPoisonedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2B0B671FD0D2960075DA5F /* JSCPoisonedPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE3022D31E3D73A500BAC493 /* SigillCrashAnalyzer.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3022D11E3D739600BAC493 /* SigillCrashAnalyzer.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE3022D71E42857300BAC493 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3022D51E42856700BAC493 /* VMInspector.h */; };
FE318FE01CAC982F00DFCC54 /* ECMAScriptSpecInternalFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE318FDE1CAC8C5300DFCC54 /* ECMAScriptSpecInternalFunctions.h */; };
@@ -4598,8 +4598,8 @@
FE20CE9B15F04A9500DF3430 /* LLIntCLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntCLoop.cpp; path = llint/LLIntCLoop.cpp; sourceTree = "<group>"; };
FE20CE9C15F04A9500DF3430 /* LLIntCLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntCLoop.h; path = llint/LLIntCLoop.h; sourceTree = "<group>"; };
FE2A875F1F02381600EB31B2 /* MinimumReservedZoneSize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MinimumReservedZoneSize.h; sourceTree = "<group>"; };
- FE2B0B671FD0D2960075DA5F /* JSCScrambledPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCScrambledPtr.h; sourceTree = "<group>"; };
- FE2B0B681FD0D2970075DA5F /* JSCScrambledPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCScrambledPtr.cpp; sourceTree = "<group>"; };
+ FE2B0B671FD0D2960075DA5F /* JSCPoisonedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCPoisonedPtr.h; sourceTree = "<group>"; };
+ FE2B0B681FD0D2970075DA5F /* JSCPoisonedPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCPoisonedPtr.cpp; sourceTree = "<group>"; };
FE2E6A7A1D6EA5FE0060F896 /* ThrowScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThrowScope.cpp; sourceTree = "<group>"; };
FE3022D01E3D739600BAC493 /* SigillCrashAnalyzer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SigillCrashAnalyzer.cpp; sourceTree = "<group>"; };
FE3022D11E3D739600BAC493 /* SigillCrashAnalyzer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SigillCrashAnalyzer.h; sourceTree = "<group>"; };
@@ -6543,8 +6543,8 @@
F692A8870255597D01FF60F7 /* JSCJSValue.cpp */,
14ABB36E099C076400E2A24F /* JSCJSValue.h */,
865A30F0135007E100CDB49E /* JSCJSValueInlines.h */,
- FE2B0B681FD0D2970075DA5F /* JSCScrambledPtr.cpp */,
- FE2B0B671FD0D2960075DA5F /* JSCScrambledPtr.h */,
+ FE2B0B681FD0D2970075DA5F /* JSCPoisonedPtr.cpp */,
+ FE2B0B671FD0D2960075DA5F /* JSCPoisonedPtr.h */,
72AAF7CB1D0D318B005E60BE /* JSCustomGetterSetterFunction.cpp */,
72AAF7CC1D0D318B005E60BE /* JSCustomGetterSetterFunction.h */,
0F2B66BD17B6B5AB00A7AE3F /* JSDataView.cpp */,
@@ -8155,7 +8155,7 @@
0FEC852A1BDACDAC0080FF74 /* B3PhaseScope.h in Headers */,
0F37308D1C0BD29100052BFA /* B3PhiChildren.h in Headers */,
0FEC852C1BDACDAC0080FF74 /* B3Procedure.h in Headers */,
- FE2B0B691FD227E00075DA5F /* JSCScrambledPtr.h in Headers */,
+ FE2B0B691FD227E00075DA5F /* JSCPoisonedPtr.h in Headers */,
0FEC852D1BDACDAC0080FF74 /* B3ProcedureInlines.h in Headers */,
0F725CAA1C503DED00AD943A /* B3PureCSE.h in Headers */,
43422A671C16267800E2EB98 /* B3ReduceDoubleToFloat.h in Headers */,
Modified: trunk/Source/_javascript_Core/Sources.txt (225619 => 225620)
--- trunk/Source/_javascript_Core/Sources.txt 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/Sources.txt 2017-12-07 06:10:06 UTC (rev 225620)
@@ -772,7 +772,7 @@
runtime/JSAsyncGeneratorFunction.cpp
runtime/JSBoundFunction.cpp
runtime/JSCJSValue.cpp
-runtime/JSCScrambledPtr.cpp
+runtime/JSCPoisonedPtr.cpp
runtime/JSCallee.cpp
runtime/JSCell.cpp
runtime/JSCustomGetterSetterFunction.cpp
Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h (225619 => 225620)
--- trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -26,7 +26,7 @@
#pragma once
#include "ExecutableAllocator.h"
-#include "JSCScrambledPtr.h"
+#include "JSCPoisonedPtr.h"
#include <wtf/DataLog.h>
#include <wtf/PrintStream.h>
#include <wtf/RefPtr.h>
@@ -67,7 +67,7 @@
FunctionPtr(returnType(*value)())
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -75,7 +75,7 @@
FunctionPtr(returnType(*value)(argType1))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -83,7 +83,7 @@
FunctionPtr(returnType(*value)(argType1, argType2))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -91,7 +91,7 @@
FunctionPtr(returnType(*value)(argType1, argType2, argType3))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -99,7 +99,7 @@
FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -107,7 +107,7 @@
FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4, argType5))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -115,7 +115,7 @@
FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4, argType5, argType6))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
// MSVC doesn't seem to treat functions with different calling conventions as
@@ -126,7 +126,7 @@
FunctionPtr(returnType (CDECL *value)())
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -134,7 +134,7 @@
FunctionPtr(returnType (CDECL *value)(argType1))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -142,7 +142,7 @@
FunctionPtr(returnType (CDECL *value)(argType1, argType2))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -150,7 +150,7 @@
FunctionPtr(returnType (CDECL *value)(argType1, argType2, argType3))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -158,7 +158,7 @@
FunctionPtr(returnType (CDECL *value)(argType1, argType2, argType3, argType4))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
#endif
@@ -169,7 +169,7 @@
FunctionPtr(returnType (FASTCALL *value)())
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -177,7 +177,7 @@
FunctionPtr(returnType (FASTCALL *value)(argType1))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -185,7 +185,7 @@
FunctionPtr(returnType (FASTCALL *value)(argType1, argType2))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -193,7 +193,7 @@
FunctionPtr(returnType (FASTCALL *value)(argType1, argType2, argType3))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -201,7 +201,7 @@
FunctionPtr(returnType (FASTCALL *value)(argType1, argType2, argType3, argType4))
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
#endif
@@ -213,7 +213,7 @@
// (I guess on RVTC function pointers have a different constness to GCC/MSVC?)
: m_value((void*)value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -221,12 +221,12 @@
void* value() const
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
return m_value;
}
void* executableAddress() const
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
return m_value;
}
@@ -247,7 +247,7 @@
explicit ReturnAddressPtr(void* value)
: m_value(value)
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -254,13 +254,13 @@
explicit ReturnAddressPtr(FunctionPtr function)
: m_value(function.value())
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
void* value() const
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
return m_value;
}
@@ -288,7 +288,7 @@
: m_value(value)
#endif
{
- m_value.assertIsScrambled();
+ m_value.assertIsPoisoned();
ASSERT(value);
ASSERT_VALID_CODE_POINTER(m_value);
}
@@ -298,8 +298,8 @@
ASSERT(value);
ASSERT_VALID_CODE_POINTER(value);
MacroAssemblerCodePtr result;
- result.m_value = MasmScrambledPtr(value);
- result.m_value.assertIsScrambled();
+ result.m_value = PoisonedMasmPtr(value);
+ result.m_value.assertIsPoisoned();
return result;
}
@@ -309,17 +309,17 @@
: m_value(ra.value())
{
ASSERT(ra.value());
- m_value.assertIsScrambled();
+ m_value.assertIsPoisoned();
ASSERT_VALID_CODE_POINTER(m_value);
}
- MasmScrambledPtr scrambledPtr() const { return m_value; }
+ PoisonedMasmPtr poisonedPtr() const { return m_value; }
template<typename T = void*>
T executableAddress() const
{
- m_value.assertIsScrambled();
- return m_value ? m_value.descrambled<T>() : static_cast<T>(0);
+ m_value.assertIsPoisoned();
+ return m_value.unpoisoned<T>();
}
#if CPU(ARM_THUMB2)
// To use this pointer as a data address remove the decoration.
@@ -326,25 +326,25 @@
template<typename T = void*>
T dataLocation() const
{
- m_value.assertIsScrambled();
+ m_value.assertIsPoisoned();
ASSERT_VALID_CODE_POINTER(m_value);
- return bitwise_cast<T>(m_value ? m_value.descrambled<char*>() - 1 : nullptr);
+ return bitwise_cast<T>(m_value ? m_value.unpoisoned<char*>() - 1 : nullptr);
}
#else
template<typename T = void*>
T dataLocation() const
{
- m_value.assertIsScrambled();
+ m_value.assertIsPoisoned();
ASSERT_VALID_CODE_POINTER(m_value);
- return m_value ? m_value.descrambled<T>() : static_cast<T>(0);
+ return m_value.unpoisoned<T>();
}
#endif
bool operator!() const
{
-#if ENABLE(SCRAMBLED_PTR_ASSERTS)
+#if ENABLE(POISON_ASSERTS)
if (!isEmptyValue() && !isDeletedValue())
- m_value.assertIsScrambled();
+ m_value.assertIsPoisoned();
#endif
return !m_value;
}
@@ -352,17 +352,17 @@
bool operator==(const MacroAssemblerCodePtr& other) const
{
-#if ENABLE(SCRAMBLED_PTR_ASSERTS)
+#if ENABLE(POISON_ASSERTS)
if (!isEmptyValue() && !isDeletedValue())
- m_value.assertIsScrambled();
+ m_value.assertIsPoisoned();
if (!other.isEmptyValue() && !other.isDeletedValue())
- other.m_value.assertIsScrambled();
+ other.m_value.assertIsPoisoned();
#endif
return m_value == other.m_value;
}
// Disallow any casting operations (except for booleans). Instead, the client
- // should be asking for scrambledPtr() or executableAddress() explicitly.
+ // should be asking for poisonedPtr() or executableAddress() explicitly.
template<typename T, typename = std::enable_if_t<!std::is_same<T, bool>::value>>
operator T() = delete;
@@ -389,10 +389,10 @@
static void initialize();
private:
- static MasmScrambledPtr emptyValue() { return MasmScrambledPtr(1); }
- static MasmScrambledPtr deletedValue() { return MasmScrambledPtr(2); }
+ static PoisonedMasmPtr emptyValue() { return PoisonedMasmPtr(1); }
+ static PoisonedMasmPtr deletedValue() { return PoisonedMasmPtr(2); }
- MasmScrambledPtr m_value;
+ PoisonedMasmPtr m_value;
};
struct MacroAssemblerCodePtrHash {
@@ -479,7 +479,7 @@
inline FunctionPtr::FunctionPtr(MacroAssemblerCodePtr ptr)
: m_value(ptr.executableAddress())
{
- MasmScrambledPtr::assertIsNotScrambled(m_value);
+ PoisonedMasmPtr::assertIsNotPoisoned(m_value);
ASSERT_VALID_CODE_POINTER(m_value);
}
Modified: trunk/Source/_javascript_Core/b3/B3LowerMacros.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/b3/B3LowerMacros.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/b3/B3LowerMacros.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -505,12 +505,12 @@
GPRReg index = params[0].gpr();
GPRReg scratch = params.gpScratch(0);
- GPRReg descramblerKey = params.gpScratch(1);
+ GPRReg poisonScratch = params.gpScratch(1);
- jit.move(CCallHelpers::TrustedImm64(g_masmScrambledPtrKey), descramblerKey);
+ jit.move(CCallHelpers::TrustedImm64(g_masmPoison), poisonScratch);
jit.move(CCallHelpers::TrustedImmPtr(jumpTable), scratch);
jit.load64(CCallHelpers::BaseIndex(scratch, index, CCallHelpers::timesPtr()), scratch);
- jit.xor64(descramblerKey, scratch);
+ jit.xor64(poisonScratch, scratch);
jit.jump(scratch);
// These labels are guaranteed to be populated before either late paths or
Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/b3/testb3.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -13030,12 +13030,12 @@
params.proc().addDataSection(sizeof(MacroAssemblerCodePtr) * labels.size()));
GPRReg scratch = params.gpScratch(0);
- GPRReg descramblerKey = params.gpScratch(1);
+ GPRReg poisonScratch = params.gpScratch(1);
jit.move(CCallHelpers::TrustedImmPtr(jumpTable), scratch);
- jit.move(CCallHelpers::TrustedImm64(g_masmScrambledPtrKey), descramblerKey);
+ jit.move(CCallHelpers::TrustedImm64(g_masmPoison), poisonScratch);
jit.load64(CCallHelpers::BaseIndex(scratch, params[0].gpr(), CCallHelpers::timesPtr()), scratch);
- jit.xor64(descramblerKey, scratch);
+ jit.xor64(poisonScratch, scratch);
jit.jump(scratch);
jit.addLinkTask(
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -868,7 +868,7 @@
m_jit.branchPtr(
MacroAssembler::NotEqual,
MacroAssembler::Address(temp.gpr(), Structure::classInfoOffset()),
- TrustedImmPtr(ClassInfoScrambledPtr(expectedClassInfo).bits())));
+ TrustedImmPtr(PoisonedClassInfoPtr(expectedClassInfo).bits())));
noResult(m_currentNode);
}
@@ -8706,7 +8706,7 @@
m_jit.emitLoadStructure(*m_jit.vm(), baseGPR, otherGPR, specifiedGPR);
m_jit.loadPtr(CCallHelpers::Address(otherGPR, Structure::classInfoOffset()), otherGPR);
#if USE(JSVALUE64)
- m_jit.move(CCallHelpers::TrustedImm64(g_classInfoScrambledPtrKey), specifiedGPR);
+ m_jit.move(CCallHelpers::TrustedImm64(g_classInfoPoison), specifiedGPR);
m_jit.xor64(specifiedGPR, otherGPR);
#endif
m_jit.move(CCallHelpers::TrustedImmPtr(node->classInfo()), specifiedGPR);
@@ -9003,7 +9003,7 @@
slowPath);
m_jit.storePtr(
- TrustedImmPtr(ClassInfoScrambledPtr(StringObject::info()).bits()),
+ TrustedImmPtr(PoisonedClassInfoPtr(StringObject::info()).bits()),
JITCompiler::Address(resultGPR, JSDestructibleObject::classInfoOffset()));
#if USE(JSVALUE64)
m_jit.store64(
@@ -9774,7 +9774,7 @@
}
void SpeculativeJIT::emitSwitchIntJump(
- SwitchData* data, GPRReg value, GPRReg scratch, GPRReg descramblerKeyScratch)
+ SwitchData* data, GPRReg value, GPRReg scratch, GPRReg poisonScratch)
{
SimpleJumpTable& table = m_jit.codeBlock()->switchJumpTable(data->switchTableIndex);
table.ensureCTITable();
@@ -9782,15 +9782,15 @@
addBranch(
m_jit.branch32(JITCompiler::AboveOrEqual, value, Imm32(table.ctiOffsets.size())),
data->fallThrough.block);
- UNUSED_PARAM(descramblerKeyScratch); // Placate the 32-bit build.
+ UNUSED_PARAM(poisonScratch); // Placate the 32-bit build.
#if USE(JSVALUE64)
- m_jit.move(TrustedImm64(g_masmScrambledPtrKey), descramblerKeyScratch);
+ m_jit.move(TrustedImm64(g_masmPoison), poisonScratch);
#endif
m_jit.move(TrustedImmPtr(table.ctiOffsets.begin()), scratch);
m_jit.loadPtr(JITCompiler::BaseIndex(scratch, value, JITCompiler::timesPtr()), scratch);
#if USE(JSVALUE64)
- m_jit.xor64(descramblerKeyScratch, scratch);
+ m_jit.xor64(poisonScratch, scratch);
#endif
m_jit.jump(scratch);
data->didUseJumpTable = true;
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -5010,7 +5010,7 @@
LBasicBlock lastNext = m_out.insertNewBlocksBefore(slowCase);
LValue fastResultValue = allocateObject<StringObject>(structure, m_out.intPtrZero, slowCase);
- m_out.storePtr(m_out.constIntPtr(ClassInfoScrambledPtr(StringObject::info()).bits()), fastResultValue, m_heaps.JSDestructibleObject_classInfo);
+ m_out.storePtr(m_out.constIntPtr(PoisonedClassInfoPtr(StringObject::info()).bits()), fastResultValue, m_heaps.JSDestructibleObject_classInfo);
m_out.store64(string, fastResultValue, m_heaps.JSWrapperObject_internalValue);
mutatorFence();
ValueFromBlock fastResult = m_out.anchor(fastResultValue);
@@ -11170,8 +11170,8 @@
LBasicBlock continuation = m_out.newBlock();
LValue structure = loadStructure(cell);
- LValue scrambledClassInfo = m_out.loadPtr(structure, m_heaps.Structure_classInfo);
- LValue classInfo = m_out.bitXor(scrambledClassInfo, m_out.constInt64(g_classInfoScrambledPtrKey));
+ LValue poisonedClassInfo = m_out.loadPtr(structure, m_heaps.Structure_classInfo);
+ LValue classInfo = m_out.bitXor(poisonedClassInfo, m_out.constInt64(g_classInfoPoison));
ValueFromBlock otherAtStart = m_out.anchor(classInfo);
m_out.jump(loop);
Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.h (225619 => 225620)
--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1625,7 +1625,7 @@
void emitAllocateDestructibleObject(VM& vm, GPRReg resultGPR, Structure* structure, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath)
{
emitAllocateJSObject<ClassType>(vm, resultGPR, TrustedImmPtr(structure), TrustedImmPtr(0), scratchGPR1, scratchGPR2, slowPath);
- storePtr(TrustedImmPtr(ClassInfoScrambledPtr(structure->classInfo()).bits()), Address(resultGPR, JSDestructibleObject::classInfoOffset()));
+ storePtr(TrustedImmPtr(PoisonedClassInfoPtr(structure->classInfo()).bits()), Address(resultGPR, JSDestructibleObject::classInfoOffset()));
}
void emitInitializeInlineStorage(GPRReg baseGPR, unsigned inlineCapacity)
Modified: trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h (225619 => 225620)
--- trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -77,7 +77,7 @@
{
loadCellArgument(argument, dst);
emitLoadStructure(*vm(), dst, scratch, dst);
- appendFailure(branchPtr(NotEqual, Address(scratch, Structure::classInfoOffset()), TrustedImmPtr(ClassInfoScrambledPtr(classInfo).bits())));
+ appendFailure(branchPtr(NotEqual, Address(scratch, Structure::classInfoOffset()), TrustedImmPtr(PoisonedClassInfoPtr(classInfo).bits())));
// We have to reload the argument since emitLoadStructure clobbered it.
loadCellArgument(argument, dst);
}
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -214,7 +214,7 @@
// Now we know that we have a CodeBlock, and we're committed to making a fast
// call.
#if USE(JSVALUE64)
- jit.move(CCallHelpers::TrustedImm64(g_masmScrambledPtrKey), GPRInfo::regT1);
+ jit.move(CCallHelpers::TrustedImm64(g_masmPoison), GPRInfo::regT1);
jit.xor64(GPRInfo::regT1, GPRInfo::regT4);
#endif
@@ -1163,7 +1163,7 @@
CCallHelpers::Jump noCode = jit.branchTestPtr(CCallHelpers::Zero, GPRInfo::regT0);
#if USE(JSVALUE64)
- jit.move(CCallHelpers::TrustedImm64(g_masmScrambledPtrKey), GPRInfo::regT1);
+ jit.move(CCallHelpers::TrustedImm64(g_masmPoison), GPRInfo::regT1);
jit.xor64(GPRInfo::regT1, GPRInfo::regT0);
#endif
emitPointerValidation(jit, GPRInfo::regT0);
Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1303,7 +1303,7 @@
execCallee->setCallee(asObject(callee));
vm.hostCallReturnValue = JSValue::decode(callData.native.function(execCallee));
- MasmScrambledPtr::assertIsNotScrambled(LLInt::getCodePtr(getHostCallReturnValue));
+ PoisonedMasmPtr::assertIsNotPoisoned(LLInt::getCodePtr(getHostCallReturnValue));
LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue));
}
@@ -1327,7 +1327,7 @@
execCallee->setCallee(asObject(callee));
vm.hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee));
- MasmScrambledPtr::assertIsNotScrambled(LLInt::getCodePtr(getHostCallReturnValue));
+ PoisonedMasmPtr::assertIsNotPoisoned(LLInt::getCodePtr(getHostCallReturnValue));
LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue));
}
@@ -1368,7 +1368,7 @@
callLinkInfo->machineCodeTarget = codePtr;
}
- MasmScrambledPtr::assertIsNotScrambled(codePtr.executableAddress());
+ PoisonedMasmPtr::assertIsNotPoisoned(codePtr.executableAddress());
LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress());
}
throwScope.release();
@@ -1419,7 +1419,7 @@
codeBlock->linkIncomingCall(exec, callLinkInfo);
}
- MasmScrambledPtr::assertIsNotScrambled(codePtr.executableAddress());
+ PoisonedMasmPtr::assertIsNotPoisoned(codePtr.executableAddress());
LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress());
}
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (225619 => 225620)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1950,7 +1950,7 @@
prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4)
callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1])
else
- loadp _g_masmScrambledPtrKey, t2
+ loadp _g_masmPoison, t2
xorp LLIntCallLinkInfo::machineCodeTarget[t1], t2
prepareCall(t2, t1, t3, t4)
callTargetFunction(t2)
Modified: trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -59,7 +59,7 @@
std::call_once(initializeThreadingOnceFlag, []{
WTF::initializeThreading();
- initializeScrambledPtrKeys();
+ initializePoison();
Options::initialize();
#if ENABLE(WRITE_BARRIER_PROFILING)
WriteBarrierCounters::initialize();
Copied: trunk/Source/_javascript_Core/runtime/JSCPoisonedPtr.cpp (from rev 225619, trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.cpp) (0 => 225620)
--- trunk/Source/_javascript_Core/runtime/JSCPoisonedPtr.cpp (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSCPoisonedPtr.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCPoisonedPtr.h"
+
+namespace JSC {
+
+uintptr_t g_classInfoPoison;
+uintptr_t g_masmPoison;
+
+void initializePoison()
+{
+ static std::once_flag initializeOnceFlag;
+ std::call_once(initializeOnceFlag, [] {
+ g_classInfoPoison = makePoison();
+ g_masmPoison = makePoison();
+ });
+}
+
+} // namespace JSC
+
Copied: trunk/Source/_javascript_Core/runtime/JSCPoisonedPtr.h (from rev 225619, trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.h) (0 => 225620)
--- trunk/Source/_javascript_Core/runtime/JSCPoisonedPtr.h (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSCPoisonedPtr.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Poisoned.h>
+
+namespace JSC {
+
+extern "C" JS_EXPORTDATA uintptr_t g_classInfoPoison;
+extern "C" JS_EXPORTDATA uintptr_t g_masmPoison;
+
+struct ClassInfo;
+
+using PoisonedClassInfoPtr = Poisoned<g_classInfoPoison, const ClassInfo*>;
+using PoisonedMasmPtr = Poisoned<g_masmPoison, void*>;
+
+void initializePoison();
+
+} // namespace JSC
+
Deleted: trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.cpp (225619 => 225620)
--- trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSCScrambledPtr.h"
-
-namespace JSC {
-
-uintptr_t g_classInfoScrambledPtrKey;
-uintptr_t g_masmScrambledPtrKey;
-
-void initializeScrambledPtrKeys()
-{
- static std::once_flag initializeOnceFlag;
- std::call_once(initializeOnceFlag, [] {
- g_classInfoScrambledPtrKey = makeScrambledPtrKey();
- g_masmScrambledPtrKey = makeScrambledPtrKey();
- });
-}
-
-} // namespace JSC
-
Deleted: trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.h (225619 => 225620)
--- trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/runtime/JSCScrambledPtr.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <wtf/ScrambledPtr.h>
-
-namespace JSC {
-
-extern "C" JS_EXPORTDATA uintptr_t g_classInfoScrambledPtrKey;
-extern "C" JS_EXPORTDATA uintptr_t g_masmScrambledPtrKey;
-
-struct ClassInfo;
-
-using ClassInfoScrambledPtr = ScrambledPtr<const ClassInfo*, g_classInfoScrambledPtrKey>;
-using MasmScrambledPtr = ScrambledPtr<void*, g_masmScrambledPtrKey>;
-
-void initializeScrambledPtrKeys();
-
-} // namespace JSC
-
Modified: trunk/Source/_javascript_Core/runtime/JSDestructibleObject.h (225619 => 225620)
--- trunk/Source/_javascript_Core/runtime/JSDestructibleObject.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/runtime/JSDestructibleObject.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -43,7 +43,7 @@
return &vm.destructibleObjectSpace;
}
- const ClassInfo* classInfo() const { return m_classInfo.descrambled(); }
+ const ClassInfo* classInfo() const { return m_classInfo.unpoisoned(); }
static ptrdiff_t classInfoOffset() { return OBJECT_OFFSETOF(JSDestructibleObject, m_classInfo); }
@@ -56,7 +56,7 @@
}
private:
- ClassInfoScrambledPtr m_classInfo;
+ PoisonedClassInfoPtr m_classInfo;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h (225619 => 225620)
--- trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -94,7 +94,7 @@
return &vm.segmentedVariableObjectSpace;
}
- const ClassInfo* classInfo() const { return m_classInfo.descrambled(); }
+ const ClassInfo* classInfo() const { return m_classInfo.unpoisoned(); }
protected:
JSSegmentedVariableObject(VM&, Structure*, JSScope*);
@@ -107,7 +107,7 @@
SegmentedVector<WriteBarrier<Unknown>, 16> m_variables;
ConcurrentJSLock m_lock;
bool m_alreadyDestroyed { false }; // We use these assertions to check that we aren't doing ancient hacks that result in this being destroyed more than once.
- ClassInfoScrambledPtr m_classInfo;
+ PoisonedClassInfoPtr m_classInfo;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/Structure.h (225619 => 225620)
--- trunk/Source/_javascript_Core/runtime/Structure.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/runtime/Structure.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -468,7 +468,7 @@
void setObjectToStringValue(ExecState*, VM&, JSString* value, PropertySlot toStringTagSymbolSlot);
- const ClassInfo* classInfo() const { return m_classInfo.descrambled(); }
+ const ClassInfo* classInfo() const { return m_classInfo.unpoisoned(); }
static ptrdiff_t structureIDOffset()
{
@@ -798,7 +798,7 @@
RefPtr<UniquedStringImpl> m_nameInPrevious;
- ClassInfoScrambledPtr m_classInfo;
+ PoisonedClassInfoPtr m_classInfo;
StructureTransitionTable m_transitionTable;
Modified: trunk/Source/_javascript_Core/runtime/VM.h (225619 => 225620)
--- trunk/Source/_javascript_Core/runtime/VM.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -414,7 +414,7 @@
std::unique_ptr<PromiseDeferredTimer> promiseDeferredTimer;
JSCell* currentlyDestructingCallbackObject;
- ClassInfoScrambledPtr currentlyDestructingCallbackObjectClassInfo;
+ PoisonedClassInfoPtr currentlyDestructingCallbackObjectClassInfo;
AtomicStringTable* m_atomicStringTable;
WTF::SymbolRegistry m_symbolRegistry;
Modified: trunk/Source/WTF/ChangeLog (225619 => 225620)
--- trunk/Source/WTF/ChangeLog 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/WTF/ChangeLog 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1,3 +1,53 @@
+2017-12-06 Mark Lam <mark....@apple.com>
+
+ Refactoring: Rename ScrambledPtr to Poisoned.
+ https://bugs.webkit.org/show_bug.cgi?id=180514
+
+ Reviewed by Saam Barati.
+
+ We're switching our nomenclature to "poisoning" instead of "scrambling" pointers.
+ This allows us to use shorter names.
+
+ This patch is almost purely refactoring, except for one change: the PoisonedImpl
+ template class (previously ScrambledPtr) has been modified to allow usage of
+ a constexpr uint32_t poison value (see Int32Poisoned) in addition to a runtime
+ determined uintptr_t poison value (see Poisoned).
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
+ (WTF::makePoison):
+ (WTF::makeScrambledPtrKey): Deleted.
+ * wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
+ (WTF::PoisonedImpl::PoisonedImpl):
+ (WTF::PoisonedImpl::assertIsPoisoned const):
+ (WTF::PoisonedImpl::assertIsNotPoisoned const):
+ (WTF::PoisonedImpl::unpoisoned const):
+ (WTF::PoisonedImpl::operator-> const):
+ (WTF::PoisonedImpl::bits const):
+ (WTF::PoisonedImpl::operator! const):
+ (WTF::PoisonedImpl::operator bool const):
+ (WTF::PoisonedImpl::operator== const):
+ (WTF::PoisonedImpl::operator==):
+ (WTF::PoisonedImpl::operator=):
+ (WTF::PoisonedImpl::poison):
+ (WTF::PoisonedImpl::unpoison):
+ (WTF::ScrambledPtr::ScrambledPtr): Deleted.
+ (WTF::ScrambledPtr::assertIsScrambled const): Deleted.
+ (WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
+ (WTF::ScrambledPtr::descrambled const): Deleted.
+ (WTF::ScrambledPtr::operator-> const): Deleted.
+ (WTF::ScrambledPtr::bits const): Deleted.
+ (WTF::ScrambledPtr::operator! const): Deleted.
+ (WTF::ScrambledPtr::operator bool const): Deleted.
+ (WTF::ScrambledPtr::operator== const): Deleted.
+ (WTF::ScrambledPtr::operator==): Deleted.
+ (WTF::ScrambledPtr::operator=): Deleted.
+ (WTF::ScrambledPtr::scramble): Deleted.
+ (WTF::ScrambledPtr::descramble): Deleted.
+ * wtf/ScrambledPtr.cpp: Removed.
+ * wtf/ScrambledPtr.h: Removed.
+
2017-12-02 Darin Adler <da...@apple.com>
Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (225619 => 225620)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-12-07 06:10:06 UTC (rev 225620)
@@ -149,7 +149,7 @@
E38D6E271F5522E300A75CC4 /* StringBuilderJSON.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38D6E261F5522E300A75CC4 /* StringBuilderJSON.cpp */; };
E4A0AD391A96245500536DF6 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD371A96245500536DF6 /* WorkQueue.cpp */; };
E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */; };
- FE85416E1FBE285D008DA5DA /* ScrambledPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE85416C1FBE285B008DA5DA /* ScrambledPtr.cpp */; };
+ FE85416E1FBE285D008DA5DA /* Poisoned.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE85416C1FBE285B008DA5DA /* Poisoned.cpp */; };
FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
/* End PBXBuildFile section */
@@ -610,8 +610,8 @@
EF7D6CD59D8642A8A0DA86AD /* StackTrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackTrace.h; sourceTree = "<group>"; };
F72BBDB107FA424886178B9E /* SymbolImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolImpl.cpp; sourceTree = "<group>"; };
FE8225301B2A1E5B00BA68FD /* NakedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedPtr.h; sourceTree = "<group>"; };
- FE85416C1FBE285B008DA5DA /* ScrambledPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrambledPtr.cpp; sourceTree = "<group>"; };
- FE85416D1FBE285C008DA5DA /* ScrambledPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrambledPtr.h; sourceTree = "<group>"; };
+ FE85416C1FBE285B008DA5DA /* Poisoned.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Poisoned.cpp; sourceTree = "<group>"; };
+ FE85416D1FBE285C008DA5DA /* Poisoned.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Poisoned.h; sourceTree = "<group>"; };
FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForbidHeapAllocation.h; sourceTree = "<group>"; };
FE8925AF1D00DAEC0046907E /* Indenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Indenter.h; sourceTree = "<group>"; };
FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
@@ -965,6 +965,8 @@
A876DBD7151816E500DADB95 /* Platform.h */,
E3200AB41E9A536D003B59D2 /* PlatformRegisters.h */,
0FF860941BCCBD740045127F /* PointerComparison.h */,
+ FE85416C1FBE285B008DA5DA /* Poisoned.cpp */,
+ FE85416D1FBE285C008DA5DA /* Poisoned.h */,
0F9D335D165DBA73005AD387 /* PrintStream.cpp */,
0F9D335E165DBA73005AD387 /* PrintStream.h */,
53EC253C1E95AD30000831B9 /* PriorityQueue.h */,
@@ -1001,8 +1003,6 @@
1469419516EAAFF80024E146 /* SchedulePairMac.mm */,
1A3524AA1D63A2FF0031729B /* Scope.h */,
0FEC84B01BDACD390080FF74 /* ScopedLambda.h */,
- FE85416C1FBE285B008DA5DA /* ScrambledPtr.cpp */,
- FE85416D1FBE285C008DA5DA /* ScrambledPtr.h */,
0F66B2841DC97BAB004A1D3F /* Seconds.cpp */,
0F66B2851DC97BAB004A1D3F /* Seconds.h */,
A8A47306151A825B004123FF /* SegmentedVector.h */,
@@ -1462,7 +1462,7 @@
1469419316EAAF6D0024E146 /* RunLoopTimerCF.cpp in Sources */,
1469419916EAB0410024E146 /* SchedulePairCF.cpp in Sources */,
1469419716EAAFF80024E146 /* SchedulePairMac.mm in Sources */,
- FE85416E1FBE285D008DA5DA /* ScrambledPtr.cpp in Sources */,
+ FE85416E1FBE285D008DA5DA /* Poisoned.cpp in Sources */,
0F66B28E1DC97BAB004A1D3F /* Seconds.cpp in Sources */,
A8A47421151A825B004123FF /* SHA1.cpp in Sources */,
5311BD531EA71CAD00525281 /* Signals.cpp in Sources */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (225619 => 225620)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2017-12-07 06:10:06 UTC (rev 225620)
@@ -107,6 +107,7 @@
ParkingLot.h
Platform.h
PlatformRegisters.h
+ Poisoned.h
PrintStream.h
ProcessID.h
RAMSize.h
@@ -130,7 +131,6 @@
SharedTask.h
SaturatedArithmetic.h
ScopedLambda.h
- ScrambledPtr.h
Seconds.h
SegmentedVector.h
SmallPtrSet.h
@@ -258,6 +258,7 @@
ParallelHelperPool.cpp
ParallelJobsGeneric.cpp
ParkingLot.cpp
+ Poisoned.cpp
PrintStream.cpp
RAMSize.cpp
RandomDevice.cpp
@@ -266,7 +267,6 @@
RefCountedLeakCounter.cpp
RunLoop.cpp
SHA1.cpp
- ScrambledPtr.cpp
Seconds.cpp
SixCharacterHash.cpp
StackBounds.cpp
Copied: trunk/Source/WTF/wtf/Poisoned.cpp (from rev 225619, trunk/Source/WTF/wtf/ScrambledPtr.cpp) (0 => 225620)
--- trunk/Source/WTF/wtf/Poisoned.cpp (rev 0)
+++ trunk/Source/WTF/wtf/Poisoned.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Poisoned.h"
+
+#include <wtf/CryptographicallyRandomNumber.h>
+
+namespace WTF {
+
+uintptr_t makePoison()
+{
+ uintptr_t key = cryptographicallyRandomNumber();
+#if USE(JSVALUE64) && !OS(WINDOWS)
+ key = (key << 32) ^ (static_cast<uintptr_t>(cryptographicallyRandomNumber()) << 3);
+ // Ensure that the poisoned bits (pointer ^ key) do not make a valid pointer and
+ // cannot be 0. We ensure that it is zero so that the poisoned bits can also be
+ // used for a notmal zero check without needing to decoded first.
+ key |= (static_cast<uintptr_t>(0x1) << 63);
+#else
+ key = 0; // Poisoning is not supported on 32-bit or non-darwin platforms yet.
+#endif
+ return key;
+}
+
+} // namespace WTF
+
Copied: trunk/Source/WTF/wtf/Poisoned.h (from rev 225619, trunk/Source/WTF/wtf/ScrambledPtr.h) (0 => 225620)
--- trunk/Source/WTF/wtf/Poisoned.h (rev 0)
+++ trunk/Source/WTF/wtf/Poisoned.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Assertions.h>
+
+#define ENABLE_POISON_ASSERTS 0
+
+// Not currently supported for 32-bit or OS(WINDOWS) builds (because of missing llint support).
+// Make sure it's disabled.
+#if USE(JSVALUE32_64) || OS(WINDOWS)
+#undef ENABLE_POISON_ASSERTS
+#define ENABLE_POISON_ASSERTS 0
+#endif
+
+namespace WTF {
+
+using PoisonedBits = uintptr_t;
+
+template<typename KeyType, KeyType key, typename T, typename = std::enable_if_t<std::is_pointer<T>::value>>
+class PoisonedImpl {
+public:
+ PoisonedImpl() { }
+
+ explicit PoisonedImpl(T ptr)
+ : m_poisonedBits(poison(ptr))
+ {
+ ASSERT(ptr && m_poisonedBits);
+ }
+
+ PoisonedImpl(const PoisonedImpl&) = default;
+
+ explicit PoisonedImpl(PoisonedBits poisonedBits)
+ : m_poisonedBits(poisonedBits)
+ {
+ ASSERT(m_poisonedBits);
+ }
+
+#if ENABLE(POISON_ASSERTS)
+ template<typename U = void*>
+ static bool isPoisoned(U value) { return !value || (reinterpret_cast<uintptr_t>(value) & 0xffff000000000000); }
+ template<typename U = void*>
+ static void assertIsPoisoned(U value) { RELEASE_ASSERT(isPoisoned(value)); }
+ template<typename U = void*>
+ static void assertIsNotPoisoned(U value) { RELEASE_ASSERT(!isPoisoned(value)); }
+#else
+ template<typename U = void*> static void assertIsPoisoned(U) { }
+ template<typename U = void*> static void assertIsNotPoisoned(U) { }
+#endif
+ void assertIsPoisoned() const { assertIsPoisoned(m_poisonedBits); }
+ void assertIsNotPoisoned() const { assertIsNotPoisoned(m_poisonedBits); }
+
+ template<typename U = T>
+ U unpoisoned() const { return unpoison<U>(m_poisonedBits); }
+
+ ALWAYS_INLINE T operator->() const { return unpoison<T>(m_poisonedBits); }
+
+ template<typename U = PoisonedBits>
+ U bits() const { return bitwise_cast<U>(m_poisonedBits); }
+
+ bool operator!() const { return !m_poisonedBits; }
+ explicit operator bool() const { return !!m_poisonedBits; }
+
+ bool operator==(const PoisonedImpl& b) const
+ {
+ return m_poisonedBits == b.m_poisonedBits;
+ }
+
+ template<typename PtrType = void*, typename = typename std::enable_if<std::is_pointer<PtrType>::value>::type>
+ bool operator==(const PtrType b)
+ {
+ return unpoisoned<PtrType>() == b;
+ }
+
+ PoisonedImpl& operator=(T ptr)
+ {
+ m_poisonedBits = poison(ptr);
+ return *this;
+ }
+ PoisonedImpl& operator=(const PoisonedImpl&) = default;
+
+private:
+#if USE(JSVALUE64)
+ template<typename U>
+ ALWAYS_INLINE static PoisonedBits poison(U ptr) { return ptr ? bitwise_cast<PoisonedBits>(ptr) ^ key : 0; }
+ template<typename U>
+ ALWAYS_INLINE static U unpoison(PoisonedBits poisonedBits) { return poisonedBits ? bitwise_cast<U>(poisonedBits ^ key) : bitwise_cast<U>(0ll); }
+#else
+ template<typename U>
+ ALWAYS_INLINE static PoisonedBits poison(U ptr) { return bitwise_cast<PoisonedBits>(ptr); }
+ template<typename U>
+ ALWAYS_INLINE static U unpoison(PoisonedBits poisonedBits) { return bitwise_cast<U>(poisonedBits); }
+#endif
+
+ PoisonedBits m_poisonedBits { 0 };
+};
+
+template<uintptr_t& key, typename T>
+using Poisoned = PoisonedImpl<const uintptr_t&, key, T>;
+
+#if USE(JSVALUE64)
+template<uint32_t key, typename T>
+using Int32Poisoned = PoisonedImpl<uintptr_t, static_cast<uintptr_t>(key) << 32, T>;
+#else
+template<uint32_t, typename T>
+using Int32Poisoned = PoisonedImpl<uintptr_t, 0, T>;
+#endif
+
+WTF_EXPORT_PRIVATE uintptr_t makePoison();
+
+} // namespace WTF
+
+using WTF::Int32Poisoned;
+using WTF::Poisoned;
+using WTF::PoisonedBits;
+using WTF::makePoison;
+
Deleted: trunk/Source/WTF/wtf/ScrambledPtr.cpp (225619 => 225620)
--- trunk/Source/WTF/wtf/ScrambledPtr.cpp 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/WTF/wtf/ScrambledPtr.cpp 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScrambledPtr.h"
-
-#include <wtf/CryptographicallyRandomNumber.h>
-
-namespace WTF {
-
-uintptr_t makeScrambledPtrKey()
-{
- uintptr_t key = cryptographicallyRandomNumber();
-#if USE(JSVALUE64) && !OS(WINDOWS)
- key = (key << 32) ^ (static_cast<uintptr_t>(cryptographicallyRandomNumber()) << 3);
- // Ensure that the scrambled bits (pointer ^ key) do not make a valid pointer and
- // cannot be 0. We ensure that it is zero so that the scrambled bits can also be
- // used for a notmal zero check without needing to descramble first.
- key |= (static_cast<uintptr_t>(0x1) << 63);
-#else
- key = 0; // Scrambling is not supported on 32-bit or non-darwin platforms yet.
-#endif
- return key;
-}
-
-} // namespace WTF
-
Deleted: trunk/Source/WTF/wtf/ScrambledPtr.h (225619 => 225620)
--- trunk/Source/WTF/wtf/ScrambledPtr.h 2017-12-07 05:39:37 UTC (rev 225619)
+++ trunk/Source/WTF/wtf/ScrambledPtr.h 2017-12-07 06:10:06 UTC (rev 225620)
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <wtf/Assertions.h>
-
-#define ENABLE_SCRAMBLED_PTR_ASSERTS 0
-
-// Not currently supported for 32-bit or OS(WINDOWS) builds (because of missing llint support).
-// Make sure it's disabled.
-#if USE(JSVALUE32_64) || OS(WINDOWS)
-#undef ENABLE_SCRAMBLED_PTR_ASSERTS
-#define ENABLE_SCRAMBLED_PTR_ASSERTS 0
-#endif
-
-namespace WTF {
-
-using ScrambledPtrBits = uintptr_t;
-
-template<typename T, uintptr_t& key, typename = std::enable_if_t<std::is_pointer<T>::value>>
-class ScrambledPtr {
-public:
- ScrambledPtr() { }
-
- explicit ScrambledPtr(T ptr)
- : m_scrambledBits(scramble(ptr))
- {
- ASSERT(ptr && m_scrambledBits);
- }
-
- ScrambledPtr(const ScrambledPtr&) = default;
-
- explicit ScrambledPtr(ScrambledPtrBits scrambledBits)
- : m_scrambledBits(scrambledBits)
- {
- ASSERT(m_scrambledBits);
- }
-
-#if ENABLE(SCRAMBLED_PTR_ASSERTS)
- template<typename U = void*>
- static bool isScrambled(U value) { return !value || (reinterpret_cast<uintptr_t>(value) & 0xffff000000000000); }
- template<typename U = void*>
- static void assertIsScrambled(U value) { RELEASE_ASSERT(isScrambled(value)); }
- template<typename U = void*>
- static void assertIsNotScrambled(U value) { RELEASE_ASSERT(!isScrambled(value)); }
-#else
- template<typename U = void*> static void assertIsScrambled(U) { }
- template<typename U = void*> static void assertIsNotScrambled(U) { }
-#endif
- void assertIsScrambled() const { assertIsScrambled(m_scrambledBits); }
- void assertIsNotScrambled() const { assertIsNotScrambled(m_scrambledBits); }
-
- template<typename U = T>
- U descrambled() const { return descramble<U>(m_scrambledBits); }
-
- ALWAYS_INLINE T operator->() const { return descramble<T>(m_scrambledBits); }
-
- template<typename U = ScrambledPtrBits>
- U bits() const { return bitwise_cast<U>(m_scrambledBits); }
-
- bool operator!() const { return !m_scrambledBits; }
- explicit operator bool() const { return !!m_scrambledBits; }
-
- bool operator==(const ScrambledPtr& b) const
- {
- return m_scrambledBits == b.m_scrambledBits;
- }
-
- template<typename PtrType = void*, typename = typename std::enable_if<std::is_pointer<PtrType>::value>::type>
- bool operator==(const PtrType b)
- {
- return descrambled<PtrType>() == b;
- }
-
- ScrambledPtr& operator=(T ptr)
- {
- m_scrambledBits = ptr ? scramble(ptr) : 0;
- return *this;
- }
- ScrambledPtr& operator=(const ScrambledPtr&) = default;
-
-private:
-#if USE(JSVALUE64)
- template<typename U>
- ALWAYS_INLINE static ScrambledPtrBits scramble(U ptr) { return bitwise_cast<ScrambledPtrBits>(ptr) ^ key; }
- template<typename U>
- ALWAYS_INLINE static U descramble(ScrambledPtrBits scrambledBits) { return bitwise_cast<U>(scrambledBits ^ key); }
-#else
- template<typename U>
- ALWAYS_INLINE static ScrambledPtrBits scramble(U ptr) { return bitwise_cast<ScrambledPtrBits>(ptr); }
- template<typename U>
- ALWAYS_INLINE static U descramble(ScrambledPtrBits scrambledBits) { return bitwise_cast<U>(scrambledBits); }
-#endif
-
- ScrambledPtrBits m_scrambledBits { 0 };
-};
-
-void initializeScrambledPtr();
-WTF_EXPORT_PRIVATE uintptr_t makeScrambledPtrKey();
-
-} // namespace WTF
-
-using WTF::ScrambledPtr;
-using WTF::ScrambledPtrBits;
-using WTF::makeScrambledPtrKey;
-