WebKit Bugzilla
Attachment 339520 Details for
Bug 185292
: Remove std::random_shuffle
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185292-20180504134709.patch (text/plain), 2.77 KB, created by
Yusuke Suzuki
on 2018-05-03 21:47:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-05-03 21:47:10 PDT
Size:
2.77 KB
patch
obsolete
>Subversion Revision: 231345 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 45eea660a3f2da3b9bee58e200641d0eaebf8b51..4ed6789295bdedd9b23c3431645c0f7c89a5b730 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ Remove std::random_shuffle >+ https://bugs.webkit.org/show_bug.cgi?id=185292 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ std::random_shuffle is deprecated in C++14 and removed in C++17, >+ since std::random_shuffle relies on rand and srand. >+ Use std::shuffle instead. >+ >+ * jit/BinarySwitch.cpp: >+ (JSC::RandomNumberGenerator::RandomNumberGenerator): >+ (JSC::RandomNumberGenerator::operator()): >+ (JSC::RandomNumberGenerator::min): >+ (JSC::RandomNumberGenerator::max): >+ (JSC::BinarySwitch::build): >+ > 2018-05-03 Saam Barati <sbarati@apple.com> > > Don't prevent CreateThis being folded to NewObject when the structure is poly proto >diff --git a/Source/JavaScriptCore/jit/BinarySwitch.cpp b/Source/JavaScriptCore/jit/BinarySwitch.cpp >index 0eab5651925329e17b3f5ca25db134ab4dd9a672..e8e657e444b5cc2998205943d16ad49862a36275 100644 >--- a/Source/JavaScriptCore/jit/BinarySwitch.cpp >+++ b/Source/JavaScriptCore/jit/BinarySwitch.cpp >@@ -137,6 +137,27 @@ bool BinarySwitch::advance(MacroAssembler& jit) > } > } > >+class RandomNumberGenerator { >+public: >+ using result_type = uint32_t; >+ >+ RandomNumberGenerator(WeakRandom& weakRandom) >+ : m_weakRandom(weakRandom) >+ { >+ } >+ >+ uint32_t operator()() >+ { >+ return m_weakRandom.getUint32(); >+ } >+ >+ static constexpr uint32_t min() { return std::numeric_limits<uint32_t>::min(); } >+ static constexpr uint32_t max() { return std::numeric_limits<uint32_t>::max(); } >+ >+private: >+ WeakRandom& m_weakRandom; >+}; >+ > void BinarySwitch::build(unsigned start, bool hardStart, unsigned end) > { > if (BinarySwitchInternal::verbose) >@@ -195,13 +216,9 @@ void BinarySwitch::build(unsigned start, bool hardStart, unsigned end) > for (unsigned i = 0; i < size; ++i) > localCaseIndices.append(start + i); > >- std::random_shuffle( >+ std::shuffle( > localCaseIndices.begin(), localCaseIndices.end(), >- [this] (unsigned n) { >- // We use modulo to get a random number in the range we want fully knowing that >- // this introduces a tiny amount of bias, but we're fine with such tiny bias. >- return m_weakRandom.getUint32() % n; >- }); >+ RandomNumberGenerator(m_weakRandom)); > > for (unsigned i = 0; i < size - 1; ++i) { > append(BranchCode(NotEqualToPush, localCaseIndices[i]));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185292
: 339520