Merge inbound to mozilla-central. a=merge

This commit is contained in:
Narcis Beleuzu 2018-12-20 23:56:42 +02:00
commit 7cfde3000c
42 changed files with 576 additions and 270 deletions

View File

@ -75,11 +75,6 @@ tasks:
- $if: 'repository.project == "try"'
then:
"notify.email.${ownerEmail}.on-completed"
# BUG 1500166 Notify ciduty by email if a nightly hook fails
- "notify.email.ciduty+failedcron@mozilla.com.on-failed"
- "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
- "notify.email.sheriffs+failedcron@mozilla.com.on-failed"
- "notify.email.sheriffs+exceptioncron@mozilla.com.on-exception"
# These are the old index routes for the decision task.
# They are still here so external tools that referenced them continue to work.
- "index.gecko.v2.${repository.project}.latest.firefox.decision"
@ -96,6 +91,11 @@ tasks:
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
# list each cron task on this revision, so actions can find them
- 'index.gecko.v2.${repository.project}.revision.${push.revision}.cron.${as_slugid("decision")}'
# BUG 1500166 Notify ciduty by email if a nightly hook fails
- "notify.email.ciduty+failedcron@mozilla.com.on-failed"
- "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
- "notify.email.sheriffs+failedcron@mozilla.org.on-failed"
- "notify.email.sheriffs+exceptioncron@mozilla.org.on-exception"
# These are the old index routes for the decision task.
- "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
@ -246,4 +246,4 @@ tasks:
link:
text: "Treeherder Jobs"
href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"

View File

@ -1515,8 +1515,11 @@ pref("browser.ping-centre.production.endpoint", "https://tiles.services.mozilla.
// Enable GMP support in the addon manager.
pref("media.gmp-provider.enabled", true);
// Enable blocking access to storage from tracking resources by default
// Enable blocking access to storage from tracking resources only in nightly
// and early beta. By default the value is 0: BEHAVIOR_ACCEPT
#ifdef NIGHTLY_OR_EARLY_BETA
pref("network.cookie.cookieBehavior", 4 /* BEHAVIOR_REJECT_TRACKER */);
#endif
pref("browser.contentblocking.allowlist.storage.enabled", true);

View File

@ -2,6 +2,7 @@
* 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/. */
import HandleEventMixin from "../mixins/HandleEventMixin.js";
import ObservedPropertiesMixin from "../mixins/ObservedPropertiesMixin.js";
import RichOption from "./rich-option.js";
@ -13,7 +14,7 @@ import RichOption from "./rich-option.js";
* Note: The only supported way to change the selected option is via the
* `value` setter.
*/
export default class RichSelect extends ObservedPropertiesMixin(HTMLElement) {
export default class RichSelect extends HandleEventMixin(ObservedPropertiesMixin(HTMLElement)) {
static get observedAttributes() {
return [
"disabled",
@ -57,15 +58,10 @@ export default class RichSelect extends ObservedPropertiesMixin(HTMLElement) {
return this.popupBox.querySelector(`:scope > [value="${CSS.escape(value)}"]`);
}
handleEvent(event) {
switch (event.type) {
case "change": {
// Since the render function depends on the popupBox's value, we need to
// re-render if the value changes.
this.render();
break;
}
}
onChange(event) {
// Since the render function depends on the popupBox's value, we need to
// re-render if the value changes.
this.render();
}
render() {

View File

@ -7,6 +7,7 @@ import LabelledCheckbox from "../components/labelled-checkbox.js";
import PaymentRequestPage from "../components/payment-request-page.js";
import PaymentStateSubscriberMixin from "../mixins/PaymentStateSubscriberMixin.js";
import paymentRequest from "../paymentRequest.js";
import HandleEventMixin from "../mixins/HandleEventMixin.js";
/* import-globals-from ../unprivileged-fallbacks.js */
/**
@ -20,7 +21,8 @@ import paymentRequest from "../paymentRequest.js";
* as it will be much easier to share the logic once we switch to Fluent.
*/
export default class AddressForm extends PaymentStateSubscriberMixin(PaymentRequestPage) {
export default class AddressForm extends
HandleEventMixin(PaymentStateSubscriberMixin(PaymentRequestPage)) {
constructor() {
super();
@ -216,32 +218,18 @@ export default class AddressForm extends PaymentStateSubscriberMixin(PaymentRequ
this.updateSaveButtonState();
}
handleEvent(event) {
switch (event.type) {
case "change": {
if (event.target.id == "country") {
this.updateRequiredState();
}
this.updateSaveButtonState();
break;
}
case "click": {
this.onClick(event);
break;
}
case "input": {
this.onInput(event);
break;
}
case "invalid": {
if (event.target instanceof HTMLFormElement) {
this.onInvalidForm(event);
break;
}
onChange(event) {
if (event.target.id == "country") {
this.updateRequiredState();
}
this.updateSaveButtonState();
}
this.onInvalidField(event);
break;
}
onInvalid(event) {
if (event.target instanceof HTMLFormElement) {
this.onInvalidForm(event);
} else {
this.onInvalidField(event);
}
}

View File

@ -6,6 +6,7 @@ import AddressForm from "./address-form.js";
import AddressOption from "../components/address-option.js";
import RichPicker from "./rich-picker.js";
import paymentRequest from "../paymentRequest.js";
import HandleEventMixin from "../mixins/HandleEventMixin.js";
/**
* <address-picker></address-picker>
@ -13,7 +14,7 @@ import paymentRequest from "../paymentRequest.js";
* <address-option> listening to savedAddresses & tempAddresses.
*/
export default class AddressPicker extends RichPicker {
export default class AddressPicker extends HandleEventMixin(RichPicker) {
static get pickerAttributes() {
return [
"address-fields",
@ -197,18 +198,6 @@ export default class AddressPicker extends RichPicker {
}) || "";
}
handleEvent(event) {
switch (event.type) {
case "change": {
this.onChange(event);
break;
}
case "click": {
this.onClick(event);
}
}
}
onChange(event) {
let [selectedKey, selectedLeaf] = this.selectedStateKey.split("|");
if (!selectedKey) {

View File

@ -10,6 +10,7 @@ import LabelledCheckbox from "../components/labelled-checkbox.js";
import PaymentRequestPage from "../components/payment-request-page.js";
import PaymentStateSubscriberMixin from "../mixins/PaymentStateSubscriberMixin.js";
import paymentRequest from "../paymentRequest.js";
import HandleEventMixin from "../mixins/HandleEventMixin.js";
/* import-globals-from ../unprivileged-fallbacks.js */
@ -20,7 +21,8 @@ import paymentRequest from "../paymentRequest.js";
* as it will be much easier to share the logic once we switch to Fluent.
*/
export default class BasicCardForm extends PaymentStateSubscriberMixin(PaymentRequestPage) {
export default class BasicCardForm extends
HandleEventMixin(PaymentStateSubscriberMixin(PaymentRequestPage)) {
constructor() {
super();
@ -268,32 +270,6 @@ export default class BasicCardForm extends PaymentStateSubscriberMixin(PaymentRe
this.updateSaveButtonState();
}
handleEvent(event) {
switch (event.type) {
case "change": {
this.onChange(event);
break;
}
case "click": {
this.onClick(event);
break;
}
case "input": {
this.onInput(event);
break;
}
case "invalid": {
if (event.target instanceof HTMLFormElement) {
this.onInvalidForm(event);
break;
}
this.onInvalidField(event);
break;
}
}
}
onChange(evt) {
let ccType = this.form.querySelector("#cc-type");
this.cscInput.setAttribute("card-type", ccType.value);
@ -390,6 +366,14 @@ export default class BasicCardForm extends PaymentStateSubscriberMixin(PaymentRe
this.updateSaveButtonState();
}
onInvalid(event) {
if (event.target instanceof HTMLFormElement) {
this.onInvalidForm(event);
} else {
this.onInvalidField(event);
}
}
/**
* @param {Event} event - "invalid" event
* Note: Keep this in-sync with the equivalent version in address-form.js

View File

@ -2,6 +2,7 @@
* 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/. */
import HandleEventMixin from "../mixins/HandleEventMixin.js";
import PaymentRequestPage from "../components/payment-request-page.js";
import PaymentStateSubscriberMixin from "../mixins/PaymentStateSubscriberMixin.js";
import paymentRequest from "../paymentRequest.js";
@ -15,7 +16,8 @@ import paymentRequest from "../paymentRequest.js";
* as it will be much easier to implement and share the logic once we switch to Fluent.
*/
export default class CompletionErrorPage extends PaymentStateSubscriberMixin(PaymentRequestPage) {
export default class CompletionErrorPage extends
HandleEventMixin(PaymentStateSubscriberMixin(PaymentRequestPage)) {
constructor() {
super();
@ -80,16 +82,14 @@ export default class CompletionErrorPage extends PaymentStateSubscriberMixin(Pay
this.suggestionsList.appendChild(suggestionsFragment);
}
handleEvent(event) {
if (event.type == "click") {
switch (event.target) {
case this.doneButton: {
this.onDoneButtonClick(event);
break;
}
default: {
throw new Error("Unexpected click target");
}
onClick(event) {
switch (event.target) {
case this.doneButton: {
this.onDoneButtonClick(event);
break;
}
default: {
throw new Error("Unexpected click target");
}
}
}

View File

@ -2,6 +2,7 @@
* 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/. */
import HandleEventMixin from "../mixins/HandleEventMixin.js";
import PaymentStateSubscriberMixin from "../mixins/PaymentStateSubscriberMixin.js";
import paymentRequest from "../paymentRequest.js";
@ -26,7 +27,8 @@ import "./shipping-option-picker.js";
* being exported once tests stop depending on it.
*/
export default class PaymentDialog extends PaymentStateSubscriberMixin(HTMLElement) {
export default class PaymentDialog extends
HandleEventMixin(PaymentStateSubscriberMixin(HTMLElement)) {
constructor() {
super();
this._template = document.getElementById("payment-dialog-template");
@ -77,22 +79,20 @@ export default class PaymentDialog extends PaymentStateSubscriberMixin(HTMLEleme
super.disconnectedCallback();
}
handleEvent(event) {
if (event.type == "click") {
switch (event.currentTarget) {
case this._viewAllButton:
let orderDetailsShowing = !this.requestStore.getState().orderDetailsShowing;
this.requestStore.setState({ orderDetailsShowing });
break;
case this._payButton:
this.pay();
break;
case this._manageText:
if (event.target instanceof HTMLAnchorElement) {
this.openPreferences(event);
}
break;
}
onClick(event) {
switch (event.currentTarget) {
case this._viewAllButton:
let orderDetailsShowing = !this.requestStore.getState().orderDetailsShowing;
this.requestStore.setState({ orderDetailsShowing });
break;
case this._payButton:
this.pay();
break;
case this._manageText:
if (event.target instanceof HTMLAnchorElement) {
this.openPreferences(event);
}
break;
}
}

View File

@ -4,8 +4,10 @@
import BasicCardOption from "../components/basic-card-option.js";
import CscInput from "../components/csc-input.js";
import HandleEventMixin from "../mixins/HandleEventMixin.js";
import RichPicker from "./rich-picker.js";
import paymentRequest from "../paymentRequest.js";
/* import-globals-from ../unprivileged-fallbacks.js */
/**
@ -14,7 +16,7 @@ import paymentRequest from "../paymentRequest.js";
* <basic-card-option> listening to savedBasicCards.
*/
export default class PaymentMethodPicker extends RichPicker {
export default class PaymentMethodPicker extends HandleEventMixin(RichPicker) {
constructor() {
super();
this.dropdown.setAttribute("option-type", "basic-card-option");
@ -115,18 +117,12 @@ export default class PaymentMethodPicker extends RichPicker {
return this.getAttribute("selected-state-key");
}
handleEvent(event) {
switch (event.type) {
case "input":
case "change": {
this.onInputOrChange(event);
break;
}
case "click": {
this.onClick(event);
break;
}
}
onInput(event) {
this.onInputOrChange(event);
}
onChange(event) {
this.onInputOrChange(event);
}
onInputOrChange({currentTarget}) {

View File

@ -4,6 +4,7 @@
import RichPicker from "./rich-picker.js";
import ShippingOption from "../components/shipping-option.js";
import HandleEventMixin from "../mixins/HandleEventMixin.js";
/**
* <shipping-option-picker></shipping-option-picker>
@ -11,7 +12,7 @@ import ShippingOption from "../components/shipping-option.js";
* <option> listening to shippingOptions.
*/
export default class ShippingOptionPicker extends RichPicker {
export default class ShippingOptionPicker extends HandleEventMixin(RichPicker) {
constructor() {
super();
this.dropdown.setAttribute("option-type", "shipping-option");
@ -55,15 +56,6 @@ export default class ShippingOptionPicker extends RichPicker {
}
}
handleEvent(event) {
switch (event.type) {
case "change": {
this.onChange(event);
break;
}
}
}
onChange(event) {
let selectedOptionId = this.dropdown.value;
this.requestStore.setState({

View File

@ -0,0 +1,28 @@
/* 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/. */
/**
* A mixin to forward events to on* methods if defined.
*
* @param {string} superclass The class to extend.
* @returns {class}
*/
export default function HandleEventMixin(superclass) {
return class HandleEvent extends superclass {
handleEvent(evt) {
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
if (super.handleEvent) {
super.handleEvent(evt);
}
// Check whether event name is a defined function in object.
let fn = "on" + capitalize(evt.type);
if (this[fn] && typeof(this[fn]) === "function") {
return this[fn](evt);
}
return null;
}
};
}

View File

@ -232,7 +232,7 @@ add_task(async function testContentBlockingCustomCategory() {
// Changing the NCB_PREF should necessarily set CAT_PREF to "custom"
Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT);
await TestUtils.waitForCondition(() => Services.prefs.prefHasUserValue(NCB_PREF));
await TestUtils.waitForCondition(() => !Services.prefs.prefHasUserValue(NCB_PREF));
is(Services.prefs.getStringPref(CAT_PREF), "custom", `${CAT_PREF} has been set to custom`);
gBrowser.removeCurrentTab();

View File

@ -3,8 +3,5 @@
ac_add_options --target=aarch64-windows-mingw32
ac_add_options --host=x86_64-pc-mingw32
# WebRTC is busted in various ways.
ac_add_options --disable-webrtc
# Accessibility doesn't work.
ac_add_options --disable-accessibility

View File

@ -4330,6 +4330,9 @@ bool Datastore::UpdateUsage(int64_t aDelta) {
// Check internal LocalStorage origin limit.
int64_t newUsage = mUsage + aDelta;
MOZ_ASSERT(newUsage >= 0);
if (newUsage > gOriginLimitKB * 1024) {
return false;
}
@ -5625,7 +5628,8 @@ nsresult PrepareDatastoreOp::DatabaseWork() {
if (alreadyExisted) {
MOZ_ASSERT(gUsages);
MOZ_ASSERT(gUsages->Get(mOrigin, &mUsage));
DebugOnly<bool> hasUsage = gUsages->Get(mOrigin, &mUsage);
MOZ_ASSERT(hasUsage);
} else {
MOZ_ASSERT(mUsage == 0);
InitUsageForOrigin(mOrigin, mUsage);
@ -6911,6 +6915,8 @@ nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
return rv;
}
MOZ_ASSERT(usage >= 0);
InitUsageForOrigin(aOrigin, usage);
aUsageInfo->AppendToDatabaseUsage(uint64_t(usage));
@ -6988,6 +6994,7 @@ nsresult QuotaClient::GetUsageForOrigin(PersistenceType aPersistenceType,
if (gUsages) {
int64_t usage;
if (gUsages->Get(aOrigin, &usage)) {
MOZ_ASSERT(usage >= 0);
aUsageInfo->AppendToDatabaseUsage(usage);
}
}

View File

@ -0,0 +1,66 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
async function testSteps() {
const data = {};
data.key = "key1";
data.value = "value1";
data.usage = data.key.length + data.value.length;
const principal = getPrincipal("http://example.com");
info("Setting prefs");
Services.prefs.setBoolPref("dom.storage.next_gen", true);
info("Stage 1 - Testing usage after adding item");
info("Getting storage");
let storage = getLocalStorage(principal);
info("Adding item");
storage.setItem(data.key, data.value);
info("Resetting origin");
let request = resetOrigin(principal);
await requestFinished(request);
info("Getting usage");
request = getOriginUsage(principal);
await requestFinished(request);
is(request.result.usage, data.usage, "Correct usage");
info("Resetting");
request = reset();
await requestFinished(request);
info("Stage 2 - Testing usage after removing item");
info("Getting storage");
storage = getLocalStorage(principal);
info("Removing item");
storage.removeItem(data.key);
info("Resetting origin");
request = resetOrigin(principal);
await requestFinished(request);
info("Getting usage");
request = getOriginUsage(principal);
await requestFinished(request);
is(request.result.usage, 0, "Correct usage");
}

View File

@ -29,3 +29,4 @@ run-sequentially = this test depends on a file produced by test_databaseShadowin
[test_groupLimit.js]
[test_migration.js]
[test_snapshotting.js]
[test_usage.js]

View File

@ -40,6 +40,7 @@ run-if = nightly_build # Bug 1390737: Depends on the Nightly-only UI service
skip-if = debug # Bug 1507251 - Leak
[test_closePayment.html]
[test_constructor.html]
skip-if = (os == "linux") # Bug 1514425
[test_currency_amount_validation.html]
skip-if = (verify && debug)
[test_payerDetails.html]

View File

@ -25,7 +25,6 @@ namespace detail {
/* static */
UniquePtr<BumpChunk> BumpChunk::newWithCapacity(size_t size) {
MOZ_DIAGNOSTIC_ASSERT(RoundUpPow2(size) == size);
MOZ_DIAGNOSTIC_ASSERT(size >= sizeof(BumpChunk));
void* mem = js_malloc(size);
if (!mem) {
@ -104,12 +103,17 @@ void LifoAlloc::reset(size_t defaultChunkSize) {
while (!chunks_.empty()) {
chunks_.popFirst();
}
while (!oversize_.empty()) {
chunks_.popFirst();
}
while (!unused_.empty()) {
unused_.popFirst();
}
defaultChunkSize_ = defaultChunkSize;
oversizeThreshold_ = defaultChunkSize;
markCount = 0;
curSize_ = 0;
oversizeSize_ = 0;
}
void LifoAlloc::freeAll() {
@ -117,6 +121,11 @@ void LifoAlloc::freeAll() {
UniqueBumpChunk bc = chunks_.popFirst();
decrementCurSize(bc->computedSizeOfIncludingThis());
}
while (!oversize_.empty()) {
UniqueBumpChunk bc = oversize_.popFirst();
decrementCurSize(bc->computedSizeOfIncludingThis());
oversizeSize_ -= bc->computedSizeOfIncludingThis();
}
while (!unused_.empty()) {
UniqueBumpChunk bc = unused_.popFirst();
decrementCurSize(bc->computedSizeOfIncludingThis());
@ -125,9 +134,36 @@ void LifoAlloc::freeAll() {
// Nb: maintaining curSize_ correctly isn't easy. Fortunately, this is an
// excellent sanity check.
MOZ_ASSERT(curSize_ == 0);
MOZ_ASSERT(oversizeSize_ == 0);
}
LifoAlloc::UniqueBumpChunk LifoAlloc::newChunkWithCapacity(size_t n) {
// Round at the same page granularity used by malloc.
static size_t MallocGoodSize(size_t aSize) {
#if defined(MOZ_MEMORY)
return malloc_good_size(aSize);
#else
return aSize;
#endif
}
// Heuristic to choose the size of the next BumpChunk for small allocations.
// `start` is the size of the first chunk. `used` is the total size of all
// BumpChunks in this LifoAlloc so far.
static size_t NextSize(size_t start, size_t used) {
// Double the size, up to 1 MB.
const size_t mb = 1 * 1024 * 1024;
if (used < mb) {
return Max(start, used);
}
// After 1 MB, grow more gradually, to waste less memory.
// The sequence (in megabytes) begins:
// 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, ...
return JS_ROUNDUP(used / 8, mb);
}
LifoAlloc::UniqueBumpChunk LifoAlloc::newChunkWithCapacity(size_t n,
bool oversize) {
MOZ_ASSERT(fallibleScope_,
"[OOM] Cannot allocate a new chunk in an infallible scope.");
@ -140,8 +176,11 @@ LifoAlloc::UniqueBumpChunk LifoAlloc::newChunkWithCapacity(size_t n) {
return nullptr;
}
MOZ_ASSERT(curSize_ >= oversizeSize_);
const size_t chunkSize =
minSize > defaultChunkSize_ ? RoundUpPow2(minSize) : defaultChunkSize_;
(oversize || minSize > defaultChunkSize_)
? MallocGoodSize(minSize)
: NextSize(defaultChunkSize_, curSize_ - oversizeSize_);
// Create a new BumpChunk, and allocate space for it.
UniqueBumpChunk result = detail::BumpChunk::newWithCapacity(chunkSize);
@ -152,14 +191,13 @@ LifoAlloc::UniqueBumpChunk LifoAlloc::newChunkWithCapacity(size_t n) {
return result;
}
bool LifoAlloc::getOrCreateChunk(size_t n) {
LifoAlloc::UniqueBumpChunk LifoAlloc::getOrCreateChunk(size_t n) {
// Look for existing unused BumpChunks to satisfy the request, and pick the
// first one which is large enough, and move it into the list of used
// chunks.
if (!unused_.empty()) {
if (unused_.begin()->canAlloc(n)) {
chunks_.append(unused_.popFirst());
return true;
return unused_.popFirst();
}
BumpChunkList::Iterator e(unused_.end());
@ -169,32 +207,171 @@ bool LifoAlloc::getOrCreateChunk(size_t n) {
MOZ_ASSERT(elem->empty());
if (elem->canAlloc(n)) {
BumpChunkList temp = unused_.splitAfter(i.get());
chunks_.append(temp.popFirst());
UniqueBumpChunk newChunk = temp.popFirst();
unused_.appendAll(std::move(temp));
return true;
return newChunk;
}
}
}
// Allocate a new BumpChunk with enough space for the next allocation.
UniqueBumpChunk newChunk = newChunkWithCapacity(n);
UniqueBumpChunk newChunk = newChunkWithCapacity(n, false);
if (!newChunk) {
return newChunk;
}
size_t size = newChunk->computedSizeOfIncludingThis();
incrementCurSize(size);
return newChunk;
}
void* LifoAlloc::allocImplColdPath(size_t n) {
void* result;
UniqueBumpChunk newChunk = getOrCreateChunk(n);
if (!newChunk) {
return nullptr;
}
// Since we just created a large enough chunk, this can't fail.
chunks_.append(std::move(newChunk));
result = chunks_.last()->tryAlloc(n);
MOZ_ASSERT(result);
return result;
}
void* LifoAlloc::allocImplOversize(size_t n) {
void* result;
UniqueBumpChunk newChunk = newChunkWithCapacity(n, true);
if (!newChunk) {
return nullptr;
}
incrementCurSize(newChunk->computedSizeOfIncludingThis());
oversizeSize_ += newChunk->computedSizeOfIncludingThis();
// Since we just created a large enough chunk, this can't fail.
oversize_.append(std::move(newChunk));
result = oversize_.last()->tryAlloc(n);
MOZ_ASSERT(result);
return result;
}
bool LifoAlloc::ensureUnusedApproximateColdPath(size_t n, size_t total) {
for (detail::BumpChunk& bc : unused_) {
total += bc.unused();
if (total >= n) {
return true;
}
}
UniqueBumpChunk newChunk = newChunkWithCapacity(n, false);
if (!newChunk) {
return false;
}
size_t size = newChunk->computedSizeOfIncludingThis();
chunks_.append(std::move(newChunk));
unused_.pushFront(std::move(newChunk));
incrementCurSize(size);
return true;
}
LifoAlloc::Mark LifoAlloc::mark() {
markCount++;
Mark res;
if (!chunks_.empty()) {
res.chunk = chunks_.last()->mark();
}
if (!oversize_.empty()) {
res.oversize = oversize_.last()->mark();
}
return res;
}
void LifoAlloc::release(Mark mark) {
markCount--;
#ifdef DEBUG
auto assertIsContained = [](const detail::BumpChunk::Mark& m,
BumpChunkList& list) {
if (m.markedChunk()) {
bool contained = false;
for (const detail::BumpChunk& chunk : list) {
if (&chunk == m.markedChunk() && chunk.contains(m)) {
contained = true;
break;
}
}
MOZ_ASSERT(contained);
}
};
assertIsContained(mark.chunk, chunks_);
assertIsContained(mark.oversize, oversize_);
#endif
BumpChunkList released;
auto cutAtMark = [&released](const detail::BumpChunk::Mark& m,
BumpChunkList& list) {
// Move the blocks which are after the mark to the set released chunks.
if (!m.markedChunk()) {
released = std::move(list);
} else {
released = list.splitAfter(m.markedChunk());
}
// Release everything which follows the mark in the last chunk.
if (!list.empty()) {
list.last()->release(m);
}
};
// Release the content of all the blocks which are after the marks, and keep
// blocks as unused.
cutAtMark(mark.chunk, chunks_);
for (detail::BumpChunk& bc : released) {
bc.release();
}
unused_.appendAll(std::move(released));
// Free the content of all the blocks which are after the marks.
cutAtMark(mark.oversize, oversize_);
while (!released.empty()) {
UniqueBumpChunk bc = released.popFirst();
decrementCurSize(bc->computedSizeOfIncludingThis());
oversizeSize_ -= bc->computedSizeOfIncludingThis();
}
}
void LifoAlloc::steal(LifoAlloc* other) {
MOZ_ASSERT(!other->markCount);
MOZ_DIAGNOSTIC_ASSERT(unused_.empty());
MOZ_DIAGNOSTIC_ASSERT(chunks_.empty());
MOZ_DIAGNOSTIC_ASSERT(oversize_.empty());
// Copy everything from |other| to |this| except for |peakSize_|, which
// requires some care.
chunks_ = std::move(other->chunks_);
oversize_ = std::move(other->oversize_);
unused_ = std::move(other->unused_);
markCount = other->markCount;
defaultChunkSize_ = other->defaultChunkSize_;
oversizeThreshold_ = other->oversizeThreshold_;
curSize_ = other->curSize_;
peakSize_ = Max(peakSize_, other->peakSize_);
oversizeSize_ = other->oversizeSize_;
#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
fallibleScope_ = other->fallibleScope_;
#endif
other->reset(defaultChunkSize_);
}
void LifoAlloc::transferFrom(LifoAlloc* other) {
MOZ_ASSERT(!markCount);
MOZ_ASSERT(!other->markCount);
incrementCurSize(other->curSize_);
oversizeSize_ += other->oversizeSize_;
appendUnused(std::move(other->unused_));
appendUsed(std::move(other->chunks_));
oversize_.appendAll(std::move(other->oversize_));
other->curSize_ = 0;
other->oversizeSize_ = 0;
}
void LifoAlloc::transferUnusedFrom(LifoAlloc* other) {
@ -209,3 +386,29 @@ void LifoAlloc::transferUnusedFrom(LifoAlloc* other) {
incrementCurSize(size);
other->decrementCurSize(size);
}
#ifdef LIFO_CHUNK_PROTECT
void LifoAlloc::setReadOnly() {
for (detail::BumpChunk& bc : chunks_) {
bc.setReadOnly();
}
for (detail::BumpChunk& bc : oversize_) {
bc.setReadOnly();
}
for (detail::BumpChunk& bc : unused_) {
bc.setReadOnly();
}
}
void LifoAlloc::setReadWrite() {
for (detail::BumpChunk& bc : chunks_) {
bc.setReadWrite();
}
for (detail::BumpChunk& bc : oversize_) {
bc.setReadWrite();
}
for (detail::BumpChunk& bc : unused_) {
bc.setReadWrite();
}
}
#endif

View File

@ -362,8 +362,7 @@ class BumpChunk : public SingleLinkedListElement<BumpChunk> {
uint8_t* bump_;
friend class BumpChunk;
explicit Mark(BumpChunk* chunk, uint8_t* bump)
: chunk_(chunk), bump_(bump) {}
Mark(BumpChunk* chunk, uint8_t* bump) : chunk_(chunk), bump_(bump) {}
public:
Mark() : chunk_(nullptr), bump_(nullptr) {}
@ -497,19 +496,29 @@ class LifoAlloc {
using UniqueBumpChunk = js::UniquePtr<detail::BumpChunk>;
using BumpChunkList = detail::SingleLinkedList<detail::BumpChunk>;
// List of chunks containing allocated data. In the common case, the last
// chunk of this list is always used to perform the allocations. When the
// allocation cannot be performed, we move a Chunk from the unused set to
// the list of used chunks.
// List of chunks containing allocated data of size smaller than the default
// chunk size. In the common case, the last chunk of this list is always
// used to perform the allocations. When the allocation cannot be performed,
// we move a Chunk from the unused set to the list of used chunks.
BumpChunkList chunks_;
// List of chunks containing allocated data where each allocation is larger
// than the oversize threshold. Each chunk contains exactly on allocation.
// This reduces wasted space in the normal chunk list.
//
// Oversize chunks are allocated on demand and freed as soon as they are
// released, instead of being pushed to the unused list.
BumpChunkList oversize_;
// Set of unused chunks, which can be reused for future allocations.
BumpChunkList unused_;
size_t markCount;
size_t defaultChunkSize_;
size_t oversizeThreshold_;
size_t curSize_;
size_t peakSize_;
size_t oversizeSize_;
#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
bool fallibleScope_;
#endif
@ -518,11 +527,11 @@ class LifoAlloc {
LifoAlloc(const LifoAlloc&) = delete;
// Return a BumpChunk that can perform an allocation of at least size |n|.
UniqueBumpChunk newChunkWithCapacity(size_t n);
UniqueBumpChunk newChunkWithCapacity(size_t n, bool oversize);
// Reuse or allocate a BumpChunk that can perform an allocation of at least
// size |n|, if successful it is placed at the end the list of |chunks_|.
MOZ_MUST_USE bool getOrCreateChunk(size_t n);
UniqueBumpChunk getOrCreateChunk(size_t n);
void reset(size_t defaultChunkSize);
@ -554,23 +563,27 @@ class LifoAlloc {
curSize_ -= size;
}
void* allocImplColdPath(size_t n);
void* allocImplOversize(size_t n);
MOZ_ALWAYS_INLINE
void* allocImpl(size_t n) {
void* result;
if (!chunks_.empty() && (result = chunks_.last()->tryAlloc(n))) {
// Give oversized allocations their own chunk instead of wasting space
// due to fragmentation at the end of normal chunk.
if (MOZ_UNLIKELY(n > oversizeThreshold_)) {
return allocImplOversize(n);
}
if (MOZ_LIKELY(!chunks_.empty() &&
(result = chunks_.last()->tryAlloc(n)))) {
return result;
}
if (!getOrCreateChunk(n)) {
return nullptr;
}
// Since we just created a large enough chunk, this can't fail.
result = chunks_.last()->tryAlloc(n);
MOZ_ASSERT(result);
return result;
return allocImplColdPath(n);
}
// Check for space in unused chunks or allocate a new unused chunk.
MOZ_MUST_USE bool ensureUnusedApproximateColdPath(size_t n, size_t total);
public:
explicit LifoAlloc(size_t defaultChunkSize)
: peakSize_(0)
@ -582,27 +595,17 @@ class LifoAlloc {
reset(defaultChunkSize);
}
// Steal allocated chunks from |other|.
void steal(LifoAlloc* other) {
MOZ_ASSERT(!other->markCount);
MOZ_DIAGNOSTIC_ASSERT(unused_.empty());
MOZ_DIAGNOSTIC_ASSERT(chunks_.empty());
// Copy everything from |other| to |this| except for |peakSize_|, which
// requires some care.
chunks_ = std::move(other->chunks_);
unused_ = std::move(other->unused_);
markCount = other->markCount;
defaultChunkSize_ = other->defaultChunkSize_;
curSize_ = other->curSize_;
peakSize_ = Max(peakSize_, other->peakSize_);
#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
fallibleScope_ = other->fallibleScope_;
#endif
other->reset(defaultChunkSize_);
// Set the threshold to allocate data in its own chunk outside the space for
// small allocations.
void disableOversize() { oversizeThreshold_ = SIZE_MAX; }
void setOversizeThreshold(size_t oversizeThreshold) {
MOZ_ASSERT(oversizeThreshold <= defaultChunkSize_);
oversizeThreshold_ = oversizeThreshold;
}
// Steal allocated chunks from |other|.
void steal(LifoAlloc* other);
// Append all chunks from |other|. They are removed from |other|.
void transferFrom(LifoAlloc* other);
@ -644,7 +647,7 @@ class LifoAlloc {
JS_OOM_POSSIBLY_FAIL();
MOZ_ASSERT(fallibleScope_);
detail::BumpChunk::Mark m = mark();
Mark m = mark();
void* result = allocImpl(n);
if (!ensureUnusedApproximate(needed)) {
release(m);
@ -655,7 +658,7 @@ class LifoAlloc {
}
template <typename T, typename... Args>
MOZ_ALWAYS_INLINE T* allocInSize(size_t n, Args&&... args) {
MOZ_ALWAYS_INLINE T* newWithSize(size_t n, Args&&... args) {
MOZ_ASSERT(n >= sizeof(T), "must request enough space to store a T");
static_assert(alignof(T) <= detail::LIFO_ALLOC_ALIGN,
"LifoAlloc must provide enough alignment to store T");
@ -691,21 +694,7 @@ class LifoAlloc {
}
}
for (detail::BumpChunk& bc : unused_) {
total += bc.unused();
if (total >= n) {
return true;
}
}
UniqueBumpChunk newChunk = newChunkWithCapacity(n);
if (!newChunk) {
return false;
}
size_t size = newChunk->computedSizeOfIncludingThis();
unused_.pushFront(std::move(newChunk));
incrementCurSize(size);
return true;
return ensureUnusedApproximateColdPath(n, total);
}
MOZ_ALWAYS_INLINE
@ -756,38 +745,13 @@ class LifoAlloc {
return static_cast<T*>(alloc(bytes));
}
using Mark = detail::BumpChunk::Mark;
Mark mark() {
markCount++;
if (chunks_.empty()) {
return Mark();
}
return chunks_.last()->mark();
}
void release(Mark mark) {
markCount--;
// Move the blocks which are after the mark to the set of unused chunks.
BumpChunkList released;
if (!mark.markedChunk()) {
released = std::move(chunks_);
} else {
released = chunks_.splitAfter(mark.markedChunk());
}
// Release the content of all the blocks which are after the marks.
for (detail::BumpChunk& bc : released) {
bc.release();
}
unused_.appendAll(std::move(released));
// Release everything which follows the mark in the last chunk.
if (!chunks_.empty()) {
chunks_.last()->release(mark);
}
}
class Mark {
friend class LifoAlloc;
detail::BumpChunk::Mark chunk;
detail::BumpChunk::Mark oversize;
};
Mark mark();
void release(Mark mark);
private:
void cancelMark(Mark mark) { markCount--; }
@ -799,26 +763,19 @@ class LifoAlloc {
bc.release();
}
unused_.appendAll(std::move(chunks_));
// On release, we free any oversize allocations instead of keeping them
// in unused chunks.
while (!oversize_.empty()) {
UniqueBumpChunk bc = oversize_.popFirst();
decrementCurSize(bc->computedSizeOfIncludingThis());
oversizeSize_ -= bc->computedSizeOfIncludingThis();
}
}
// Protect the content of the LifoAlloc chunks.
#ifdef LIFO_CHUNK_PROTECT
void setReadOnly() {
for (detail::BumpChunk& bc : chunks_) {
bc.setReadOnly();
}
for (detail::BumpChunk& bc : unused_) {
bc.setReadOnly();
}
}
void setReadWrite() {
for (detail::BumpChunk& bc : chunks_) {
bc.setReadWrite();
}
for (detail::BumpChunk& bc : unused_) {
bc.setReadWrite();
}
}
void setReadOnly();
void setReadWrite();
#else
void setReadOnly() const {}
void setReadWrite() const {}
@ -835,8 +792,10 @@ class LifoAlloc {
// Return true if the LifoAlloc does not currently contain any allocations.
bool isEmpty() const {
return chunks_.empty() ||
(chunks_.begin() == chunks_.last() && chunks_.last()->empty());
bool empty = chunks_.empty() ||
(chunks_.begin() == chunks_.last() && chunks_.last()->empty());
MOZ_ASSERT_IF(!oversize_.empty(), !oversize_.last()->empty());
return empty && oversize_.empty();
}
// Return the number of bytes remaining to allocate in the current chunk.
@ -854,6 +813,9 @@ class LifoAlloc {
for (const detail::BumpChunk& chunk : chunks_) {
n += chunk.sizeOfIncludingThis(mallocSizeOf);
}
for (const detail::BumpChunk& chunk : oversize_) {
n += chunk.sizeOfIncludingThis(mallocSizeOf);
}
for (const detail::BumpChunk& chunk : unused_) {
n += chunk.sizeOfIncludingThis(mallocSizeOf);
}
@ -866,6 +828,9 @@ class LifoAlloc {
for (const detail::BumpChunk& chunk : chunks_) {
n += chunk.computedSizeOfIncludingThis();
}
for (const detail::BumpChunk& chunk : oversize_) {
n += chunk.computedSizeOfIncludingThis();
}
for (const detail::BumpChunk& chunk : unused_) {
n += chunk.computedSizeOfIncludingThis();
}
@ -897,6 +862,11 @@ class LifoAlloc {
return true;
}
}
for (const detail::BumpChunk& chunk : oversize_) {
if (chunk.contains(ptr)) {
return true;
}
}
return false;
}
#endif
@ -935,6 +905,7 @@ class LifoAlloc {
: chunkIt_(alloc.chunks_.begin()),
chunkEnd_(alloc.chunks_.end()),
head_(nullptr) {
MOZ_RELEASE_ASSERT(alloc.oversize_.empty());
if (chunkIt_ != chunkEnd_) {
head_ = chunkIt_->begin();
}

View File

@ -1043,7 +1043,7 @@ typename Scope::Data* NewEmptyBindingData(JSContext* cx, LifoAlloc& alloc,
uint32_t numBindings) {
using Data = typename Scope::Data;
size_t allocSize = SizeOfData<typename Scope::Data>(numBindings);
auto* bindings = alloc.allocInSize<Data>(allocSize, numBindings);
auto* bindings = alloc.newWithSize<Data>(allocSize, numBindings);
if (!bindings) {
ReportOutOfMemory(cx);
}

View File

@ -148,6 +148,12 @@ class StoreBuffer {
MOZ_ASSERT(!head_);
if (!storage_) {
storage_ = js_new<LifoAlloc>(LifoAllocBlockSize);
// This prevents LifoAlloc::Enum from crashing with a release
// assertion if we ever allocate one entry larger than
// LifoAllocBlockSize.
if (storage_) {
storage_->disableOversize();
}
}
clear();
return bool(storage_);

View File

@ -1,4 +1,4 @@
// |jit-test| allow-overrecursed
// |jit-test| slow; allow-overrecursed
(function f(x) {
f(x - 1);

View File

@ -10,7 +10,11 @@
#include "common_audio/fir_filter_neon.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include <string.h>
#include "rtc_base/checks.h"

View File

@ -13,7 +13,11 @@
#include "common_audio/resampler/sinc_resampler.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
namespace webrtc {

View File

@ -10,7 +10,11 @@
#include "common_audio/signal_processing/include/signal_processing_library.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
static inline void DotProductWithScaleNeon(int32_t* cross_correlation,
const int16_t* vector1,
@ -51,7 +55,7 @@ static inline void DotProductWithScaleNeon(int32_t* cross_correlation,
}
sum0 = vaddq_s64(sum0, sum1);
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
int64_t sum2 = vaddvq_s64(sum0);
*cross_correlation = (int32_t)((sum2 + sum_res) >> scaling);
#else

View File

@ -10,7 +10,11 @@
#include "common_audio/signal_processing/include/signal_processing_library.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
// NEON intrinsics version of WebRtcSpl_DownsampleFast()
// for ARM 32-bit/64-bit platforms.

View File

@ -8,7 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include <stdlib.h>
#include "rtc_base/checks.h"
@ -37,7 +41,7 @@ int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, size_t length) {
p_start += 8;
}
#ifdef WEBRTC_ARCH_ARM64
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
maximum = (int)vmaxvq_u16(max_qv);
#else
uint16x4_t max_dv;
@ -97,7 +101,7 @@ int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, size_t length) {
}
uint32x4_t max32x4 = vmaxq_u32(max32x4_0, max32x4_1);
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
maximum = vmaxvq_u32(max32x4);
#else
uint32x2_t max32x2 = vmax_u32(vget_low_u32(max32x4), vget_high_u32(max32x4));
@ -140,7 +144,7 @@ int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, size_t length) {
p_start += 8;
}
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
maximum = vmaxvq_s16(max16x8);
#else
int16x4_t max16x4 = vmax_s16(vget_low_s16(max16x8), vget_high_s16(max16x8));
@ -183,7 +187,7 @@ int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, size_t length) {
}
int32x4_t max32x4 = vmaxq_s32(max32x4_0, max32x4_1);
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
maximum = vmaxvq_s32(max32x4);
#else
int32x2_t max32x2 = vmax_s32(vget_low_s32(max32x4), vget_high_s32(max32x4));
@ -220,7 +224,7 @@ int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, size_t length) {
p_start += 8;
}
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
minimum = vminvq_s16(min16x8);
#else
int16x4_t min16x4 = vmin_s16(vget_low_s16(min16x8), vget_high_s16(min16x8));
@ -263,7 +267,7 @@ int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, size_t length) {
}
int32x4_t min32x4 = vminq_s32(min32x4_0, min32x4_1);
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
minimum = vminvq_s32(min32x4);
#else
int32x2_t min32x2 = vmin_s32(vget_low_s32(min32x4), vget_high_s32(min32x4));

View File

@ -16,7 +16,11 @@
#include "entropy_coding.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include <stddef.h>
#include "signal_processing_library.h"

View File

@ -13,7 +13,11 @@
// WebRtcIsacfix_AllpassFilter2FixDec16C() in filterbanks.c. Prototype
// C code is at end of this file.
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "rtc_base/checks.h"

View File

@ -8,7 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "rtc_base/checks.h"
#include "modules/audio_coding/codecs/isac/fix/source/codec.h"
@ -44,7 +48,7 @@ int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r,
x_start += 4;
}
#ifdef WEBRTC_ARCH_ARM64
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
prod = vaddvq_s64(tmpb_v);
#else
prod = vget_lane_s64(vadd_s64(vget_low_s64(tmpb_v), vget_high_s64(tmpb_v)),
@ -90,7 +94,7 @@ int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r,
x_start += 4;
y_start += 4;
}
#ifdef WEBRTC_ARCH_ARM64
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
prod = vaddvq_s64(tmpb_v);
#else
prod = vget_lane_s64(vadd_s64(vget_low_s64(tmpb_v), vget_high_s64(tmpb_v)),

View File

@ -8,7 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "modules/audio_coding/codecs/isac/fix/source/codec.h"
#include "modules/audio_coding/codecs/isac/fix/source/settings.h"

View File

@ -11,8 +11,12 @@
#include "modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h"
#ifdef WEBRTC_HAS_NEON
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#endif
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "rtc_base/compile_assert_c.h"

View File

@ -8,7 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "modules/audio_coding/codecs/isac/fix/source/codec.h"
#include "modules/audio_coding/codecs/isac/fix/source/fft.h"
@ -51,7 +55,7 @@ static inline int32_t ComplexMulAndFindMaxNeon(int16_t* inre1Q9,
int32x4_t tmp1 = vmull_s16(vget_low_s16(tmpr), vget_low_s16(inre2));
tmp0 = vmlal_s16(tmp0, vget_low_s16(tmpi), vget_low_s16(inre2));
tmp1 = vmlsl_s16(tmp1, vget_low_s16(tmpi), vget_low_s16(inre1));
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
int32x4_t tmp2 = vmull_high_s16(tmpr, inre1);
int32x4_t tmp3 = vmull_high_s16(tmpr, inre2);
tmp2 = vmlal_high_s16(tmp2, tmpi, inre2);
@ -90,7 +94,7 @@ static inline int32_t ComplexMulAndFindMaxNeon(int16_t* inre1Q9,
}
max_r = vmaxq_u32(max_r, max_i);
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
uint32_t maximum = vmaxvq_u32(max_r);
#else
uint32x2_t max32x2_r = vmax_u32(vget_low_u32(max_r), vget_high_u32(max_r));
@ -331,7 +335,7 @@ static inline int32_t TransformAndFindMaxNeon(int16_t* inre,
}
max_r = vmaxq_u32(max_r, max_i);
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
uint32_t maximum = vmaxvq_u32(max_r);
#else
uint32x2_t max32x2_r = vmax_u32(vget_low_u32(max_r), vget_high_u32(max_r));

View File

@ -14,7 +14,11 @@
* Based on aec_core_sse2.c.
*/
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include <math.h>
#include <string.h> // memset
@ -99,7 +103,8 @@ static float32x4_t vdivq_f32(float32x4_t a, float32x4_t b) {
// a/b = a*(1/b)
return vmulq_f32(a, x);
}
#endif
#if !defined(WEBRTC_ARCH_ARM64) || (defined(_MSC_VER) && !defined(__clang__))
static float32x4_t vsqrtq_f32(float32x4_t s) {
int i;
float32x4_t x = vrsqrteq_f32(s);

View File

@ -11,8 +11,12 @@
#include "modules/audio_processing/aec3/adaptive_fir_filter.h"
#if defined(WEBRTC_HAS_NEON)
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#endif
#include "typedefs.h" // NOLINT(build/include)
#if defined(WEBRTC_ARCH_X86_FAMILY)
#include <emmintrin.h>

View File

@ -10,8 +10,12 @@
#include "modules/audio_processing/aec3/matched_filter.h"
#if defined(WEBRTC_HAS_NEON)
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#endif
#include "typedefs.h" // NOLINT(build/include)
#if defined(WEBRTC_ARCH_X86_FAMILY)
#include <emmintrin.h>

View File

@ -13,8 +13,12 @@
#include "typedefs.h" // NOLINT(build/include)
#if defined(WEBRTC_HAS_NEON)
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#endif
#if defined(WEBRTC_ARCH_X86_FAMILY)
#include <emmintrin.h>
#endif
@ -64,7 +68,7 @@ class VectorMath {
int j = 0;
for (; j < vector_limit * 4; j += 4) {
float32x4_t g = vld1q_f32(&x[j]);
#if !defined(WEBRTC_ARCH_ARM64)
#if !defined(WEBRTC_ARCH_ARM64) || (defined(_MSC_VER) && !defined(__clang__))
float32x4_t y = vrsqrteq_f32(g);
// Code to handle sqrt(0).

View File

@ -10,7 +10,11 @@
#include "modules/audio_processing/aecm/aecm_core.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "common_audio/signal_processing/include/real_fft.h"
#include "rtc_base/checks.h"
@ -19,7 +23,7 @@
// generating script and makefile, to replace these C functions.
static inline void AddLanes(uint32_t* ptr, uint32x4_t v) {
#if defined(WEBRTC_ARCH_ARM64)
#if defined(WEBRTC_ARCH_ARM64) && (!defined(_MSC_VER) || defined(__clang__))
*(ptr) = vaddvq_u32(v);
#else
uint32x2_t tmp_v;

View File

@ -10,7 +10,11 @@
#include "modules/audio_processing/ns/nsx_core.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "rtc_base/checks.h"

View File

@ -16,7 +16,11 @@
#include "modules/audio_processing/utility/ooura_fft.h"
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "modules/audio_processing/utility/ooura_fft_tables_common.h"
#include "modules/audio_processing/utility/ooura_fft_tables_neon_sse2.h"

View File

@ -8,7 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#if defined(_MSC_VER) && !defined(__clang__)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#include "modules/video_processing/util/denoiser_filter_neon.h"

View File

@ -21,6 +21,7 @@ skip-if = appname == "thunderbird" || os == "android"
[test_ext_cookieBehaviors.js]
[test_ext_cookies_samesite.js]
[test_ext_content_security_policy.js]
skip-if = (os == "win" && debug) #Bug 1485567
[test_ext_contentscript_api_injection.js]
[test_ext_contentscript_async_loading.js]
skip-if = os == 'android' && debug # The generated script takes too long to load on Android debug