Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Bogdan Tara 2019-02-11 23:59:48 +02:00
commit 2c0ee18d6e
42 changed files with 223 additions and 700 deletions

View File

@ -1526,7 +1526,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 only in nightly
// and early beta. By default the value is 0: BEHAVIOR_ACCEPT
#ifdef EARLY_BETA_OR_EARLIER
pref("network.cookie.cookieBehavior", 4 /* BEHAVIOR_REJECT_TRACKER */);
#endif
pref("browser.contentblocking.allowlist.storage.enabled", true);

View File

@ -79,7 +79,7 @@ body.config-warning {
#prefs > tr > td,
#prefs > tr > th {
padding: 0;
padding: 4px;
width: 50%;
font-weight: inherit;
}
@ -94,6 +94,11 @@ body.config-warning {
opacity: 0.4;
}
#prefs > tr > td.cell-edit,
#prefs > tr > td.cell-reset {
padding: 0;
}
.cell-value {
white-space: pre-wrap;
word-break: break-all;

View File

@ -134,6 +134,7 @@ class PrefRow {
nameCell.setAttribute("scope", "row");
this.valueCell.className = "cell-value";
this.editCell.className = "cell-edit";
this.resetCell.className = "cell-reset";
// Add <wbr> behind dots to prevent line breaking in random mid-word places.
let parts = this.name.split(".");

View File

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.1.243
Current extension version is: 2.2.8
Taken from upstream commit: c0d6e46e
Taken from upstream commit: dfe7d9bc

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.1.243';
var pdfjsBuild = 'c0d6e46e';
var pdfjsVersion = '2.2.8';
var pdfjsBuild = 'dfe7d9bc';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -1411,7 +1411,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.1.243',
apiVersion: '2.2.8',
source: {
data: source.data,
url: source.url,
@ -3142,9 +3142,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.1.243';
const version = '2.2.8';
exports.version = version;
const build = 'c0d6e46e';
const build = 'dfe7d9bc';
exports.build = build;
/***/ }),

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
const pdfjsVersion = '2.1.243';
const pdfjsBuild = 'c0d6e46e';
const pdfjsVersion = '2.2.8';
const pdfjsBuild = 'dfe7d9bc';
const pdfjsCoreWorker = __w_pdfjs_require__(1);
@ -375,7 +375,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
let apiVersion = docParams.apiVersion;
let workerVersion = '2.1.243';
let workerVersion = '2.2.8';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -21483,7 +21483,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
}
toUnicode[charcode] = String.fromCharCode(code);
toUnicode[charcode] = String.fromCodePoint(code);
}
continue;
@ -21583,7 +21583,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
}
map[charCode] = String.fromCharCode.apply(String, str);
map[charCode] = String.fromCodePoint.apply(String, str);
});
return new _fonts.ToUnicodeMap(map);
});

View File

@ -3649,16 +3649,7 @@ class PDFSidebar {
return false;
case SidebarView.THUMBS:
this.thumbnailButton.classList.add('toggled');
this.outlineButton.classList.remove('toggled');
this.attachmentsButton.classList.remove('toggled');
this.thumbnailView.classList.remove('hidden');
this.outlineView.classList.add('hidden');
this.attachmentsView.classList.add('hidden');
if (this.isOpen && isViewChanged) {
this._updateThumbnailViewer();
shouldForceRendering = true;
}
@ -3669,12 +3660,6 @@ class PDFSidebar {
return false;
}
this.thumbnailButton.classList.remove('toggled');
this.outlineButton.classList.add('toggled');
this.attachmentsButton.classList.remove('toggled');
this.thumbnailView.classList.add('hidden');
this.outlineView.classList.remove('hidden');
this.attachmentsView.classList.add('hidden');
break;
case SidebarView.ATTACHMENTS:
@ -3682,12 +3667,6 @@ class PDFSidebar {
return false;
}
this.thumbnailButton.classList.remove('toggled');
this.outlineButton.classList.remove('toggled');
this.attachmentsButton.classList.add('toggled');
this.thumbnailView.classList.add('hidden');
this.outlineView.classList.add('hidden');
this.attachmentsView.classList.remove('hidden');
break;
default:
@ -3695,7 +3674,13 @@ class PDFSidebar {
return false;
}
this.active = view | 0;
this.active = view;
this.thumbnailButton.classList.toggle('toggled', view === SidebarView.THUMBS);
this.outlineButton.classList.toggle('toggled', view === SidebarView.OUTLINE);
this.attachmentsButton.classList.toggle('toggled', view === SidebarView.ATTACHMENTS);
this.thumbnailView.classList.toggle('hidden', view !== SidebarView.THUMBS);
this.outlineView.classList.toggle('hidden', view !== SidebarView.OUTLINE);
this.attachmentsView.classList.toggle('hidden', view !== SidebarView.ATTACHMENTS);
if (forceOpen && !this.isOpen) {
this.open();
@ -3703,6 +3688,8 @@ class PDFSidebar {
}
if (shouldForceRendering) {
this._updateThumbnailViewer();
this._forceRendering();
}
@ -3722,8 +3709,7 @@ class PDFSidebar {
this.isOpen = true;
this.toggleButton.classList.add('toggled');
this.outerContainer.classList.add('sidebarMoving');
this.outerContainer.classList.add('sidebarOpen');
this.outerContainer.classList.add('sidebarMoving', 'sidebarOpen');
if (this.active === SidebarView.THUMBS) {
this._updateThumbnailViewer();
@ -6887,12 +6873,11 @@ class PDFOutlineViewer {
div.insertBefore(toggler, div.firstChild);
}
_toggleOutlineItem(root, show) {
_toggleOutlineItem(root, show = false) {
this.lastToggleIsShow = show;
let togglers = root.querySelectorAll('.outlineItemToggler');
for (let i = 0, ii = togglers.length; i < ii; ++i) {
togglers[i].classList[show ? 'remove' : 'add']('outlineItemsHidden');
for (const toggler of root.querySelectorAll('.outlineItemToggler')) {
toggler.classList.toggle('outlineItemsHidden', !show);
}
}
@ -10595,43 +10580,22 @@ class SecondaryToolbar {
}
_bindCursorToolsListener(buttons) {
this.eventBus.on('cursortoolchanged', function (evt) {
buttons.cursorSelectToolButton.classList.remove('toggled');
buttons.cursorHandToolButton.classList.remove('toggled');
switch (evt.tool) {
case _pdf_cursor_tools.CursorTool.SELECT:
buttons.cursorSelectToolButton.classList.add('toggled');
break;
case _pdf_cursor_tools.CursorTool.HAND:
buttons.cursorHandToolButton.classList.add('toggled');
break;
}
this.eventBus.on('cursortoolchanged', function ({
tool
}) {
buttons.cursorSelectToolButton.classList.toggle('toggled', tool === _pdf_cursor_tools.CursorTool.SELECT);
buttons.cursorHandToolButton.classList.toggle('toggled', tool === _pdf_cursor_tools.CursorTool.HAND);
});
}
_bindScrollModeListener(buttons) {
function scrollModeChanged(evt) {
buttons.scrollVerticalButton.classList.remove('toggled');
buttons.scrollHorizontalButton.classList.remove('toggled');
buttons.scrollWrappedButton.classList.remove('toggled');
switch (evt.mode) {
case _ui_utils.ScrollMode.VERTICAL:
buttons.scrollVerticalButton.classList.add('toggled');
break;
case _ui_utils.ScrollMode.HORIZONTAL:
buttons.scrollHorizontalButton.classList.add('toggled');
break;
case _ui_utils.ScrollMode.WRAPPED:
buttons.scrollWrappedButton.classList.add('toggled');
break;
}
const isScrollModeHorizontal = evt.mode === _ui_utils.ScrollMode.HORIZONTAL;
function scrollModeChanged({
mode
}) {
buttons.scrollVerticalButton.classList.toggle('toggled', mode === _ui_utils.ScrollMode.VERTICAL);
buttons.scrollHorizontalButton.classList.toggle('toggled', mode === _ui_utils.ScrollMode.HORIZONTAL);
buttons.scrollWrappedButton.classList.toggle('toggled', mode === _ui_utils.ScrollMode.WRAPPED);
const isScrollModeHorizontal = mode === _ui_utils.ScrollMode.HORIZONTAL;
buttons.spreadNoneButton.disabled = isScrollModeHorizontal;
buttons.spreadOddButton.disabled = isScrollModeHorizontal;
buttons.spreadEvenButton.disabled = isScrollModeHorizontal;
@ -10648,24 +10612,12 @@ class SecondaryToolbar {
}
_bindSpreadModeListener(buttons) {
function spreadModeChanged(evt) {
buttons.spreadNoneButton.classList.remove('toggled');
buttons.spreadOddButton.classList.remove('toggled');
buttons.spreadEvenButton.classList.remove('toggled');
switch (evt.mode) {
case _ui_utils.SpreadMode.NONE:
buttons.spreadNoneButton.classList.add('toggled');
break;
case _ui_utils.SpreadMode.ODD:
buttons.spreadOddButton.classList.add('toggled');
break;
case _ui_utils.SpreadMode.EVEN:
buttons.spreadEvenButton.classList.add('toggled');
break;
}
function spreadModeChanged({
mode
}) {
buttons.spreadNoneButton.classList.toggle('toggled', mode === _ui_utils.SpreadMode.NONE);
buttons.spreadOddButton.classList.toggle('toggled', mode === _ui_utils.SpreadMode.ODD);
buttons.spreadEvenButton.classList.toggle('toggled', mode === _ui_utils.SpreadMode.EVEN);
}
this.eventBus.on('spreadmodechanged', spreadModeChanged);

View File

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.1.243
release: version 2.2.8
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/

View File

@ -21,14 +21,11 @@ var {getInplaceEditorForSpan: inplaceEditor} =
const ROOT_TEST_DIR = getRootDirectory(gTestPath);
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";
const STYLE_INSPECTOR_L10N
= new LocalizationHelper("devtools/shared/locales/styleinspector.properties");
Services.prefs.setBoolPref("devtools.inspector.shapesHighlighter.enabled", true);
const STYLE_INSPECTOR_L10N =
new LocalizationHelper("devtools/shared/locales/styleinspector.properties");
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.defaultColorUnit");
Services.prefs.clearUserPref("devtools.inspector.shapesHighlighter.enabled");
});
/**

View File

@ -50,8 +50,6 @@ pref("devtools.inspector.showUserAgentStyles", false);
pref("devtools.inspector.showAllAnonymousContent", false);
// Show user agent shadow roots
pref("devtools.inspector.showUserAgentShadowRoots", false);
// Enable the CSS shapes highlighter
pref("devtools.inspector.shapesHighlighter.enabled", true);
// Enable the font highlight-on-hover feature
pref("devtools.inspector.fonthighlighter.enabled", true);
// Enable tracking of style changes and the Changes panel in the Inspector

View File

@ -4,7 +4,6 @@
"use strict";
const Services = require("Services");
const {angleUtils} = require("devtools/client/shared/css-angle");
const {colorUtils} = require("devtools/shared/css/color");
const {getCSSLexer} = require("devtools/shared/css/lexer");
@ -36,8 +35,6 @@ const BASIC_SHAPE_FUNCTIONS = ["polygon", "circle", "ellipse", "inset"];
const HTML_NS = "http://www.w3.org/1999/xhtml";
const CSS_SHAPES_ENABLED_PREF = "devtools.inspector.shapesHighlighter.enabled";
/**
* This module is used to process text for output by developer tools. This means
* linking JS files with the debugger, CSS files with the style editor, JS
@ -368,7 +365,6 @@ OutputParser.prototype = {
colorUtils.isValidCSSColor(functionText, this.cssColor4)) {
this._appendColor(functionText, options);
} else if (options.expectShape &&
Services.prefs.getBoolPref(CSS_SHAPES_ENABLED_PREF) &&
BASIC_SHAPE_FUNCTIONS.includes(token.text)) {
this._appendShape(functionText, options);
} else {

View File

@ -6,7 +6,6 @@
const OutputParser = require("devtools/client/shared/output-parser");
const {initCssProperties, getCssProperties} = require("devtools/shared/fronts/css-properties");
const { CSS_PROPERTIES_DB} = require("devtools/shared/css/properties-db");
const CSS_SHAPES_ENABLED_PREF = "devtools.inspector.shapesHighlighter.enabled";
add_task(async function() {
await addTab("about:blank");
@ -308,7 +307,7 @@ function testParseAngle(doc, parser) {
function testParseShape(doc, parser) {
info("Test shape parsing");
pushPref(CSS_SHAPES_ENABLED_PREF, true);
const tests = [
{
desc: "Polygon shape",

View File

@ -14,6 +14,25 @@
class nsIPrincipal;
namespace JS {
enum AsmJSCacheResult {
AsmJSCache_Success,
AsmJSCache_MIN = AsmJSCache_Success,
AsmJSCache_ModuleTooSmall,
AsmJSCache_SynchronousScript,
AsmJSCache_QuotaExceeded,
AsmJSCache_StorageInitFailure,
AsmJSCache_Disabled_Internal,
AsmJSCache_Disabled_ShellFlags,
AsmJSCache_Disabled_JitInspector,
AsmJSCache_InternalError,
AsmJSCache_Disabled_PrivateBrowsing,
AsmJSCache_LIMIT
};
} // namespace JS
namespace mozilla {
namespace ipc {

View File

@ -82,7 +82,6 @@
#include "mozilla/Telemetry.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/asmjscache/AsmJSCache.h"
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
#include "mozilla/ContentEvents.h"
#include "mozilla/CycleCollectedJSContext.h"
@ -2385,26 +2384,6 @@ static void SetIncrementalCCPrefChangedCallback(const char* aPrefName,
sIncrementalCC = pref;
}
static bool AsmJSCacheOpenEntryForRead(JS::Handle<JSObject*> aGlobal,
const char16_t* aBegin,
const char16_t* aLimit, size_t* aSize,
const uint8_t** aMemory,
intptr_t* aHandle) {
nsIPrincipal* principal = nsJSPrincipals::get(
JS::GetRealmPrincipals(js::GetNonCCWObjectRealm(aGlobal)));
return asmjscache::OpenEntryForRead(principal, aBegin, aLimit, aSize, aMemory,
aHandle);
}
static JS::AsmJSCacheResult AsmJSCacheOpenEntryForWrite(
JS::Handle<JSObject*> aGlobal, const char16_t* aBegin, const char16_t* aEnd,
size_t aSize, uint8_t** aMemory, intptr_t* aHandle) {
nsIPrincipal* principal = nsJSPrincipals::get(
JS::GetRealmPrincipals(js::GetNonCCWObjectRealm(aGlobal)));
return asmjscache::OpenEntryForWrite(principal, aBegin, aEnd, aSize, aMemory,
aHandle);
}
class JSDispatchableRunnable final : public Runnable {
~JSDispatchableRunnable() { MOZ_ASSERT(!mDispatchable); }
@ -2478,12 +2457,6 @@ void nsJSContext::EnsureStatics() {
sPrevGCSliceCallback = JS::SetGCSliceCallback(jsapi.cx(), DOMGCSliceCallback);
// Set up the asm.js cache callbacks
static const JS::AsmJSCacheOps asmJSCacheOps = {
AsmJSCacheOpenEntryForRead, asmjscache::CloseEntryForRead,
AsmJSCacheOpenEntryForWrite, asmjscache::CloseEntryForWrite};
JS::SetAsmJSCacheOps(jsapi.cx(), &asmJSCacheOps);
JS::InitDispatchToEventLoop(jsapi.cx(), DispatchToEventLoop, nullptr);
JS::InitConsumeStreamCallback(jsapi.cx(), ConsumeStream,
FetchUtil::ReportJSStreamError);

View File

@ -39,7 +39,6 @@
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/asmjscache/AsmJSCache.h"
#include "mozilla/dom/AtomList.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/ErrorEventBinding.h"
@ -663,43 +662,6 @@ void CTypesActivityCallback(JSContext* aCx, js::CTypesActivityType aType) {
}
}
static nsIPrincipal* GetPrincipalForAsmJSCacheOp() {
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
if (!workerPrivate) {
return nullptr;
}
// asmjscache::OpenEntryForX guarnatee to only access the given nsIPrincipal
// from the main thread.
return workerPrivate->GetPrincipalDontAssertMainThread();
}
static bool AsmJSCacheOpenEntryForRead(JS::Handle<JSObject*> aGlobal,
const char16_t* aBegin,
const char16_t* aLimit, size_t* aSize,
const uint8_t** aMemory,
intptr_t* aHandle) {
nsIPrincipal* principal = GetPrincipalForAsmJSCacheOp();
if (!principal) {
return false;
}
return asmjscache::OpenEntryForRead(principal, aBegin, aLimit, aSize, aMemory,
aHandle);
}
static JS::AsmJSCacheResult AsmJSCacheOpenEntryForWrite(
JS::Handle<JSObject*> aGlobal, const char16_t* aBegin, const char16_t* aEnd,
size_t aSize, uint8_t** aMemory, intptr_t* aHandle) {
nsIPrincipal* principal = GetPrincipalForAsmJSCacheOp();
if (!principal) {
return JS::AsmJSCache_InternalError;
}
return asmjscache::OpenEntryForWrite(principal, aBegin, aEnd, aSize, aMemory,
aHandle);
}
// JSDispatchableRunnables are WorkerRunnables used to dispatch JS::Dispatchable
// back to their worker thread. A WorkerRunnable is used for two reasons:
//
@ -824,12 +786,6 @@ bool InitJSContextForWorker(WorkerPrivate* aWorkerPrivate,
ContentSecurityPolicyAllows};
JS_SetSecurityCallbacks(aWorkerCx, &securityCallbacks);
// Set up the asm.js cache callbacks
static const JS::AsmJSCacheOps asmJSCacheOps = {
AsmJSCacheOpenEntryForRead, asmjscache::CloseEntryForRead,
AsmJSCacheOpenEntryForWrite, asmjscache::CloseEntryForWrite};
JS::SetAsmJSCacheOps(aWorkerCx, &asmJSCacheOps);
// A WorkerPrivate lives strictly longer than its JSRuntime so we can safely
// store a raw pointer as the callback's closure argument on the JSRuntime.
JS::InitDispatchToEventLoop(aWorkerCx, DispatchToEventLoop,

View File

@ -285,7 +285,6 @@ WorkletThread::DelayedDispatch(already_AddRefed<nsIRunnable>, uint32_t aFlags) {
// FIXME: JSSettings
// FIXME: JS_SetNativeStackQuota
// FIXME: JS_SetSecurityCallbacks
// FIXME: JS::SetAsmJSCacheOps
// FIXME: JS::SetAsyncTaskCallbacks
// FIXME: JS_AddInterruptCallback
// FIXME: JS::SetCTypesActivityCallback

View File

@ -57,6 +57,7 @@
#include "js/UniquePtr.h"
#include "js/Vector.h"
#include "js/Wrapper.h"
#include "threading/CpuCount.h"
#include "util/StringBuffer.h"
#include "util/Text.h"
#include "vm/AsyncFunction.h"
@ -5071,6 +5072,19 @@ static bool SetTimeZone(JSContext* cx, unsigned argc, Value* vp) {
return true;
}
static bool GetCoreCount(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
RootedObject callee(cx, &args.callee());
if (args.length() != 0) {
ReportUsageErrorASCII(cx, callee, "Wrong number of arguments");
return false;
}
args.rval().setInt32(GetCPUCount());
return true;
}
static bool GetDefaultLocale(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
RootedObject callee(cx, &args.callee());
@ -6291,6 +6305,11 @@ gc::ZealModeHelpText),
"getDefaultLocale()",
" Get the current default locale.\n"),
JS_FN_HELP("getCoreCount", GetCoreCount, 0, 0,
"getCoreCount()",
" Get the number of CPU cores from the platform layer. Typically this\n"
" means the number of hyperthreads on systems where that makes sense.\n"),
JS_FN_HELP("setTimeResolution", SetTimeResolution, 2, 0,
"setTimeResolution(resolution, jitter)",
" Enables time clamping and jittering. Specify a time resolution in\n"

View File

@ -10,7 +10,6 @@ import os
import platform
import posixpath
import shlex
import shutil
import subprocess
import sys
import traceback
@ -30,8 +29,6 @@ import jittests
from tests import get_jitflags, valid_jitflags, get_cpu_count, get_environment_overlay, \
change_env
# Python 3.3 added shutil.which, but we can't use that yet.
def which(name):
if name.find(os.path.sep) != -1:
@ -353,10 +350,6 @@ def main(argv):
prefix += ['-f', prologue]
# Clean up any remnants from previous crashes etc
shutil.rmtree(jittests.JS_CACHE_DIR, ignore_errors=True)
os.mkdir(jittests.JS_CACHE_DIR)
if options.debugger:
if job_count > 1:
print('Multiple tests match command line'

View File

@ -1,13 +1,5 @@
// |jit-test| skip-if: !isAsmJSCompilationAvailable()
// Test a big fat asm.js module. First load/compile/cache bullet.js in a
// separate process and then load it again in this process.
// Note: if you get some failure in this test, it probably has to do with
// bullet.js and not the nestedShell() call, so try first commenting out
// nestedShell() to see if the error reproduces.
var code = "setIonCheckGraphCoherency(false); load('" + libdir + "bullet.js'); runBullet()";
nestedShell("--js-cache", "--no-js-cache-per-process", "--execute=" + code);
setIonCheckGraphCoherency(false);
load(libdir + 'bullet.js');
var results = runBullet();

View File

@ -10,7 +10,6 @@ var blacklist = {
'crash': true,
'readline': true,
'terminate': true,
'nestedShell': true,
'nukeAllCCWs': true,
};

View File

@ -1,8 +1,3 @@
// |jit-test| slow;
//
// Temporarily marked as slow - they time out on the build systems even with
// reduced iteration count.
//
// Test that wasm atomic operations implement correct mutual exclusion.
//
// We have several agents that attempt to hammer on a shared location with rmw
@ -20,12 +15,25 @@ const ITERATIONS = 100000;
const NUMWORKERS = 2;
const NUMAGENTS = NUMWORKERS + 1;
// Need at least one thread per agent.
if (!wasmThreadsSupported() || helperThreadCount() < NUMWORKERS) {
if (DEBUG > 0)
print("Threads not supported");
quit(0);
}
// Unless there are enough actual cores the spinning threads will not interact
// in the desired way (we'll be waiting on preemption to advance), and this
// makes the test pointless and also will usually make it time out. So bail out
// if we can't have one core per agent.
if (getCoreCount() < NUMAGENTS) {
if (DEBUG > 0)
print("Fake or feeble hardware");
quit(0);
}
// Most of the simulators have poor support for mutual exclusion and are anyway
// too slow; avoid intermittent failures and timeouts.

View File

@ -3206,6 +3206,7 @@ static bool IsResumableMIRType(MIRType type) {
case MIRType::Doublex2: // NYI, see also RSimdBox::recover
case MIRType::SinCosDouble:
case MIRType::Int64:
case MIRType::RefOrNull:
return false;
}
MOZ_CRASH("Unknown MIRType.");

View File

@ -466,6 +466,7 @@ enum class MIRType : uint8_t {
Slots, // A slots vector
Elements, // An elements vector
Pointer, // An opaque pointer that receives no special treatment
RefOrNull, // Wasm Ref/AnyRef/NullRef: a raw JSObject* or a raw (void*)0
Shape, // A Shape pointer.
ObjectGroup, // An ObjectGroup pointer.
Last = ObjectGroup,
@ -563,6 +564,7 @@ static inline size_t MIRTypeToSize(MIRType type) {
case MIRType::Double:
return 8;
case MIRType::Pointer:
case MIRType::RefOrNull:
return sizeof(uintptr_t);
default:
MOZ_CRASH("MIRTypeToSize - unhandled case");
@ -619,6 +621,8 @@ static inline const char* StringFromMIRType(MIRType type) {
return "Elements";
case MIRType::Pointer:
return "Pointer";
case MIRType::RefOrNull:
return "RefOrNull";
case MIRType::Shape:
return "Shape";
case MIRType::ObjectGroup:

View File

@ -48,6 +48,7 @@ ABIArg ABIArgGenerator::softNext(MIRType type) {
switch (type) {
case MIRType::Int32:
case MIRType::Pointer:
case MIRType::RefOrNull:
if (intRegIndex_ == NumIntArgRegs) {
current_ = ABIArg(stackOffset_);
stackOffset_ += sizeof(uint32_t);
@ -108,6 +109,7 @@ ABIArg ABIArgGenerator::hardNext(MIRType type) {
switch (type) {
case MIRType::Int32:
case MIRType::Pointer:
case MIRType::RefOrNull:
if (intRegIndex_ == NumIntArgRegs) {
current_ = ABIArg(stackOffset_);
stackOffset_ += sizeof(uint32_t);

View File

@ -35,6 +35,7 @@ ABIArg ABIArgGenerator::next(MIRType type) {
case MIRType::Int32:
case MIRType::Int64:
case MIRType::Pointer:
case MIRType::RefOrNull:
if (intRegIndex_ == NumIntArgRegs) {
current_ = ABIArg(stackOffset_);
stackOffset_ += sizeof(uintptr_t);

View File

@ -24,6 +24,7 @@ ABIArg ABIArgGenerator::next(MIRType type) {
switch (type) {
case MIRType::Int32:
case MIRType::Pointer:
case MIRType::RefOrNull:
if (GetIntArgReg(usedArgSlots_, &destReg)) {
current_ = ABIArg(destReg);
} else {

View File

@ -20,7 +20,8 @@ ABIArg ABIArgGenerator::next(MIRType type) {
switch (type) {
case MIRType::Int32:
case MIRType::Int64:
case MIRType::Pointer: {
case MIRType::Pointer:
case MIRType::RefOrNull: {
Register destReg;
if (GetIntArgReg(usedArgSlots_, &destReg)) {
current_ = ABIArg(destReg);

View File

@ -45,6 +45,7 @@ ABIArg ABIArgGenerator::next(MIRType type) {
case MIRType::Int32:
case MIRType::Int64:
case MIRType::Pointer:
case MIRType::RefOrNull:
current_ = ABIArg(IntArgRegs[regIndex_++]);
break;
case MIRType::Float32:
@ -74,6 +75,7 @@ ABIArg ABIArgGenerator::next(MIRType type) {
case MIRType::Int32:
case MIRType::Int64:
case MIRType::Pointer:
case MIRType::RefOrNull:
if (intRegIndex_ == NumIntArgRegs) {
current_ = ABIArg(stackOffset_);
stackOffset_ += sizeof(uint64_t);

View File

@ -18,6 +18,7 @@ ABIArg ABIArgGenerator::next(MIRType type) {
case MIRType::Int32:
case MIRType::Float32:
case MIRType::Pointer:
case MIRType::RefOrNull:
current_ = ABIArg(stackOffset_);
stackOffset_ += sizeof(uint32_t);
break;

View File

@ -97,7 +97,6 @@
#include "vm/SymbolType.h"
#include "vm/WrapperObject.h"
#include "vm/Xdr.h"
#include "wasm/AsmJS.h"
#include "wasm/WasmModule.h"
#include "vm/Compartment-inl.h"
@ -6005,11 +6004,6 @@ JS_PUBLIC_API bool JS::FinishIncrementalEncoding(JSContext* cx,
return true;
}
JS_PUBLIC_API void JS::SetAsmJSCacheOps(JSContext* cx,
const JS::AsmJSCacheOps* ops) {
cx->runtime()->asmJSCacheOps = *ops;
}
bool JS::IsWasmModuleObject(HandleObject obj) {
return obj->canUnwrapAs<WasmModuleObject>();
}

View File

@ -3542,63 +3542,6 @@ extern JS_PUBLIC_API StackFormat GetStackFormat(JSContext* cx);
namespace JS {
/*
* This callback represents a request by the JS engine to open for reading the
* existing cache entry for the given global and char range that may contain a
* module. If a cache entry exists, the callback shall return 'true' and return
* the size, base address and an opaque file handle as outparams. If the
* callback returns 'true', the JS engine guarantees a call to
* CloseAsmJSCacheEntryForReadOp, passing the same base address, size and
* handle.
*/
using OpenAsmJSCacheEntryForReadOp =
bool (*)(HandleObject global, const char16_t* begin, const char16_t* limit,
size_t* size, const uint8_t** memory, intptr_t* handle);
using CloseAsmJSCacheEntryForReadOp = void (*)(size_t size,
const uint8_t* memory,
intptr_t handle);
/** The list of reasons why an asm.js module may not be stored in the cache. */
enum AsmJSCacheResult {
AsmJSCache_Success,
AsmJSCache_MIN = AsmJSCache_Success,
AsmJSCache_ModuleTooSmall,
AsmJSCache_SynchronousScript,
AsmJSCache_QuotaExceeded,
AsmJSCache_StorageInitFailure,
AsmJSCache_Disabled_Internal,
AsmJSCache_Disabled_ShellFlags,
AsmJSCache_Disabled_JitInspector,
AsmJSCache_InternalError,
AsmJSCache_Disabled_PrivateBrowsing,
AsmJSCache_LIMIT
};
/*
* This callback represents a request by the JS engine to open for writing a
* cache entry of the given size for the given global and char range containing
* the just-compiled module. If cache entry space is available, the callback
* shall return 'true' and return the base address and an opaque file handle as
* outparams. If the callback returns 'true', the JS engine guarantees a call
* to CloseAsmJSCacheEntryForWriteOp passing the same base address, size and
* handle.
*/
using OpenAsmJSCacheEntryForWriteOp = AsmJSCacheResult (*)(
HandleObject global, const char16_t* begin, const char16_t* end,
size_t size, uint8_t** memory, intptr_t* handle);
using CloseAsmJSCacheEntryForWriteOp = void (*)(size_t size, uint8_t* memory,
intptr_t handle);
struct AsmJSCacheOps {
OpenAsmJSCacheEntryForReadOp openEntryForRead = nullptr;
CloseAsmJSCacheEntryForReadOp closeEntryForRead = nullptr;
OpenAsmJSCacheEntryForWriteOp openEntryForWrite = nullptr;
CloseAsmJSCacheEntryForWriteOp closeEntryForWrite = nullptr;
};
extern JS_PUBLIC_API void SetAsmJSCacheOps(JSContext* cx,
const AsmJSCacheOps* callbacks);
/**
* The WasmModule interface allows the embedding to hold a reference to the
* underying C++ implementation of a JS WebAssembly.Module object for purposes

View File

@ -508,8 +508,6 @@ static uint32_t gZealBits = 0;
static uint32_t gZealFrequency = 0;
#endif
static bool printTiming = false;
static const char* jsCacheDir = nullptr;
static const char* jsCacheAsmJSPath = nullptr;
static RCFile* gErrFile = nullptr;
static RCFile* gOutFile = nullptr;
static bool reportWarnings = true;
@ -523,9 +521,6 @@ static bool dumpEntrainedVariables = false;
static bool OOM_printAllocationCount = false;
#endif
// Shell state this is only accessed on the main thread.
mozilla::Atomic<bool> jsCacheOpened(false);
static bool SetTimeoutValue(JSContext* cx, double t);
static void KillWatchdog(JSContext* cx);
@ -5640,9 +5635,6 @@ static bool runOffThreadDecodedScript(JSContext* cx, unsigned argc, Value* vp) {
return JS_ExecuteScript(cx, script, args.rval());
}
static int sArgc;
static char** sArgv;
class AutoCStringVector {
Vector<char*> argv_;
@ -5714,112 +5706,6 @@ static bool EscapeForShell(JSContext* cx, AutoCStringVector& argv) {
}
#endif
static Vector<const char*, 4, js::SystemAllocPolicy> sPropagatedFlags;
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
static bool PropagateFlagToNestedShells(const char* flag) {
return sPropagatedFlags.append(flag);
}
#endif
static bool NestedShell(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
AutoCStringVector argv(cx);
// The first argument to the shell is its path, which we assume is our own
// argv[0].
if (sArgc < 1) {
JS_ReportErrorNumberASCII(cx, my_GetErrorMessage, nullptr,
JSSMSG_NESTED_FAIL);
return false;
}
UniqueChars shellPath = DuplicateString(cx, sArgv[0]);
if (!shellPath || !argv.append(std::move(shellPath))) {
return false;
}
// Propagate selected flags from the current shell
for (unsigned i = 0; i < sPropagatedFlags.length(); i++) {
UniqueChars flags = DuplicateString(cx, sPropagatedFlags[i]);
if (!flags || !argv.append(std::move(flags))) {
return false;
}
}
// The arguments to nestedShell are stringified and append to argv.
for (unsigned i = 0; i < args.length(); i++) {
JSString* str = ToString(cx, args[i]);
if (!str) {
return false;
}
JSLinearString* linear = str->ensureLinear(cx);
if (!linear) {
return false;
}
UniqueChars arg;
if (StringEqualsAscii(linear, "--js-cache") && jsCacheDir) {
// As a special case, if the caller passes "--js-cache", use
// "--js-cache=$(jsCacheDir)" instead.
arg = JS_smprintf("--js-cache=%s", jsCacheDir);
if (!arg) {
JS_ReportOutOfMemory(cx);
return false;
}
} else {
arg = JS_EncodeStringToLatin1(cx, str);
if (!arg) {
return false;
}
}
if (!argv.append(std::move(arg))) {
return false;
}
}
// execv assumes argv is null-terminated
if (!argv.append(nullptr)) {
return false;
}
int status = 0;
#if defined(XP_WIN)
if (!EscapeForShell(cx, argv)) {
return false;
}
status = _spawnv(_P_WAIT, sArgv[0], argv.get());
#else
pid_t pid = fork();
switch (pid) {
case -1:
JS_ReportErrorNumberASCII(cx, my_GetErrorMessage, nullptr,
JSSMSG_NESTED_FAIL);
return false;
case 0:
(void)execv(sArgv[0], argv.get());
exit(-1);
default: {
while (waitpid(pid, &status, 0) < 0 && errno == EINTR) {
continue;
}
break;
}
}
#endif
if (status != 0) {
JS_ReportErrorNumberASCII(cx, my_GetErrorMessage, nullptr,
JSSMSG_NESTED_FAIL);
return false;
}
args.rval().setUndefined();
return true;
}
static bool ReadAll(int fd, wasm::Bytes* bytes) {
size_t lastLength = bytes->length();
while (true) {
@ -5916,8 +5802,11 @@ class AutoPipe {
}
};
static int sArgc;
static char** sArgv;
static const char sWasmCompileAndSerializeFlag[] =
"--wasm-compile-and-serialize";
static Vector<const char*, 4, js::SystemAllocPolicy> sCompilerProcessFlags;
static bool CompileAndSerializeInSeparateProcess(JSContext* cx,
const uint8_t* bytecode,
@ -5935,10 +5824,10 @@ static bool CompileAndSerializeInSeparateProcess(JSContext* cx,
return false;
}
// Propagate shell flags first, since they must precede the non-option
// Put compiler flags first since they must precede the non-option
// file-descriptor args (passed on Windows, below).
for (unsigned i = 0; i < sPropagatedFlags.length(); i++) {
UniqueChars flags = DuplicateString(cx, sPropagatedFlags[i]);
for (unsigned i = 0; i < sCompilerProcessFlags.length(); i++) {
UniqueChars flags = DuplicateString(cx, sCompilerProcessFlags[i]);
if (!flags || !argv.append(std::move(flags))) {
return false;
}
@ -8838,14 +8727,6 @@ static const JSFunctionSpecWithHelp fuzzing_unsafe_functions[] = {
"pc2line(fun[, pc])",
" Map PC to line number."),
JS_FN_HELP("nestedShell", NestedShell, 0, 0,
"nestedShell(shellArgs...)",
" Execute the given code in a new JS shell process, passing this nested shell\n"
" the arguments passed to nestedShell. argv[0] of the nested shell will be argv[0]\n"
" of the current shell (which is assumed to be the actual path to the shell.\n"
" arguments[0] (of the call to nestedShell) will be argv[1], arguments[1] will\n"
" be argv[2], etc."),
JS_INLINABLE_FN_HELP("assertFloat32", testingFunc_assertFloat32, 2, 0, TestAssertFloat32,
"assertFloat32(value, isFloat32)",
" In IonMonkey only, asserts that value has (resp. hasn't) the MIRType::Float32 if isFloat32 is true (resp. false)."),
@ -9636,103 +9517,6 @@ static bool InstanceClassHasProtoAtDepth(const Class* clasp, uint32_t protoID,
return true;
}
class ScopedFileDesc {
intptr_t fd_;
public:
enum LockType { READ_LOCK, WRITE_LOCK };
ScopedFileDesc(int fd, LockType lockType) : fd_(fd) {
if (fd == -1) {
return;
}
if (!jsCacheOpened.compareExchange(false, true)) {
close(fd_);
fd_ = -1;
return;
}
}
~ScopedFileDesc() {
if (fd_ == -1) {
return;
}
MOZ_ASSERT(jsCacheOpened == true);
jsCacheOpened = false;
close(fd_);
}
operator intptr_t() const { return fd_; }
intptr_t forget() {
intptr_t ret = fd_;
fd_ = -1;
return ret;
}
};
// To guard against corrupted cache files generated by previous crashes, write
// asmJSCacheCookie to the first uint32_t of the file only after the file is
// fully serialized and flushed to disk.
static const uint32_t asmJSCacheCookie = 0xabbadaba;
static bool ShellOpenAsmJSCacheEntryForRead(
HandleObject global, const char16_t* begin, const char16_t* limit,
size_t* serializedSizeOut, const uint8_t** memoryOut, intptr_t* handleOut) {
return false;
}
static void ShellCloseAsmJSCacheEntryForRead(size_t serializedSize,
const uint8_t* memory,
intptr_t handle) {
// Undo the cookie adjustment done when opening the file.
memory -= sizeof(uint32_t);
serializedSize += sizeof(uint32_t);
// Release the memory mapping and file.
#ifdef XP_WIN
UnmapViewOfFile(const_cast<uint8_t*>(memory));
#else
munmap(const_cast<uint8_t*>(memory), serializedSize);
#endif
MOZ_ASSERT(jsCacheOpened == true);
jsCacheOpened = false;
close(handle);
}
static JS::AsmJSCacheResult ShellOpenAsmJSCacheEntryForWrite(
HandleObject global, const char16_t* begin, const char16_t* end,
size_t serializedSize, uint8_t** memoryOut, intptr_t* handleOut) {
return JS::AsmJSCache_Disabled_ShellFlags;
}
static void ShellCloseAsmJSCacheEntryForWrite(size_t serializedSize,
uint8_t* memory,
intptr_t handle) {
// Undo the cookie adjustment done when opening the file.
memory -= sizeof(uint32_t);
serializedSize += sizeof(uint32_t);
// Write the magic cookie value after flushing the entire cache entry.
#ifdef XP_WIN
FlushViewOfFile(memory, serializedSize);
FlushFileBuffers(HANDLE(_get_osfhandle(handle)));
#else
msync(memory, serializedSize, MS_SYNC);
#endif
MOZ_ASSERT(*(uint32_t*)memory == 0);
*(uint32_t*)memory = asmJSCacheCookie;
// Free the memory mapping and file.
#ifdef XP_WIN
UnmapViewOfFile(const_cast<uint8_t*>(memory));
#else
munmap(memory, serializedSize);
#endif
MOZ_ASSERT(jsCacheOpened == true);
jsCacheOpened = false;
close(handle);
}
static bool ShellBuildId(JS::BuildIdCharVector* buildId) {
// The browser embeds the date into the buildid and the buildid is embedded
// in the binary, so every 'make' necessarily builds a new firefox binary.
@ -9740,17 +9524,11 @@ static bool ShellBuildId(JS::BuildIdCharVector* buildId) {
// libxul.so and other shared modules -- so this isn't a big deal. Not so
// for the statically-linked JS shell. To avoid recompiling js.cpp and
// re-linking 'js' on every 'make', we use a constant buildid and rely on
// the shell user to manually clear the cache (deleting the dir passed to
// --js-cache) between cache-breaking updates. Note: jit_tests.py does this
// on every run).
// the shell user to manually clear any caches between cache-breaking updates.
const char buildid[] = "JS-shell";
return buildId->append(buildid, sizeof(buildid));
}
static const JS::AsmJSCacheOps asmJSCacheOps = {
ShellOpenAsmJSCacheEntryForRead, ShellCloseAsmJSCacheEntryForRead,
ShellOpenAsmJSCacheEntryForWrite, ShellCloseAsmJSCacheEntryForWrite};
static bool TimesAccessed(JSContext* cx, unsigned argc, Value* vp) {
static int32_t accessed = 0;
CallArgs args = CallArgsFromVp(argc, vp);
@ -10391,20 +10169,6 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
cx->runtime()->profilingScripts =
enableCodeCoverage || enableDisassemblyDumps;
if (const char* jsCacheOpt = op.getStringOption("js-cache")) {
UniqueChars jsCacheChars;
if (!op.getBoolOption("no-js-cache-per-process")) {
jsCacheChars = JS_smprintf("%s/%u", jsCacheOpt, (unsigned)getpid());
} else {
jsCacheChars = DuplicateString(jsCacheOpt);
}
if (!jsCacheChars) {
return false;
}
jsCacheDir = jsCacheChars.release();
jsCacheAsmJSPath = JS_smprintf("%s/asmjs.cache", jsCacheDir).release();
}
#ifdef DEBUG
dumpEntrainedVariables = op.getBoolOption("dump-entrained-variables");
#endif
@ -10641,17 +10405,6 @@ static int Shell(JSContext* cx, OptionParser* op, char** envp) {
}
}
if (!op->getBoolOption("no-js-cache-per-process")) {
if (jsCacheAsmJSPath) {
unlink(jsCacheAsmJSPath);
JS_free(cx, const_cast<char*>(jsCacheAsmJSPath));
}
if (jsCacheDir) {
rmdir(jsCacheDir);
JS_free(cx, const_cast<char*>(jsCacheDir));
}
}
/*
* Dump remaining type inference results while we still have a context.
* This printing depends on atoms still existing.
@ -10794,17 +10547,6 @@ int main(int argc, char** argv, char** envp) {
"Dump bytecode with exec count for all scripts") ||
!op.addBoolOption('b', "print-timing",
"Print sub-ms runtime for each file that's run") ||
!op.addStringOption(
'\0', "js-cache", "[path]",
"Enable the JS cache by specifying the path of the directory to use "
"to hold cache files") ||
!op.addBoolOption(
'\0', "no-js-cache-per-process",
"Deactivates cache per process. Otherwise, generate a separate cache"
"sub-directory for this process inside the cache directory"
"specified by --js-cache. This cache directory will be removed"
"when the js shell exits. This is useful for running tests in"
"parallel.") ||
!op.addBoolOption('\0', "code-coverage",
"Enable code coverage instrumentation.")
#ifdef DEBUG
@ -11071,15 +10813,21 @@ int main(int argc, char** argv, char** envp) {
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
if (op.getBoolOption("no-sse3")) {
js::jit::CPUInfo::SetSSE3Disabled();
PropagateFlagToNestedShells("--no-sse3");
if (!sCompilerProcessFlags.append("--no-sse3")) {
return EXIT_SUCCESS;
}
}
if (op.getBoolOption("no-sse4")) {
js::jit::CPUInfo::SetSSE4Disabled();
PropagateFlagToNestedShells("--no-sse4");
if (!sCompilerProcessFlags.append("--no-sse4")) {
return EXIT_SUCCESS;
}
}
if (op.getBoolOption("enable-avx")) {
js::jit::CPUInfo::SetAVXEnabled();
PropagateFlagToNestedShells("--enable-avx");
if (!sCompilerProcessFlags.append("--enable-avx")) {
return EXIT_SUCCESS;
}
}
#endif
@ -11151,7 +10899,6 @@ int main(int argc, char** argv, char** envp) {
JS_SetDestroyCompartmentCallback(cx, DestroyShellCompartmentPrivate);
JS_AddInterruptCallback(cx, ShellInterruptCallback);
JS::SetAsmJSCacheOps(cx, &asmJSCacheOps);
bufferStreamState = js_new<ExclusiveWaitableData<BufferStreamState>>(
mutexid::BufferStreamState);

View File

@ -9,6 +9,7 @@
from __future__ import print_function
import os
import posixpath
import re
import sys
import traceback
from collections import namedtuple
@ -29,7 +30,6 @@ TOP_SRC_DIR = os.path.dirname(os.path.dirname(JS_DIR))
TEST_DIR = os.path.join(JS_DIR, 'jit-test', 'tests')
LIB_DIR = os.path.join(JS_DIR, 'jit-test', 'lib') + os.path.sep
MODULE_DIR = os.path.join(JS_DIR, 'jit-test', 'modules') + os.path.sep
JS_CACHE_DIR = os.path.join(JS_DIR, 'jit-test', '.js-cache')
JS_TESTS_DIR = posixpath.join(JS_DIR, 'tests')
# Backported from Python 3.1 posixpath.py
@ -195,7 +195,6 @@ class JitTest:
# We would use 500019 (5k19), but quit() only accepts values up to 127, due to fuzzers
SKIPPED_EXIT_STATUS = 59
CacheDir = JS_CACHE_DIR
Directives = {}
@classmethod
@ -344,7 +343,7 @@ class JitTest:
# We may have specified '-a' or '-d' twice: once via --jitflags, once
# via the "|jit-test|" line. Remove dups because they are toggles.
cmd = prefix + ['--js-cache', JitTest.CacheDir]
cmd = prefix + []
cmd += list(set(self.jitflags))
for expr in exprs:
cmd += ['-e', expr]
@ -409,7 +408,7 @@ def find_tests(substring=None, run_binast=False):
def run_test_remote(test, device, prefix, options):
from mozdevice import ADBDevice, ADBProcessError, ADBTimeoutError
from mozdevice import ADBDevice, ADBProcessError
if options.test_reflect_stringify:
raise ValueError("can't run Reflect.stringify tests remotely")
@ -429,15 +428,23 @@ def run_test_remote(test, device, prefix, options):
cmd = ADBDevice._escape_command_line(cmd)
start = datetime.now()
try:
# Allow ADBError or ADBTimeoutError to terminate the test run,
# but handle ADBProcessError in order to support the use of
# non-zero exit codes in the JavaScript shell tests.
out = device.shell_output(cmd, env=env,
cwd=options.remote_test_root,
timeout=int(options.timeout))
returncode = 0
except ADBTimeoutError:
raise
except ADBProcessError as e:
# Treat ignorable intermittent adb communication errors as
# skipped tests.
out = str(e.adb_process.stdout)
returncode = e.adb_process.exitcode
re_ignore = re.compile(r'error: (closed|device .* not found)')
if returncode == 1 and re_ignore.search(out):
print("Skipping {} due to ignorable adb error {}".format(test.path, out))
test.skip_if_cond = "true"
returncode = test.SKIPPED_EXIT_STATUS
elapsed = (datetime.now() - start).total_seconds()
@ -793,39 +800,46 @@ def init_remote_dir(device, path, root=True):
def run_tests_remote(tests, num_tests, prefix, options, slog):
# Setup device with everything needed to run our tests.
from mozdevice import ADBDevice
device = ADBDevice(device=options.device_serial,
test_root=options.remote_test_root)
from mozdevice import ADBDevice, ADBError, ADBTimeoutError
try:
device = ADBDevice(device=options.device_serial,
test_root=options.remote_test_root)
init_remote_dir(device, options.remote_test_root)
init_remote_dir(device, options.remote_test_root)
# Update the test root to point to our test directory.
jit_tests_dir = posixpath.join(options.remote_test_root, 'jit-tests')
options.remote_test_root = posixpath.join(jit_tests_dir, 'jit-tests')
# Update the test root to point to our test directory.
jit_tests_dir = posixpath.join(options.remote_test_root, 'jit-tests')
options.remote_test_root = posixpath.join(jit_tests_dir, 'jit-tests')
# Push js shell and libraries.
init_remote_dir(device, jit_tests_dir)
push_libs(options, device)
push_progs(options, device, [prefix[0]])
device.chmod(options.remote_test_root, recursive=True, root=True)
# Push js shell and libraries.
init_remote_dir(device, jit_tests_dir)
push_libs(options, device)
push_progs(options, device, [prefix[0]])
device.chmod(options.remote_test_root, recursive=True, root=True)
JitTest.CacheDir = posixpath.join(options.remote_test_root, '.js-cache')
init_remote_dir(device, JitTest.CacheDir)
jtd_tests = posixpath.join(jit_tests_dir, 'tests')
init_remote_dir(device, jtd_tests)
device.push(JS_TESTS_DIR, jtd_tests, timeout=600)
device.chmod(jtd_tests, recursive=True, root=True)
jtd_tests = posixpath.join(jit_tests_dir, 'tests')
init_remote_dir(device, jtd_tests)
device.push(JS_TESTS_DIR, jtd_tests, timeout=600)
device.chmod(jtd_tests, recursive=True, root=True)
device.push(os.path.dirname(TEST_DIR), options.remote_test_root,
timeout=600)
device.chmod(options.remote_test_root, recursive=True, root=True)
prefix[0] = os.path.join(options.remote_test_root, 'js')
device.push(os.path.dirname(TEST_DIR), options.remote_test_root,
timeout=600)
device.chmod(options.remote_test_root, recursive=True, root=True)
prefix[0] = os.path.join(options.remote_test_root, 'js')
except (ADBError, ADBTimeoutError):
print("TEST-UNEXPECTED-FAIL | jit_test.py" +
" : Device initialization failed")
raise
# Run all tests.
pb = create_progressbar(num_tests, options)
gen = get_remote_results(tests, device, prefix, options)
ok = process_test_results(gen, num_tests, pb, options, slog)
try:
gen = get_remote_results(tests, device, prefix, options)
ok = process_test_results(gen, num_tests, pb, options, slog)
except (ADBError, ADBTimeoutError):
print("TEST-UNEXPECTED-FAIL | jit_test.py" +
" : Device error during test")
raise
return ok

View File

@ -230,7 +230,6 @@ struct JSContext : public JS::RootingContext,
js::WellKnownSymbols& wellKnownSymbols() {
return *runtime_->wellKnownSymbols;
}
const JS::AsmJSCacheOps& asmJSCacheOps() { return runtime_->asmJSCacheOps; }
js::PropertyName* emptyString() { return runtime_->emptyString; }
js::FreeOp* defaultFreeOp() { return runtime_->defaultFreeOp(); }
void* stackLimitAddress(JS::StackKind kind) {

View File

@ -399,10 +399,6 @@ struct JSRuntime : public js::MallocProvider<JSRuntime> {
void finishRoots();
public:
/* AsmJSCache callbacks are runtime-wide. */
js::UnprotectedData<JS::AsmJSCacheOps> asmJSCacheOps;
private:
js::UnprotectedData<const JSPrincipals*> trustedPrincipals_;

View File

@ -260,8 +260,6 @@ class AsmJSGlobal {
MOZ_ASSERT(pod.which_ == Constant);
return pod.u.constant.value_;
}
WASM_DECLARE_SERIALIZABLE(AsmJSGlobal);
};
typedef Vector<AsmJSGlobal, 0, SystemAllocPolicy> AsmJSGlobalVector;
@ -305,8 +303,6 @@ class AsmJSExport {
typedef Vector<AsmJSExport, 0, SystemAllocPolicy> AsmJSExportVector;
enum class CacheResult { Hit, Miss };
// Holds the immutable guts of an AsmJSModule.
//
// AsmJSMetadata is built incrementally by ModuleValidator and then shared
@ -329,8 +325,6 @@ struct js::AsmJSMetadata : Metadata, AsmJSMetadataCacheablePod {
CacheableChars importArgumentName;
CacheableChars bufferArgumentName;
CacheResult cacheResult;
// These values are not serialized since they are relative to the
// containing script which can be different between serialization and
// deserialization contexts. Thus, they must be set explicitly using the
@ -353,7 +347,6 @@ struct js::AsmJSMetadata : Metadata, AsmJSMetadataCacheablePod {
AsmJSMetadata()
: Metadata(ModuleKind::AsmJS),
cacheResult(CacheResult::Miss),
toStringStart(0),
srcStart(0),
strict(false) {}
@ -393,8 +386,6 @@ struct js::AsmJSMetadata : Metadata, AsmJSMetadataCacheablePod {
AsmJSMetadataCacheablePod& pod() { return *this; }
const AsmJSMetadataCacheablePod& pod() const { return *this; }
WASM_DECLARE_SERIALIZABLE_OVERRIDE(AsmJSMetadata)
};
typedef RefPtr<AsmJSMetadata> MutableAsmJSMetadata;
@ -6996,78 +6987,6 @@ static JSFunction* NewAsmJSModuleFunction(JSContext* cx, JSFunction* origFun,
return moduleFun;
}
/*****************************************************************************/
// Caching and cloning
size_t AsmJSGlobal::serializedSize() const {
return sizeof(pod) + field_.serializedSize();
}
uint8_t* AsmJSGlobal::serialize(uint8_t* cursor) const {
cursor = WriteBytes(cursor, &pod, sizeof(pod));
cursor = field_.serialize(cursor);
return cursor;
}
const uint8_t* AsmJSGlobal::deserialize(const uint8_t* cursor) {
(cursor = ReadBytes(cursor, &pod, sizeof(pod))) &&
(cursor = field_.deserialize(cursor));
return cursor;
}
size_t AsmJSGlobal::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const {
return field_.sizeOfExcludingThis(mallocSizeOf);
}
size_t AsmJSMetadata::serializedSize() const {
return Metadata::serializedSize() + sizeof(pod()) +
SerializedVectorSize(asmJSGlobals) +
SerializedPodVectorSize(asmJSImports) +
SerializedPodVectorSize(asmJSExports) +
SerializedVectorSize(asmJSFuncNames) +
globalArgumentName.serializedSize() +
importArgumentName.serializedSize() +
bufferArgumentName.serializedSize();
}
uint8_t* AsmJSMetadata::serialize(uint8_t* cursor) const {
cursor = Metadata::serialize(cursor);
cursor = WriteBytes(cursor, &pod(), sizeof(pod()));
cursor = SerializeVector(cursor, asmJSGlobals);
cursor = SerializePodVector(cursor, asmJSImports);
cursor = SerializePodVector(cursor, asmJSExports);
cursor = SerializeVector(cursor, asmJSFuncNames);
cursor = globalArgumentName.serialize(cursor);
cursor = importArgumentName.serialize(cursor);
cursor = bufferArgumentName.serialize(cursor);
return cursor;
}
const uint8_t* AsmJSMetadata::deserialize(const uint8_t* cursor) {
(cursor = Metadata::deserialize(cursor)) &&
(cursor = ReadBytes(cursor, &pod(), sizeof(pod()))) &&
(cursor = DeserializeVector(cursor, &asmJSGlobals)) &&
(cursor = DeserializePodVector(cursor, &asmJSImports)) &&
(cursor = DeserializePodVector(cursor, &asmJSExports)) &&
(cursor = DeserializeVector(cursor, &asmJSFuncNames)) &&
(cursor = globalArgumentName.deserialize(cursor)) &&
(cursor = importArgumentName.deserialize(cursor)) &&
(cursor = bufferArgumentName.deserialize(cursor));
cacheResult = CacheResult::Hit;
return cursor;
}
size_t AsmJSMetadata::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const {
return Metadata::sizeOfExcludingThis(mallocSizeOf) +
SizeOfVectorExcludingThis(asmJSGlobals, mallocSizeOf) +
asmJSImports.sizeOfExcludingThis(mallocSizeOf) +
asmJSExports.sizeOfExcludingThis(mallocSizeOf) +
SizeOfVectorExcludingThis(asmJSFuncNames, mallocSizeOf) +
globalArgumentName.sizeOfExcludingThis(mallocSizeOf) +
importArgumentName.sizeOfExcludingThis(mallocSizeOf) +
bufferArgumentName.sizeOfExcludingThis(mallocSizeOf);
}
/*****************************************************************************/
// Top-level js::CompileAsmJS

View File

@ -1036,7 +1036,7 @@ void BaseLocalIter::settle() {
case MIRType::Int64:
case MIRType::Double:
case MIRType::Float32:
case MIRType::Pointer:
case MIRType::RefOrNull:
if (argsIter_->argInRegister()) {
frameOffset_ = pushLocal(MIRTypeToSize(mirType_));
} else {
@ -2145,7 +2145,7 @@ struct StackMapGenerator {
}
for (ABIArgIter<const ValTypeVector> i(args); !i.done(); i++) {
if (!i->argInRegister() || i.mirType() != MIRType::Pointer) {
if (!i->argInRegister() || i.mirType() != MIRType::RefOrNull) {
continue;
}
@ -2520,10 +2520,10 @@ class BaseCompiler final : public BaseCompilerInterface {
MIRTypeVector SigPI_;
MIRTypeVector SigPL_;
MIRTypeVector SigPII_;
MIRTypeVector SigPIPI_;
MIRTypeVector SigPIRI_;
MIRTypeVector SigPIII_;
MIRTypeVector SigPIIL_;
MIRTypeVector SigPIIP_;
MIRTypeVector SigPIIR_;
MIRTypeVector SigPILL_;
MIRTypeVector SigPIIII_;
MIRTypeVector SigPIIIII_;
@ -2931,7 +2931,7 @@ class BaseCompiler final : public BaseCompilerInterface {
}
void loadLocalRef(const Stk& src, RegPtr dest) {
fr.loadLocalPtr(localFromSlot(src.slot(), MIRType::Pointer), dest);
fr.loadLocalPtr(localFromSlot(src.slot(), MIRType::RefOrNull), dest);
}
void loadRegisterRef(const Stk& src, RegPtr dest) {
@ -4050,11 +4050,9 @@ class BaseCompiler final : public BaseCompilerInterface {
for (ABIArgIter<const ValTypeVector> i(argTys); !i.done(); i++) {
ABIArg argLoc = *i;
if (argLoc.kind() != ABIArg::Stack) {
continue;
}
const ValType& ty = argTys[i.index()];
if (!ty.isReference()) {
MOZ_ASSERT(ToMIRType(ty) != MIRType::Pointer);
if (argLoc.kind() != ABIArg::Stack || !ty.isReference()) {
continue;
}
uint32_t offset = argLoc.offsetFromArgBase();
@ -4145,7 +4143,7 @@ class BaseCompiler final : public BaseCompilerInterface {
case MIRType::Int64:
fr.storeLocalI64(RegI64(i->gpr64()), l);
break;
case MIRType::Pointer: {
case MIRType::RefOrNull: {
uint32_t offs = fr.localOffset(l);
MOZ_ASSERT(0 == (offs % sizeof(void*)));
fr.storeLocalPtr(RegPtr(i->gpr()), l);
@ -4550,7 +4548,7 @@ class BaseCompiler final : public BaseCompilerInterface {
}
case ValType::Ref:
case ValType::AnyRef: {
ABIArg argLoc = call->abi.next(MIRType::Pointer);
ABIArg argLoc = call->abi.next(MIRType::RefOrNull);
if (argLoc.kind() == ABIArg::Stack) {
ScratchPtr scratch(*this);
loadRef(arg, scratch);
@ -9057,7 +9055,7 @@ bool BaseCompiler::emitSetOrTeeLocal(uint32_t slot) {
case ValType::AnyRef: {
RegPtr rv = popRef();
syncLocal(slot);
fr.storeLocalPtr(rv, localFromSlot(slot, MIRType::Pointer));
fr.storeLocalPtr(rv, localFromSlot(slot, MIRType::RefOrNull));
if (isSetLocal) {
freeRef(rv);
} else {
@ -9762,7 +9760,7 @@ bool BaseCompiler::emitInstanceCall(uint32_t lineOrBytecode,
case MIRType::Int64:
t = ValType::I64;
break;
case MIRType::Pointer:
case MIRType::RefOrNull:
t = ValType::AnyRef;
break;
default:
@ -10367,7 +10365,7 @@ bool BaseCompiler::emitTableGrow() {
//
// infallible.
pushI32(tableIndex);
return emitInstanceCall(lineOrBytecode, SigPIPI_, ExprType::I32,
return emitInstanceCall(lineOrBytecode, SigPIRI_, ExprType::I32,
SymbolicAddress::TableGrow);
}
@ -10386,7 +10384,7 @@ bool BaseCompiler::emitTableSet() {
//
// Returns -1 on range error, otherwise 0 (which is then ignored).
pushI32(tableIndex);
if (!emitInstanceCall(lineOrBytecode, SigPIPI_, ExprType::Void,
if (!emitInstanceCall(lineOrBytecode, SigPIRI_, ExprType::Void,
SymbolicAddress::TableSet)) {
return false;
}
@ -10770,7 +10768,7 @@ bool BaseCompiler::emitStructNarrow() {
pushI32(mustUnboxAnyref);
pushI32(outputStruct.moduleIndex_);
pushRef(rp);
return emitInstanceCall(lineOrBytecode, SigPIIP_, ExprType::AnyRef,
return emitInstanceCall(lineOrBytecode, SigPIIR_, ExprType::AnyRef,
SymbolicAddress::StructNarrow);
}
@ -11861,8 +11859,9 @@ bool BaseCompiler::init() {
!SigPII_.append(MIRType::Int32)) {
return false;
}
if (!SigPIPI_.append(MIRType::Pointer) || !SigPIPI_.append(MIRType::Int32) ||
!SigPIPI_.append(MIRType::Pointer) || !SigPIPI_.append(MIRType::Int32)) {
if (!SigPIRI_.append(MIRType::Pointer) || !SigPIRI_.append(MIRType::Int32) ||
!SigPIRI_.append(MIRType::RefOrNull) ||
!SigPIRI_.append(MIRType::Int32)) {
return false;
}
if (!SigPIII_.append(MIRType::Pointer) || !SigPIII_.append(MIRType::Int32) ||
@ -11873,8 +11872,9 @@ bool BaseCompiler::init() {
!SigPIIL_.append(MIRType::Int32) || !SigPIIL_.append(MIRType::Int64)) {
return false;
}
if (!SigPIIP_.append(MIRType::Pointer) || !SigPIIP_.append(MIRType::Int32) ||
!SigPIIP_.append(MIRType::Int32) || !SigPIIP_.append(MIRType::Pointer)) {
if (!SigPIIR_.append(MIRType::Pointer) || !SigPIIR_.append(MIRType::Int32) ||
!SigPIIR_.append(MIRType::Int32) ||
!SigPIIR_.append(MIRType::RefOrNull)) {
return false;
}
if (!SigPILL_.append(MIRType::Pointer) || !SigPILL_.append(MIRType::Int32) ||

View File

@ -392,7 +392,7 @@ struct Metadata : public ShareableBase<Metadata>, public MetadataCacheablePod {
return getFuncName(NameContext::BeforeLocation, funcIndex, name);
}
WASM_DECLARE_SERIALIZABLE_VIRTUAL(Metadata);
WASM_DECLARE_SERIALIZABLE(Metadata);
};
typedef RefPtr<Metadata> MutableMetadata;

View File

@ -196,7 +196,7 @@ static void SetupABIArguments(MacroAssembler& masm, const FuncExport& fe,
masm.load32(src, iter->gpr());
} else if (type == MIRType::Int64) {
masm.load64(src, iter->gpr64());
} else if (type == MIRType::Pointer) {
} else if (type == MIRType::RefOrNull) {
masm.loadPtr(src, iter->gpr());
} else {
MOZ_CRASH("unknown GPR type");
@ -250,7 +250,7 @@ static void SetupABIArguments(MacroAssembler& masm, const FuncExport& fe,
#endif
break;
}
case MIRType::Pointer:
case MIRType::RefOrNull:
masm.loadPtr(src, scratch);
masm.storePtr(scratch, Address(masm.getStackPointer(),
iter->offsetFromArgBase()));
@ -1172,7 +1172,7 @@ static void StackCopy(MacroAssembler& masm, MIRType type, Register scratch,
GenPrintIsize(DebugChannel::Import, masm, scratch);
masm.store64(scratch64, dst);
#endif
} else if (type == MIRType::Pointer) {
} else if (type == MIRType::RefOrNull) {
masm.loadPtr(src, scratch);
GenPrintPtr(DebugChannel::Import, masm, scratch);
masm.storePtr(scratch, dst);
@ -1181,12 +1181,13 @@ static void StackCopy(MacroAssembler& masm, MIRType type, Register scratch,
masm.loadFloat32(src, fpscratch);
GenPrintF32(DebugChannel::Import, masm, fpscratch);
masm.storeFloat32(fpscratch, dst);
} else {
MOZ_ASSERT(type == MIRType::Double);
} else if (type == MIRType::Double) {
ScratchDoubleScope fpscratch(masm);
masm.loadDouble(src, fpscratch);
GenPrintF64(DebugChannel::Import, masm, fpscratch);
masm.storeDouble(fpscratch, dst);
} else {
MOZ_CRASH("StackCopy: unexpected type");
}
}
@ -1219,12 +1220,14 @@ static void FillArgumentArray(MacroAssembler& masm, unsigned funcImportIndex,
GenPrintI64(DebugChannel::Import, masm, i->gpr64());
masm.store64(i->gpr64(), dst);
}
} else if (type == MIRType::Pointer) {
} else if (type == MIRType::RefOrNull) {
if (toValue) {
MOZ_CRASH("generating a jit exit for anyref NYI");
}
GenPrintPtr(DebugChannel::Import, masm, i->gpr());
masm.storePtr(i->gpr(), dst);
} else {
MOZ_CRASH("FillArgumentArray, ABIArg::GPR: unexpected type");
}
break;
#ifdef JS_CODEGEN_REGISTER_PAIR
@ -1280,10 +1283,9 @@ static void FillArgumentArray(MacroAssembler& masm, unsigned funcImportIndex,
} else if (type == MIRType::Int64) {
// We can't box int64 into Values (yet).
masm.breakpoint();
} else if (type == MIRType::Pointer) {
} else if (type == MIRType::RefOrNull) {
MOZ_CRASH("generating a jit exit for anyref NYI");
} else {
MOZ_ASSERT(IsFloatingPointType(type));
} else if (IsFloatingPointType(type)) {
ScratchDoubleScope dscratch(masm);
FloatRegister fscratch = dscratch.asSingle();
if (type == MIRType::Float32) {
@ -1295,6 +1297,8 @@ static void FillArgumentArray(MacroAssembler& masm, unsigned funcImportIndex,
masm.canonicalizeDouble(dscratch);
GenPrintF64(DebugChannel::Import, masm, dscratch);
masm.storeDouble(dscratch, dst);
} else {
MOZ_CRASH("FillArgumentArray, ABIArg::Stack: unexpected type");
}
} else {
StackCopy(masm, type, scratch, src, dst);

View File

@ -687,7 +687,7 @@ bool DebugFrame::getLocal(uint32_t localIndex, MutableHandleValue vp) {
case jit::MIRType::Double:
vp.set(NumberValue(JS::CanonicalizeNaN(*static_cast<double*>(dataPtr))));
break;
case jit::MIRType::Pointer:
case jit::MIRType::RefOrNull:
vp.set(ObjectOrNullValue(*(JSObject**)dataPtr));
break;
default:

View File

@ -138,18 +138,6 @@ typedef Vector<UniqueChars, 0, SystemAllocPolicy> UniqueCharsVector;
const uint8_t* deserialize(const uint8_t* cursor); \
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
#define WASM_DECLARE_SERIALIZABLE_VIRTUAL(Type) \
virtual size_t serializedSize() const; \
virtual uint8_t* serialize(uint8_t* cursor) const; \
virtual const uint8_t* deserialize(const uint8_t* cursor); \
virtual size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
#define WASM_DECLARE_SERIALIZABLE_OVERRIDE(Type) \
size_t serializedSize() const override; \
uint8_t* serialize(uint8_t* cursor) const override; \
const uint8_t* deserialize(const uint8_t* cursor) override; \
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const override;
template <class T>
struct SerializableRefPtr : RefPtr<T> {
using RefPtr<T>::operator=;
@ -472,11 +460,9 @@ static inline jit::MIRType ToMIRType(ValType vt) {
case ValType::F64:
return jit::MIRType::Double;
case ValType::Ref:
return jit::MIRType::Pointer;
case ValType::AnyRef:
return jit::MIRType::Pointer;
case ValType::NullRef:
return jit::MIRType::Pointer;
return jit::MIRType::RefOrNull;
}
MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("bad type");
}

View File

@ -345,15 +345,13 @@ void ScrollAnchorContainer::ApplyAdjustments() {
break;
}
}
nsIntPoint physicalDevicePixels = physicalAdjustment.ToNearestPixels(
Frame()->PresContext()->AppUnitsPerDevPixel());
MOZ_ASSERT(!mApplyingAnchorAdjustment);
// We should use AutoRestore here, but that doesn't work with bitfields
mApplyingAnchorAdjustment = true;
mScrollFrame->ScrollBy(
physicalDevicePixels, nsIScrollableFrame::DEVICE_PIXELS,
nsIScrollableFrame::INSTANT, nullptr, nsGkAtoms::relative);
mScrollFrame->ScrollTo(
mScrollFrame->GetScrollPosition() + physicalAdjustment,
nsIScrollableFrame::INSTANT, nsGkAtoms::relative);
mApplyingAnchorAdjustment = false;
nsPresContext* pc = Frame()->PresContext();