author | Jeff Walden <jwalden@mit.edu> |
Fri, 18 May 2018 11:44:44 -0700 (2018-05-18) | |
changeset 418924 | 562e5ddb5332496d0198e397ce6d005c33e9cffc |
parent 418923 | 63d37d73f5ae5d76fd50a469a9c67fc9f38b3b82 |
child 418925 | 441f59473bfa21d92affe6de99392f0975ac0311 |
push id | 103419 |
push user | jwalden@mit.edu |
push date | Fri, 18 May 2018 19:33:51 +0000 (2018-05-18) |
treeherder | mozilla-inbound@7658d2d1e0d7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jandem |
bugs | 1462544 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/src/ds/Bitmap.cpp | file | annotate | diff | comparison | revisions | |
js/src/ds/Bitmap.h | file | annotate | diff | comparison | revisions |
--- a/js/src/ds/Bitmap.cpp +++ b/js/src/ds/Bitmap.cpp @@ -1,16 +1,18 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ds/Bitmap.h" +#include <algorithm> + using namespace js; SparseBitmap::~SparseBitmap() { if (data.initialized()) { for (Data::Range r(data.all()); !r.empty(); r.popFront()) js_delete(r.front().value()); } @@ -28,17 +30,17 @@ SparseBitmap::sizeOfExcludingThis(mozill SparseBitmap::BitBlock& SparseBitmap::createBlock(Data::AddPtr p, size_t blockId) { MOZ_ASSERT(!p); AutoEnterOOMUnsafeRegion oomUnsafe; BitBlock* block = js_new<BitBlock>(); if (!block || !data.add(p, blockId, block)) oomUnsafe.crash("Bitmap OOM"); - PodZero(block); + std::fill(block->begin(), block->end(), 0); return *block; } bool SparseBitmap::getBit(size_t bit) const { size_t word = bit / JS_BITS_PER_WORD; size_t blockWord = blockStartWord(word);
--- a/js/src/ds/Bitmap.h +++ b/js/src/ds/Bitmap.h @@ -6,17 +6,16 @@ #ifndef ds_Bitmap_h #define ds_Bitmap_h #include "mozilla/Array.h" #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include "mozilla/MemoryChecking.h" -#include "mozilla/PodOperations.h" #include <algorithm> #include <stddef.h> #include <stdint.h> #include "js/AllocPolicy.h" #include "js/HashTable.h" #include "js/Vector.h" @@ -49,17 +48,19 @@ class DenseBitmap } size_t numWords() const { return data.length(); } uintptr_t word(size_t i) const { return data[i]; } uintptr_t& word(size_t i) { return data[i]; } void copyBitsFrom(size_t wordStart, size_t numWords, uintptr_t* source) { MOZ_ASSERT(wordStart + numWords <= data.length()); - mozilla::PodCopy(&data[wordStart], source, numWords); + // Use std::copy and not std::copy_n because the former requires no + // overlap and so provides extra opportunity to optimize. + std::copy(source, source + numWords, &data[wordStart]); } void bitwiseOrRangeInto(size_t wordStart, size_t numWords, uintptr_t* target) const { for (size_t i = 0; i < numWords; i++) target[i] |= data[wordStart + i]; } };