summaryrefslogtreecommitdiffstats
path: root/js/src/vm/Runtime.h
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-09-12 05:41:41 -0500
committertrav90 <travawine@palemoon.org>2018-09-12 05:41:41 -0500
commit847f12e88faf1b9a34d0b6fa9b262dfed209aedb (patch)
treecfec69fc3613d921f0f466574f8c67695f246a96 /js/src/vm/Runtime.h
parent2f64d5eeecdeb995504748e3da37964d22cc27f0 (diff)
downloadUXP-847f12e88faf1b9a34d0b6fa9b262dfed209aedb.tar
UXP-847f12e88faf1b9a34d0b6fa9b262dfed209aedb.tar.gz
UXP-847f12e88faf1b9a34d0b6fa9b262dfed209aedb.tar.lz
UXP-847f12e88faf1b9a34d0b6fa9b262dfed209aedb.tar.xz
UXP-847f12e88faf1b9a34d0b6fa9b262dfed209aedb.zip
Stop using PodZero in several places to initialize values of non-trivial type
Diffstat (limited to 'js/src/vm/Runtime.h')
-rw-r--r--js/src/vm/Runtime.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h
index 735adadf2..f354d2069 100644
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -11,11 +11,11 @@
#include "mozilla/Attributes.h"
#include "mozilla/LinkedList.h"
#include "mozilla/MemoryReporting.h"
-#include "mozilla/PodOperations.h"
#include "mozilla/Scoped.h"
#include "mozilla/ThreadLocal.h"
#include "mozilla/Vector.h"
+#include <algorithm>
#include <setjmp.h>
#include "jsatom.h"
@@ -1504,20 +1504,21 @@ PerThreadData::exclusiveThreadsPresent()
static MOZ_ALWAYS_INLINE void
MakeRangeGCSafe(Value* vec, size_t len)
{
- mozilla::PodZero(vec, len);
+ // Don't PodZero here because JS::Value is non-trivial.
+ for (size_t i = 0; i < len; i++)
+ vec[i].setDouble(+0.0);
}
static MOZ_ALWAYS_INLINE void
MakeRangeGCSafe(Value* beg, Value* end)
{
- mozilla::PodZero(beg, end - beg);
+ MakeRangeGCSafe(beg, end - beg);
}
static MOZ_ALWAYS_INLINE void
MakeRangeGCSafe(jsid* beg, jsid* end)
{
- for (jsid* id = beg; id != end; ++id)
- *id = INT_TO_JSID(0);
+ std::fill(beg, end, INT_TO_JSID(0));
}
static MOZ_ALWAYS_INLINE void
@@ -1529,13 +1530,13 @@ MakeRangeGCSafe(jsid* vec, size_t len)
static MOZ_ALWAYS_INLINE void
MakeRangeGCSafe(Shape** beg, Shape** end)
{
- mozilla::PodZero(beg, end - beg);
+ std::fill(beg, end, nullptr);
}
static MOZ_ALWAYS_INLINE void
MakeRangeGCSafe(Shape** vec, size_t len)
{
- mozilla::PodZero(vec, len);
+ MakeRangeGCSafe(vec, vec + len);
}
static MOZ_ALWAYS_INLINE void