Merge inbound to mozilla-central. a=merge

This commit is contained in:
Cosmin Sabou 2018-05-27 15:58:59 +03:00
commit 5a74471337
192 changed files with 2700 additions and 2478 deletions

View File

@ -43,6 +43,12 @@ async function createXULExtension(details) {
await AddonTestUtils.manuallyInstall(xpi);
}
function promiseEvent(eventEmitter, event) {
return new Promise(resolve => {
eventEmitter.once(event, resolve);
});
}
let cleanup;
add_task(async function() {
@ -181,6 +187,7 @@ add_task(async function() {
// This time accept the install.
panel.button.click();
await promiseEvent(ExtensionsUI, "sideload-response");
[addon1, addon2, addon3, addon4] = await AddonManager.getAddonsByIDs([ID1, ID2, ID3, ID4]);
is(addon1.userDisabled, true, "Addon 1 should still be disabled");
@ -220,6 +227,7 @@ add_task(async function() {
// Accept the permissions
panel.button.click();
await promiseEvent(ExtensionsUI, "change");
addon3 = await AddonManager.getAddonByID(ID3);
is(addon3.userDisabled, false, "Addon 3 should be enabled");
@ -245,6 +253,7 @@ add_task(async function() {
// Accept the permissions
panel.button.click();
await promiseEvent(ExtensionsUI, "change");
addon4 = await AddonManager.getAddonByID(ID4);
is(addon4.userDisabled, false, "Addon 4 should be enabled");
@ -257,7 +266,7 @@ add_task(async function() {
await new Promise(resolve => setTimeout(resolve, 100));
for (let addon of [addon1, addon2, addon3, addon4]) {
addon.uninstall();
await addon.uninstall();
}
BrowserTestUtils.removeTab(gBrowser.selectedTab);

View File

@ -48,7 +48,7 @@ async function testUpdateNoPrompt(filename, id,
PopupNotifications.panel.removeEventListener("popupshown", popupListener);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
addon.uninstall();
await addon.uninstall();
}
// Test that we don't see a prompt when updating from a legacy

View File

@ -352,7 +352,7 @@ async function testInstallMethod(installFn, telemetryBase) {
} else {
ok(result, "Installation completed");
isnot(addon, null, "Extension is installed");
addon.uninstall();
await addon.uninstall();
}
BrowserTestUtils.removeTab(tab);

View File

@ -218,7 +218,6 @@ class ExtensionControlledPopup {
// Setup the command handler.
let handleCommand = async (event) => {
panel.hidePopup();
if (event.originalTarget.getAttribute("anonid") == "button") {
// Main action is to keep changes.
await this.setConfirmation(extensionId);
@ -227,7 +226,7 @@ class ExtensionControlledPopup {
if (this.beforeDisableAddon) {
await this.beforeDisableAddon(this, win);
}
addon.userDisabled = true;
await addon.disable();
}
// If the page this is appearing on is the New Tab page then the URL bar may

View File

@ -238,7 +238,7 @@ add_task(async function test_disable() {
let disabledPromise = awaitEvent("shutdown", ID);
prefPromise = promisePrefChangeObserved(HOMEPAGE_URL_PREF);
addon.userDisabled = true;
await addon.disable();
await Promise.all([disabledPromise, prefPromise]);
is(getHomePageURL(), defaultHomePage,
@ -246,7 +246,7 @@ add_task(async function test_disable() {
let enabledPromise = awaitEvent("ready", ID);
prefPromise = promisePrefChangeObserved(HOMEPAGE_URL_PREF);
addon.userDisabled = false;
await addon.enable();
await Promise.all([enabledPromise, prefPromise]);
is(getHomePageURL(), HOME_URI_1,

View File

@ -17,7 +17,7 @@ function enableAddon(addon) {
}
},
});
addon.userDisabled = false;
addon.enable();
});
}
@ -31,7 +31,7 @@ function disableAddon(addon) {
}
},
});
addon.userDisabled = true;
addon.disable();
});
}

View File

@ -194,13 +194,13 @@ add_task(async function test_user_change_with_disabling() {
let disabledPromise = awaitEvent("shutdown", EXTENSION1_ID);
let addon = await AddonManager.getAddonByID(EXTENSION1_ID);
addon.userDisabled = true;
await addon.disable();
await disabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
let enabledPromise = awaitEvent("ready", EXTENSION1_ID);
addon.userDisabled = false;
await addon.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
@ -254,7 +254,7 @@ add_task(async function test_two_addons_with_first_disabled_before_second() {
let disabledPromise = awaitEvent("shutdown", EXTENSION1_ID);
let addon1 = await AddonManager.getAddonByID(EXTENSION1_ID);
addon1.userDisabled = true;
await addon1.disable();
await disabledPromise;
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
@ -264,7 +264,7 @@ add_task(async function test_two_addons_with_first_disabled_before_second() {
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
let enabledPromise = awaitEvent("ready", EXTENSION1_ID);
addon1.userDisabled = false;
await addon1.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
@ -326,13 +326,13 @@ add_task(async function test_two_addons_with_first_disabled() {
let disabledPromise = awaitEvent("shutdown", EXTENSION1_ID);
let addon1 = await AddonManager.getAddonByID(EXTENSION1_ID);
addon1.userDisabled = true;
await addon1.disable();
await disabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
let enabledPromise = awaitEvent("ready", EXTENSION1_ID);
addon1.userDisabled = false;
await addon1.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
@ -394,13 +394,13 @@ add_task(async function test_two_addons_with_second_disabled() {
let disabledPromise = awaitEvent("shutdown", EXTENSION2_ID);
let addon2 = await AddonManager.getAddonByID(EXTENSION2_ID);
addon2.userDisabled = true;
await addon2.disable();
await disabledPromise;
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
let enabledPromise = awaitEvent("ready", EXTENSION2_ID);
addon2.userDisabled = false;
await addon2.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");

View File

@ -113,6 +113,7 @@ add_task(function test_doorhanger_disable() {
document.getAnonymousElementByAttribute(
popupnotification, "anonid", "secondarybutton").click();
await popupHidden;
await new Promise(executeSoon);
is(gBrowser.visibleTabs.length, 3, "There are 3 visible tabs again");
is(addon.userDisabled, true, "The extension is now disabled");

View File

@ -17,7 +17,7 @@ async function updateExtension(ID, options) {
async function disableExtension(ID) {
let disabledPromise = awaitEvent("shutdown", ID);
let addon = await AddonManager.getAddonByID(ID);
addon.userDisabled = true;
await addon.disable();
await disabledPromise;
}

View File

@ -350,7 +350,7 @@ add_task(async function test_new_tab_restore_settings() {
};
AddonManager.addAddonListener(listener);
});
addon.userDisabled = false;
await addon.enable();
BrowserTestUtils.removeTab(gBrowser.selectedTab);
await addonEnabled;
await extension.unload();
@ -468,8 +468,8 @@ add_task(async function test_new_tab_restore_settings_multiple() {
// ExtensionSettingsStore for now. See bug 1408226.
let addonsEnabled = Promise.all([
waitForAddonEnabled(addonOne), waitForAddonEnabled(addonTwo)]);
addonOne.userDisabled = false;
addonTwo.userDisabled = false;
await addonOne.enable();
await addonTwo.enable();
await addonsEnabled;
await extensionOne.unload();
await extensionTwo.unload();

View File

@ -125,7 +125,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
// Disable the second extension.
let addon = await AddonManager.getAddonByID(EXT_2_ID);
let disabledPromise = awaitEvent("shutdown");
addon.userDisabled = true;
await addon.disable();
await disabledPromise;
equal(aboutNewTabService.newTabURL, DEFAULT_NEW_TAB_URL,
"newTabURL url is reset to the default after second extension is disabled.");
@ -133,7 +133,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
// Re-enable the second extension.
let enabledPromise = awaitEvent("ready");
addon.userDisabled = false;
await addon.enable();
await enabledPromise;
ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_2),
"newTabURL is overridden by the second extension.");
@ -151,7 +151,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
// Disable the second extension.
disabledPromise = awaitEvent("shutdown");
addon.userDisabled = true;
await addon.disable();
await disabledPromise;
ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3),
"newTabURL is still overridden by the third extension.");
@ -159,7 +159,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() {
// Re-enable the second extension.
enabledPromise = awaitEvent("ready");
addon.userDisabled = false;
await addon.enable();
await enabledPromise;
ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3),
"newTabURL is still overridden by the third extension.");

View File

@ -242,7 +242,7 @@ function makeDisableControllingExtension(type, settingName) {
return async function disableExtension() {
let {id} = await getControllingExtensionInfo(type, settingName);
let addon = await AddonManager.getAddonByID(id);
addon.userDisabled = true;
await addon.disable();
};
}

View File

@ -101,8 +101,9 @@ add_task(async function testExtensionControlledHomepage() {
is(controlledContent.hidden, true, "The extension controlled row is hidden");
// Install an extension that will set the homepage.
let promise = waitForMessageShown("browserHomePageExtensionContent");
await installAddon("set_homepage.xpi");
await waitForMessageShown("browserHomePageExtensionContent");
await promise;
// The homepage has been set by the extension, the user is notified and it isn't editable.
let controlledLabel = controlledContent.querySelector("description");
@ -141,10 +142,11 @@ add_task(async function testExtensionControlledHomepage() {
// Enable the extension so we get the UNINSTALL event, which is needed by
// ExtensionPreferencesManager to clean up properly.
// FIXME: See https://bugzilla.mozilla.org/show_bug.cgi?id=1408226.
addon.userDisabled = false;
await waitForMessageShown("browserHomePageExtensionContent");
promise = waitForMessageShown("browserHomePageExtensionContent");
await addon.enable();
await promise;
// Do the uninstall now that the enable code has been run.
addon.uninstall();
await addon.uninstall();
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
@ -203,8 +205,9 @@ add_task(async function testPrefLockedHomepage() {
ok(originalHomepage != extensionHomepage, "The extension will change the homepage");
// Install an extension that sets the homepage to MDN.
let promise = waitForMessageShown(controlledContent.id);
await installAddon("set_homepage.xpi");
await waitForMessageShown(controlledContent.id);
await promise;
// Check that everything is still disabled, homepage didn't change.
is(getHomepage(), extensionHomepage, "The reported homepage is set by the extension");
@ -249,8 +252,9 @@ add_task(async function testPrefLockedHomepage() {
// Uninstall the add-on.
let addon = await AddonManager.getAddonByID("@set_homepage");
addon.uninstall();
await waitForEnableMessage(controlledContent.id);
promise = waitForEnableMessage(controlledContent.id);
await addon.uninstall();
await promise;
// Check that everything is now enabled again.
is(getHomepage(), originalHomepage, "The reported homepage is reset to original value");
@ -306,9 +310,9 @@ add_task(async function testExtensionControlledNewTab() {
is(controlledContent.hidden, true, "The extension controlled row is hidden");
// Install an extension that will set the new tab page.
let promise = waitForMessageShown("browserNewTabExtensionContent");
await installAddon("set_newtab.xpi");
await waitForMessageShown("browserNewTabExtensionContent");
await promise;
// The new tab page has been set by the extension and the user is notified.
let controlledLabel = controlledContent.querySelector("description");
@ -343,7 +347,7 @@ add_task(async function testExtensionControlledNewTab() {
// Cleanup the tab and add-on.
BrowserTestUtils.removeTab(gBrowser.selectedTab);
let addon = await AddonManager.getAddonByID("@set_newtab");
addon.uninstall();
await addon.uninstall();
});
add_task(async function testExtensionControlledDefaultSearch() {
@ -586,7 +590,7 @@ add_task(async function testExtensionControlledTrackingProtection() {
async function reEnableExtension(addon) {
let controlledMessageShown = waitForMessageShown(CONTROLLED_LABEL_ID[uiType]);
addon.userDisabled = false;
await addon.enable();
await controlledMessageShown;
}
@ -757,7 +761,7 @@ add_task(async function testExtensionControlledProxyConfig() {
async function reEnableExtension(addon) {
let messageChanged = connectionSettingsMessagePromise(mainDoc, true);
addon.userDisabled = false;
await addon.enable();
await messageChanged;
}

View File

@ -53,7 +53,6 @@ var ExtensionsUI = {
await Services.wm.getMostRecentWindow("navigator:browser").delayedStartupPromise;
this._checkForSideloaded();
this._checkNewDistroAddons();
},
async _checkForSideloaded() {
@ -95,60 +94,6 @@ var ExtensionsUI = {
}
},
async _checkNewDistroAddons() {
let newDistroAddons = AddonManagerPrivate.getNewDistroAddons();
if (!newDistroAddons) {
return;
}
for (let id of newDistroAddons) {
let addon = await AddonManager.getAddonByID(id);
let win = Services.wm.getMostRecentWindow("navigator:browser");
if (!win) {
return;
}
let {gBrowser} = win;
let browser = gBrowser.selectedBrowser;
// The common case here is that we enter this code right after startup
// in a brand new profile so we haven't yet loaded a page. That state is
// surprisingly difficult to detect but wait until we've actually loaded
// a page.
if (browser.currentURI.spec == "about:blank" ||
browser.webProgress.isLoadingDocument) {
await new Promise(resolve => {
let listener = {
onLocationChange(browser_, webProgress, ...ignored) {
if (webProgress.isTopLevel && browser_ == browser) {
gBrowser.removeTabsProgressListener(listener);
resolve();
}
},
};
gBrowser.addTabsProgressListener(listener);
});
}
// If we're at about:newtab and the url bar gets focus, that will
// prevent a doorhanger from displaying.
// Our elegant solution is to ... take focus away from the url bar.
win.gURLBar.blur();
let strings = this._buildStrings({
addon,
permissions: addon.userPermissions,
});
let accepted = await this.showPermissionsPrompt(browser, strings,
addon.iconURL);
if (accepted) {
addon.userDisabled = false;
}
}
},
_updateNotifications() {
if (this.sideloaded.size + this.updates.size == 0) {
AppMenuNotifications.removeNotification("addon-alert");
@ -177,8 +122,11 @@ var ExtensionsUI = {
type: "sideload",
});
this.showAddonsManager(browser, strings, addon.iconURL, "sideload")
.then(answer => {
addon.userDisabled = !answer;
.then(async answer => {
if (answer) {
await addon.enable();
}
this.emit("sideload-response");
});
},

View File

@ -22,7 +22,7 @@ async function install(data, reason) {
let addon = await AddonManager.getAddonByID(data.id);
if (addon) {
addon.userDisabled = false;
await addon.enable();
}
}

View File

@ -130,5 +130,15 @@ def NoVisibilityFlags():
def AllowCompilerWarnings():
COMPILE_FLAGS['WARNINGS_AS_ERRORS'] = []
@template
def ForceInclude(*headers):
"""Force includes a set of header files in C++ compilations"""
if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
include_flag = '-FI'
else:
include_flag = '-include'
for header in headers:
CXXFLAGS += [include_flag, header]
include('gecko_templates.mozbuild')
include('test_templates.mozbuild')

View File

@ -79,7 +79,7 @@ Addon.prototype = {
}
this.status = "preparing";
if (addon && addon.userDisabled) {
addon.userDisabled = false;
await addon.enable();
} else {
let install = await AddonManager.getInstallForURL(this.xpiLink, "application/x-xpinstall");
install.addListener(this);
@ -114,7 +114,7 @@ Addon.prototype = {
},
onInstallEnded: function({addon}) {
addon.userDisabled = false;
addon.enable();
},
onDownloadCancelled: function(install) {

View File

@ -251,7 +251,7 @@ var items = [
exec: function(args, context) {
let name = (args.addon.name + " " + args.addon.version).trim();
if (args.addon.userDisabled) {
args.addon.userDisabled = false;
args.addon.enable();
return l10n.lookupFormat("addonEnabled", [ name ]);
}
@ -277,7 +277,7 @@ var items = [
let name = (args.addon.name + " " + args.addon.version).trim();
if (!args.addon.userDisabled ||
args.addon.userDisabled === AddonManager.STATE_ASK_TO_ACTIVATE) {
args.addon.userDisabled = true;
args.addon.disable();
return l10n.lookupFormat("addonDisabled", [ name ]);
}

View File

@ -2436,14 +2436,10 @@ struct SelectorMatchInfo {
};
} // namespace
// Given an id, find elements with that id under aRoot that match aMatchInfo if
// any is provided. If no SelectorMatchInfo is provided, just find the ones
// with the given id. aRoot must be in the document.
template<bool onlyFirstMatch, class T>
inline static void
FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
SelectorMatchInfo* aMatchInfo,
T& aList)
// Given an id, find first element with that id under aRoot.
// If none found, return nullptr. aRoot must be in the document.
inline static Element*
FindMatchingElementWithId(const nsAString& aId, nsINode* aRoot)
{
MOZ_ASSERT(aRoot->IsInUncomposedDoc(),
"Don't call me if the root is not in the document");
@ -2457,7 +2453,7 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
const nsTArray<Element*>* elements = aRoot->OwnerDoc()->GetAllElementsForId(aId);
if (!elements) {
// Nothing to do; we're done
return;
return nullptr;
}
// XXXbz: Should we fall back to the tree walk if aRoot is not the
@ -2468,32 +2464,13 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
(element != aRoot &&
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
// We have an element with the right id and it's a strict descendant
// of aRoot. Make sure it really matches the selector.
if (!aMatchInfo
) {
aList.AppendElement(element);
if (onlyFirstMatch) {
return;
}
}
// of aRoot.
return element;
}
}
return nullptr;
}
struct ElementHolder {
ElementHolder() : mElement(nullptr) {}
void AppendElement(Element* aElement) {
MOZ_ASSERT(!mElement, "Should only get one element");
mElement = aElement;
}
void SetCapacity(uint32_t aCapacity) { MOZ_CRASH("Don't call me!"); }
uint32_t Length() { return 0; }
Element* ElementAt(uint32_t aIndex) { return nullptr; }
Element* mElement;
};
Element*
nsINode::QuerySelector(const nsAString& aSelector, ErrorResult& aResult)
{
@ -2526,9 +2503,7 @@ nsINode::GetElementById(const nsAString& aId)
MOZ_ASSERT(IsElement() || IsDocumentFragment(),
"Bogus this object for GetElementById call");
if (IsInUncomposedDoc()) {
ElementHolder holder;
FindMatchingElementsWithId<true>(aId, this, nullptr, holder);
return holder.mElement;
return FindMatchingElementWithId(aId, this);
}
for (nsIContent* kid = GetFirstChild(); kid; kid = kid->GetNextNode(this)) {

View File

@ -1188,9 +1188,9 @@ CompareIdsAtIndices(const void* aElement1, const void* aElement2, void* aClosure
const uint16_t index2 = *static_cast<const uint16_t*>(aElement2);
const PropertyInfo* infos = static_cast<PropertyInfo*>(aClosure);
MOZ_ASSERT(JSID_BITS(infos[index1].id) != JSID_BITS(infos[index2].id));
MOZ_ASSERT(JSID_BITS(infos[index1].Id()) != JSID_BITS(infos[index2].Id()));
return JSID_BITS(infos[index1].id) < JSID_BITS(infos[index2].id) ? -1 : 1;
return JSID_BITS(infos[index1].Id()) < JSID_BITS(infos[index2].Id()) ? -1 : 1;
}
template <typename SpecT>
@ -1212,9 +1212,11 @@ InitIdsInternal(JSContext* cx, const Prefable<SpecT>* pref, PropertyInfo* infos,
// in the "specs" array of the relevant Prefable.
uint32_t specIndex = 0;
do {
if (!JS::PropertySpecNameToPermanentId(cx, spec->name, &infos->id)) {
jsid id;
if (!JS::PropertySpecNameToPermanentId(cx, spec->name, &id)) {
return false;
}
infos->SetId(id);
infos->type = type;
infos->prefIndex = prefIndex;
infos->specIndex = specIndex++;
@ -1427,10 +1429,10 @@ struct IdToIndexComparator
explicit IdToIndexComparator(const jsid& aId, const PropertyInfo* aInfos) :
mId(aId), mInfos(aInfos) {}
int operator()(const uint16_t aIndex) const {
if (JSID_BITS(mId) == JSID_BITS(mInfos[aIndex].id)) {
if (JSID_BITS(mId) == JSID_BITS(mInfos[aIndex].Id())) {
return 0;
}
return JSID_BITS(mId) < JSID_BITS(mInfos[aIndex].id) ? -1 : 1;
return JSID_BITS(mId) < JSID_BITS(mInfos[aIndex].Id()) ? -1 : 1;
}
};
@ -1886,7 +1888,7 @@ XrayAppendPropertyKeys(JSContext* cx, JS::Handle<JSObject*> obj,
if (prefIsEnabled) {
const SpecType* spec = pref->specs;
do {
const jsid& id = infos++->id;
const jsid id = infos++->Id();
if (((flags & JSITER_HIDDEN) ||
(spec->flags & JSPROP_ENUMERATE)) &&
((flags & JSITER_SYMBOLS) || !JSID_IS_SYMBOL(id)) &&
@ -1922,7 +1924,7 @@ XrayAppendPropertyKeys<ConstantSpec>(JSContext* cx, JS::Handle<JSObject*> obj,
if (prefIsEnabled) {
const ConstantSpec* spec = pref->specs;
do {
if (!props.append(infos++->id)) {
if (!props.append(infos++->Id())) {
return false;
}
} while ((++spec)->name);

View File

@ -186,7 +186,11 @@ enum PropertyType {
#define NUM_BITS_PROPERTY_INFO_SPEC_INDEX 16
struct PropertyInfo {
jsid id;
private:
// MSVC generates static initializers if we store a jsid here, even if
// PropertyInfo has a constexpr constructor. See bug 1460341 and bug 1464036.
uintptr_t mIdBits;
public:
// One of PropertyType, will be used for accessing the corresponding Duo in
// NativePropertiesN.duos[].
uint32_t type: NUM_BITS_PROPERTY_INFO_TYPE;
@ -195,9 +199,13 @@ struct PropertyInfo {
// The index to the corresponding spec in Duo.mPrefables[prefIndex].specs[].
uint32_t specIndex: NUM_BITS_PROPERTY_INFO_SPEC_INDEX;
// Note: the default constructor is not constexpr because of the bit fields,
// so we need this one.
constexpr PropertyInfo() : id(), type(0), prefIndex(0), specIndex(0) {}
void SetId(jsid aId) {
static_assert(sizeof(jsid) == sizeof(mIdBits), "jsid should fit in mIdBits");
mIdBits = JSID_BITS(aId);
}
MOZ_ALWAYS_INLINE jsid Id() const {
return jsid::fromRawBits(mIdBits);
}
};
static_assert(ePropertyTypeCount <= 1ull << NUM_BITS_PROPERTY_INFO_TYPE,

View File

@ -963,7 +963,17 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
NS_ENSURE_TRUE(xblScope, NS_ERROR_UNEXPECTED);
JS::Rooted<JSObject*> parent_proto(cx);
if (!JS_GetPrototype(cx, obj, &parent_proto)) {
{
JS::RootedObject wrapped(cx, obj);
JSAutoRealm ar(cx, xblScope);
if (!JS_WrapObject(cx, &wrapped)) {
return NS_ERROR_FAILURE;
}
if (!JS_GetPrototype(cx, wrapped, &parent_proto)) {
return NS_ERROR_FAILURE;
}
}
if (!JS_WrapObject(cx, &parent_proto)) {
return NS_ERROR_FAILURE;
}

View File

@ -0,0 +1,9 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
@template
def HunspellIncludes():
ForceInclude('hunspell_alloc_hooks.h', 'hunspell_fopen_hooks.h')

View File

@ -39,9 +39,6 @@
* reporting to hunspell without modifying its code, in order to ease future
* upgrades.
*
* This file is force-included through mozilla-config.h which is generated
* during the configure step.
*
* Currently, the memory allocated using operator new/new[] is not being
* tracked, but that's OK, since almost all of the memory used by Hunspell is
* allocated using C memory allocation functions.

View File

@ -9,9 +9,6 @@
* This file is force-included in hunspell code. Its purpose is to add
* readahead to fopen() calls in hunspell without modifying its code, in order
* to ease future upgrades.
*
* This file is force-included through mozilla-config.h which is generated
* during the configure step.
*/
#include "mozilla/FileUtils.h"

View File

@ -20,6 +20,9 @@ LOCAL_INCLUDES += [
]
include('/ipc/chromium/chromium-config.mozbuild')
include('common.mozbuild')
HunspellIncludes()
IPDL_SOURCES = [
'PRemoteSpellcheckEngine.ipdl',
@ -29,7 +32,3 @@ EXPORTS.mozilla += [
'RemoteSpellCheckEngineChild.h',
'RemoteSpellCheckEngineParent.h',
]
# This variable is referenced in mozilla-config.h.in. Make sure to change
# that file too if you need to change this variable.
DEFINES['HUNSPELL_STATIC'] = True

View File

@ -64,13 +64,10 @@
#include "nsISimpleEnumerator.h"
#include "nsIDirectoryEnumerator.h"
#include "nsIFile.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "mozISpellI18NManager.h"
#include "nsUnicharUtils.h"
#include "nsCRT.h"
#include "mozInlineSpellChecker.h"
#include "mozilla/Services.h"
#include <stdlib.h>
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
@ -298,11 +295,6 @@ mozHunspell::LoadDictionaryList(bool aNotifyChildProcesses)
nsresult rv;
nsCOMPtr<nsIProperties> dirSvc =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
if (!dirSvc)
return;
// find built in dictionaries, or dictionaries specified in
// spellchecker.dictionary_path in prefs
nsCOMPtr<nsIFile> dictDir;
@ -316,33 +308,8 @@ mozHunspell::LoadDictionaryList(bool aNotifyChildProcesses)
// set the spellchecker.dictionary_path
rv = NS_NewNativeLocalFile(extDictPath, true, getter_AddRefs(dictDir));
}
}
if (!dictDir) {
// spellcheck.dictionary_path not found, set internal path
rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY,
NS_GET_IID(nsIFile), getter_AddRefs(dictDir));
}
if (dictDir) {
LoadDictionariesFromDir(dictDir);
}
else {
// try to load gredir/dictionaries
nsCOMPtr<nsIFile> greDir;
rv = dirSvc->Get(NS_GRE_DIR,
NS_GET_IID(nsIFile), getter_AddRefs(greDir));
if (NS_SUCCEEDED(rv)) {
greDir->AppendNative(NS_LITERAL_CSTRING("dictionaries"));
LoadDictionariesFromDir(greDir);
}
// try to load appdir/dictionaries only if different than gredir
nsCOMPtr<nsIFile> appDir;
rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GET_IID(nsIFile), getter_AddRefs(appDir));
bool equals;
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(appDir->Equals(greDir, &equals)) && !equals) {
appDir->AppendNative(NS_LITERAL_CSTRING("dictionaries"));
LoadDictionariesFromDir(appDir);
if (dictDir) {
LoadDictionariesFromDir(dictDir);
}
}
@ -644,15 +611,17 @@ NS_IMETHODIMP mozHunspell::AddDictionary(const nsAString& aLang, nsIURI *aFile)
return NS_OK;
}
NS_IMETHODIMP mozHunspell::RemoveDictionary(const nsAString& aLang, nsIURI *aFile)
NS_IMETHODIMP mozHunspell::RemoveDictionary(const nsAString& aLang, nsIURI *aFile, bool* aRetVal)
{
NS_ENSURE_TRUE(aFile, NS_ERROR_INVALID_ARG);
*aRetVal = false;
nsCOMPtr<nsIURI> file = mDynamicDictionaries.Get(aLang);
bool equal;
if (file && NS_SUCCEEDED(file->Equals(aFile, &equal)) && equal) {
mDynamicDictionaries.Remove(aLang);
LoadDictionaryList(true);
*aRetVal = true;
}
return NS_OK;
}

View File

@ -15,10 +15,6 @@ UNIFIED_SOURCES += [
'suggestmgr.cxx',
]
# This variable is referenced in mozilla-config.h.in. Make sure to change
# that file too if you need to change this variable.
DEFINES['HUNSPELL_STATIC'] = True
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
@ -29,6 +25,9 @@ LOCAL_INCLUDES += [
AllowCompilerWarnings()
include('/ipc/chromium/chromium-config.mozbuild')
include('../glue/common.mozbuild')
HunspellIncludes()
if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
CXXFLAGS += [

View File

@ -99,13 +99,13 @@ interface mozISpellCheckingEngine : nsISupports {
* Remove a dictionary with the given language code and path. If the path does
* not match that of the current entry with the given language code, it is not
* removed.
*
* @returns True if the dictionary was found and removed.
*/
void removeDictionary(in AString lang, in nsIURI file);
bool removeDictionary(in AString lang, in nsIURI file);
};
%{C++
#define DICTIONARY_SEARCH_DIRECTORY "DictD"
#define SPELLCHECK_DICTIONARY_REMOVE_NOTIFICATION \
"spellcheck-dictionary-remove"
%}

View File

@ -2423,23 +2423,8 @@ gfxFcPlatformFontList::TryLangForGroup(const nsACString& aOSLang,
++pos;
}
// We can safely use mLangService->LookupLanguage if we're on the main
// thread, or if we're in a Servo traversal that has locked the cache,
// but not if we're on the font enumeration thread used to populate the
// Font menu in about:preferences.
if (IsInServoTraversalWithoutMainThreadAssertion() || NS_IsMainThread()) {
nsAtom *atom = mLangService->LookupLanguage(aFcLang);
return atom == aLangGroup;
}
// Off-main-thread/non-servo-traversal version: fall back to
// GetUncachedLanguageGroup to avoid unsafe access to the lang-group
// mapping cache hashtable.
nsAutoCString lowered(aFcLang);
ToLowerCase(lowered);
RefPtr<nsAtom> lang = NS_Atomize(lowered);
RefPtr<nsAtom> group = mLangService->GetUncachedLanguageGroup(lang);
return group.get() == aLangGroup;
nsAtom *atom = mLangService->LookupLanguage(aFcLang);
return atom == aLangGroup;
}
void

View File

@ -39,7 +39,7 @@ struct jsid
constexpr jsid() : asBits(JSID_TYPE_VOID) {}
static constexpr jsid fromRawBits(size_t bits) {
static constexpr MOZ_ALWAYS_INLINE jsid fromRawBits(size_t bits) {
jsid id;
id.asBits = bits;
return id;

View File

@ -87,12 +87,8 @@ jsfuzz_init(JSContext** cx, JS::PersistentRootedObject* global)
}
static void
jsfuzz_uninit(JSContext* cx, JSCompartment* oldCompartment)
jsfuzz_uninit(JSContext* cx)
{
if (oldCompartment) {
JS::LeaveRealm(cx, JS::GetRealmForCompartment(oldCompartment));
oldCompartment = nullptr;
}
if (cx) {
JS_EndRequest(cx);
JS_DestroyContext(cx);
@ -143,7 +139,7 @@ main(int argc, char* argv[])
testingFunc(nullptr, 0);
#endif
jsfuzz_uninit(gCx, nullptr);
jsfuzz_uninit(gCx);
JS_ShutDown();

View File

@ -7914,9 +7914,8 @@ AutoPrepareForTracing::AutoPrepareForTracing(JSContext* cx)
session_.emplace(cx->runtime());
}
JSCompartment*
js::NewCompartment(JSContext* cx, JSPrincipals* principals,
const JS::RealmOptions& options)
Realm*
js::NewRealm(JSContext* cx, JSPrincipals* principals, const JS::RealmOptions& options)
{
JSRuntime* rt = cx->runtime();
JS_AbortIfWrongThread(cx);
@ -7983,30 +7982,28 @@ js::NewCompartment(JSContext* cx, JSPrincipals* principals,
}
zoneHolder.forget();
return JS::GetCompartmentForRealm(realm.forget());
return realm.forget();
}
void
gc::MergeCompartments(JSCompartment* source, JSCompartment* target)
gc::MergeRealms(Realm* source, Realm* target)
{
JSRuntime* rt = source->runtimeFromMainThread();
rt->gc.mergeCompartments(source, target);
rt->gc.mergeRealms(source, target);
AutoLockGC lock(rt);
rt->gc.maybeAllocTriggerZoneGC(target->zone(), lock);
}
void
GCRuntime::mergeCompartments(JSCompartment* source, JSCompartment* target)
GCRuntime::mergeRealms(Realm* source, Realm* target)
{
// The source realm must be specifically flagged as mergable. This
// also implies that the realm is not visible to the debugger.
Realm* sourceRealm = JS::GetRealmForCompartment(source);
Realm* targetRealm = JS::GetRealmForCompartment(target);
MOZ_ASSERT(sourceRealm->creationOptions().mergeable());
MOZ_ASSERT(sourceRealm->creationOptions().invisibleToDebugger());
MOZ_ASSERT(source->creationOptions().mergeable());
MOZ_ASSERT(source->creationOptions().invisibleToDebugger());
MOZ_ASSERT(!sourceRealm->hasBeenEntered());
MOZ_ASSERT(!source->hasBeenEntered());
MOZ_ASSERT(source->zone()->compartments().length() == 1);
JSContext* cx = rt->mainContextFromOwnThread();
@ -8019,35 +8016,35 @@ GCRuntime::mergeCompartments(JSCompartment* source, JSCompartment* target)
// Cleanup tables and other state in the source realm/zone that will be
// meaningless after merging into the target realm/zone.
sourceRealm->clearTables();
source->clearTables();
source->zone()->clearTables();
sourceRealm->unsetIsDebuggee();
source->unsetIsDebuggee();
// The delazification flag indicates the presence of LazyScripts in a
// realm for the Debugger API, so if the source realm created LazyScripts,
// the flag must be propagated to the target realm.
if (sourceRealm->needsDelazificationForDebugger())
targetRealm->scheduleDelazificationForDebugger();
if (source->needsDelazificationForDebugger())
target->scheduleDelazificationForDebugger();
// Release any relocated arenas which we may be holding on to as they might
// be in the source zone
releaseHeldRelocatedArenas();
// Fixup compartment pointers in source to refer to target, and make sure
// Fixup realm pointers in source to refer to target, and make sure
// type information generations are in sync.
for (auto script = source->zone()->cellIter<JSScript>(); !script.done(); script.next()) {
MOZ_ASSERT(script->compartment() == source);
script->realm_ = JS::GetRealmForCompartment(target);
MOZ_ASSERT(script->realm() == source);
script->realm_ = target;
script->setTypesGeneration(target->zone()->types.generation);
}
GlobalObject* global = targetRealm->maybeGlobal();
GlobalObject* global = target->maybeGlobal();
MOZ_ASSERT(global);
for (auto group = source->zone()->cellIter<ObjectGroup>(); !group.done(); group.next()) {
// Replace placeholder object prototypes with the correct prototype in
// the target compartment.
// the target realm.
TaggedProto proto(group->proto());
if (proto.isObject()) {
JSObject* obj = proto.toObject();
@ -8063,13 +8060,13 @@ GCRuntime::mergeCompartments(JSCompartment* source, JSCompartment* target)
}
group->setGeneration(target->zone()->types.generation);
group->realm_ = JS::GetRealmForCompartment(target);
group->realm_ = target;
// Remove any unboxed layouts from the list in the off thread
// compartment. These do not need to be reinserted in the target
// compartment's list, as the list is not required to be complete.
// realm. These do not need to be reinserted in the target
// realm's list, as the list is not required to be complete.
if (UnboxedLayout* layout = group->maybeUnboxedLayoutDontCheckGeneration())
layout->detachFromCompartment();
layout->detachFromRealm();
}
// Fixup zone pointers in source's zone to refer to target's zone.
@ -8092,9 +8089,9 @@ GCRuntime::mergeCompartments(JSCompartment* source, JSCompartment* target)
}
}
// The source should be the only compartment in its zone.
for (CompartmentsInZoneIter c(source->zone()); !c.done(); c.next())
MOZ_ASSERT(c.get() == source);
// The source should be the only realm in its zone.
for (RealmsInZoneIter r(source->zone()); !r.done(); r.next())
MOZ_ASSERT(r.get() == source);
// Merge the allocator, stats and UIDs in source's zone into target's zone.
target->zone()->arenas.adoptArenas(rt, &source->zone()->arenas, targetZoneIsCollecting);
@ -8109,37 +8106,37 @@ GCRuntime::mergeCompartments(JSCompartment* source, JSCompartment* target)
// Atoms which are marked in source's zone are now marked in target's zone.
atomMarking.adoptMarkedAtoms(target->zone(), source->zone());
// Merge script name maps in the target compartment's map.
if (rt->lcovOutput().isEnabled() && sourceRealm->scriptNameMap) {
// Merge script name maps in the target realm's map.
if (rt->lcovOutput().isEnabled() && source->scriptNameMap) {
AutoEnterOOMUnsafeRegion oomUnsafe;
if (!targetRealm->scriptNameMap) {
targetRealm->scriptNameMap = cx->make_unique<ScriptNameMap>();
if (!target->scriptNameMap) {
target->scriptNameMap = cx->make_unique<ScriptNameMap>();
if (!targetRealm->scriptNameMap)
if (!target->scriptNameMap)
oomUnsafe.crash("Failed to create a script name map.");
if (!targetRealm->scriptNameMap->init())
if (!target->scriptNameMap->init())
oomUnsafe.crash("Failed to initialize a script name map.");
}
for (ScriptNameMap::Range r = sourceRealm->scriptNameMap->all(); !r.empty(); r.popFront()) {
for (ScriptNameMap::Range r = source->scriptNameMap->all(); !r.empty(); r.popFront()) {
JSScript* key = r.front().key();
auto value = Move(r.front().value());
if (!targetRealm->scriptNameMap->putNew(key, Move(value)))
if (!target->scriptNameMap->putNew(key, Move(value)))
oomUnsafe.crash("Failed to add an entry in the script name map.");
}
sourceRealm->scriptNameMap->clear();
source->scriptNameMap->clear();
}
// The source compartment is now completely empty, and is the only
// compartment in its zone, which is the only zone in its group. Delete
// compartment, zone and group without waiting for this to be cleaned up by
// a full GC.
// The source realm is now completely empty, and is the only realm in its
// compartment, which is the only compartment in its zone. Delete realm,
// compartment and zone without waiting for this to be cleaned up by a full
// GC.
Zone* sourceZone = source->zone();
sourceZone->deleteEmptyCompartment(source);
sourceZone->deleteEmptyCompartment(source->compartment());
deleteEmptyZone(sourceZone);
}

View File

@ -122,9 +122,8 @@ extern void
IterateScripts(JSContext* cx, JSCompartment* compartment,
void* data, IterateScriptCallback scriptCallback);
JSCompartment*
NewCompartment(JSContext* cx, JSPrincipals* principals,
const JS::RealmOptions& options);
JS::Realm*
NewRealm(JSContext* cx, JSPrincipals* principals, const JS::RealmOptions& options);
namespace gc {
@ -132,10 +131,10 @@ void FinishGC(JSContext* cx);
/*
* Merge all contents of source into target. This can only be used if source is
* the only compartment in its zone.
* the only realm in its zone.
*/
void
MergeCompartments(JSCompartment* source, JSCompartment* target);
MergeRealms(JS::Realm* source, JS::Realm* target);
enum VerifierType {
PreBarrierVerifier

View File

@ -495,7 +495,7 @@ class GCRuntime
void joinTask(GCParallelTask& task, gcstats::PhaseKind phase,
AutoLockHelperThreadState& locked);
void mergeCompartments(JSCompartment* source, JSCompartment* target);
void mergeRealms(JS::Realm* source, JS::Realm* target);
private:
enum IncrementalResult

View File

@ -441,7 +441,7 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
case JS::TraceKind::Script:
{
JSScript* script = static_cast<JSScript*>(thing);
snprintf(buf, bufsize, " %s:%zu", script->filename(), script->lineno());
snprintf(buf, bufsize, " %s:%u", script->filename(), script->lineno());
break;
}

View File

@ -1,9 +1,23 @@
if (!wasmIsSupported())
quit();
load(scriptdir + 'harness/index.js');
load(scriptdir + 'harness/wasm-constants.js');
load(scriptdir + 'harness/wasm-module-builder.js');
// We need to find the absolute path that ends like this:
//
// js/src/jit-test/tests/wasm/spec/harness/
//
// because that's where the test harness lives. Fortunately we are provided
// with |libdir|, which is a path that ends thusly
//
// js/src/jit-test/lib/
//
// That is, it has a fixed offset relative to what we need. So we can
// simply do this:
let harnessdir = libdir + "../tests/wasm/spec/harness/";
load(harnessdir + 'index.js');
load(harnessdir + 'wasm-constants.js');
load(harnessdir + 'wasm-module-builder.js');
function test(func, description) {
let maybeErr;
@ -45,3 +59,13 @@ let assert_false = (x, errMsg) => { assertEq(x, false); }
function assert_unreached(description) {
throw new Error(`unreachable:\n${description}`);
}
function assert_not_equals(actual, not_expected, description) {
let caught = false;
try {
assertEq(actual, not_expected, description);
} catch (e) {
caught = true;
};
assertEq(caught, true, "assert_not_equals failed: " + description);
}

View File

@ -81,7 +81,9 @@ function reinitializeRegistry() {
registry = {
spectest: {
print: console.log,
print_i32: console.log.bind(console),
global: 666,
global_i32: 666,
table: new WebAssembly.Table({initial: 10, maximum: 20, element: 'anyfunc'}),
memory: new WebAssembly.Memory({initial: 1, maximum: 2})
}

View File

@ -186,9 +186,9 @@ class WasmModuleBuilder {
return this.num_imported_funcs++;
}
addImportedGlobal(module = "", name, type) {
addImportedGlobal(module = "", name, type, mutable = false) {
let o = {module: module, name: name, kind: kExternalGlobal, type: type,
mutable: false}
mutable: mutable}
this.imports.push(o);
return this.num_imported_globals++;
}

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
const kC0DEFEFE = new Uint8Array([0xC0, 0xDE, 0xFE, 0xFE]);
(function testJSAPI() {
const WasmPage = 64 * 1024;
@ -91,6 +93,17 @@ const moduleBinaryWithMemSectionAndMemImport = (() => {
return builder.toBuffer();
})();
const exportingModuleIdentityFn = (() => {
let builder = new WasmModuleBuilder();
builder
.addFunction('id', kSig_i_i)
.addBody([kExprGetLocal, 0, kExprEnd])
.exportFunc();
return builder.toBuffer();
})();
let Module;
let Instance;
let CompileError;
@ -103,6 +116,16 @@ let mem1;
let Table;
let tbl1;
let tableProto;
let Global;
let globalProto;
let globalI32;
let globalI64;
let globalF32;
let globalF64;
let globalI32Mut;
let globalI64Mut;
let globalF32Mut;
let globalF64Mut;
let emptyModule;
let exportingModule;
@ -200,7 +223,7 @@ test(() => {
assertThrows(() => new Module(new Uint8Array()), CompileError);
assertThrows(() => new Module(new ArrayBuffer()), CompileError);
assert_equals(new Module(emptyModuleBinary) instanceof Module, true);
assert_equals(new Module(emptyModuleBinary.buffer) instanceof Module, true);
assert_equals(new Module(new Uint8Array(emptyModuleBinary)) instanceof Module, true);
}, "'WebAssembly.Module' constructor function");
test(() => {
@ -398,6 +421,7 @@ test(() => {
assert_equals(f.length, 0);
assert_equals('name' in f, true);
assert_equals(Function.prototype.call.call(f), 42);
assert_equals('prototype' in f, false);
assertThrows(() => new f(), TypeError);
}, "Exported WebAssembly functions");
@ -418,10 +442,6 @@ test(() => {
assertThrows(() => Memory(), TypeError);
assertThrows(() => new Memory(1), TypeError);
assertThrows(() => new Memory({initial:{valueOf() { throw new Error("here")}}}), Error);
assertThrows(() => new Memory({}), RangeError);
assertThrows(() => new Memory({initial:NaN}), RangeError);
assertThrows(() => new Memory({initial:undefined}), RangeError);
assertThrows(() => new Memory({initial:"abc"}), RangeError);
assertThrows(() => new Memory({initial:-1}), RangeError);
assertThrows(() => new Memory({initial:Math.pow(2,32)}), RangeError);
assertThrows(() => new Memory({initial:1, maximum: Math.pow(2,32)/Math.pow(2,14) }), RangeError);
@ -484,27 +504,30 @@ test(() => {
assert_equals(memGrow.length, 1);
assertThrows(() => memGrow.call(), TypeError);
assertThrows(() => memGrow.call({}), TypeError);
assertThrows(() => memGrow.call(mem1), RangeError);
assertThrows(() => memGrow.call(mem1, NaN), RangeError);
assertThrows(() => memGrow.call(mem1, undefined), RangeError);
assertThrows(() => memGrow.call(mem1, "abc"), RangeError);
assertThrows(() => memGrow.call(mem1, -1), RangeError);
assertThrows(() => memGrow.call(mem1, Math.pow(2,32)), RangeError);
var mem = new Memory({initial:1, maximum:2});
var buf = mem.buffer;
assert_equals(buf.byteLength, WasmPage);
assert_equals(mem.grow(0), 1);
assert_equals(buf !== mem.buffer, true);
assert_not_equals(buf, mem.buffer)
assert_equals(buf.byteLength, 0);
buf = mem.buffer;
assert_equals(buf.byteLength, WasmPage);
assert_equals(mem.grow(1), 1);
assert_equals(buf !== mem.buffer, true);
assert_not_equals(buf, mem.buffer)
assert_equals(buf.byteLength, 0);
buf = mem.buffer;
assert_equals(buf.byteLength, 2 * WasmPage);
assertThrows(() => mem.grow(1), Error);
assert_equals(buf, mem.buffer);
mem = new Memory({initial:0, maximum:1});
buf = mem.buffer;
assert_equals(buf.byteLength, 0);
assert_equals(mem.grow(0), 0);
assert_not_equals(buf, mem.buffer)
assert_equals(buf.byteLength, 0);
assert_equals(mem.buffer.byteLength, 0);
}, "'WebAssembly.Memory.prototype.grow' method");
test(() => {
@ -527,10 +550,6 @@ test(() => {
assertThrows(() => new Table({initial:1, element:"any"}), TypeError);
assertThrows(() => new Table({initial:1, element:{valueOf() { return "anyfunc" }}}), TypeError);
assertThrows(() => new Table({initial:{valueOf() { throw new Error("here")}}, element:"anyfunc"}), Error);
assertThrows(() => new Table({element:"anyfunc"}), RangeError);
assertThrows(() => new Table({initial:NaN, element:"anyfunc"}), RangeError);
assertThrows(() => new Table({initial:undefined, element:"anyfunc"}), RangeError);
assertThrows(() => new Table({initial:"abc", element:"anyfunc"}), RangeError);
assertThrows(() => new Table({initial:-1, element:"anyfunc"}), RangeError);
assertThrows(() => new Table({initial:Math.pow(2,32), element:"anyfunc"}), RangeError);
assertThrows(() => new Table({initial:2, maximum:1, element:"anyfunc"}), RangeError);
@ -598,10 +617,6 @@ test(() => {
assert_equals(get.call(tbl1, 0), null);
assert_equals(get.call(tbl1, 1), null);
assert_equals(get.call(tbl1, 1.5), null);
assertThrows(() => get.call(tbl1), RangeError);
assertThrows(() => get.call(tbl1, NaN), RangeError);
assertThrows(() => get.call(tbl1, undefined), RangeError);
assertThrows(() => get.call(tbl1, "abc"), RangeError);
assertThrows(() => get.call(tbl1, 2), RangeError);
assertThrows(() => get.call(tbl1, 2.5), RangeError);
assertThrows(() => get.call(tbl1, -1), RangeError);
@ -623,9 +638,6 @@ test(() => {
assertThrows(() => set.call(), TypeError);
assertThrows(() => set.call({}), TypeError);
assertThrows(() => set.call(tbl1, 0), TypeError);
assertThrows(() => set.call(tbl1, NaN, null), RangeError);
assertThrows(() => set.call(tbl1, undefined, null), RangeError);
assertThrows(() => set.call(tbl1, "abc", null), RangeError);
assertThrows(() => set.call(tbl1, 2, null), RangeError);
assertThrows(() => set.call(tbl1, -1, null), RangeError);
assertThrows(() => set.call(tbl1, Math.pow(2,33), null), RangeError);
@ -651,10 +663,6 @@ test(() => {
assert_equals(tblGrow.length, 1);
assertThrows(() => tblGrow.call(), TypeError);
assertThrows(() => tblGrow.call({}), TypeError);
assertThrows(() => tblGrow.call(tbl1), RangeError);
assertThrows(() => tblGrow.call(tbl1, NaN), RangeError);
assertThrows(() => tblGrow.call(tbl1, undefined), RangeError);
assertThrows(() => tblGrow.call(tbl1, "abc"), RangeError);
assertThrows(() => tblGrow.call(tbl1, -1), RangeError);
assertThrows(() => tblGrow.call(tbl1, Math.pow(2,32)), RangeError);
var tbl = new Table({element:"anyfunc", initial:1, maximum:2});
@ -666,6 +674,275 @@ test(() => {
assertThrows(() => tbl.grow(1), Error);
}, "'WebAssembly.Table.prototype.grow' method");
test(() => {
const globalDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Global');
assert_equals(typeof globalDesc.value, "function");
assert_equals(globalDesc.writable, true);
assert_equals(globalDesc.enumerable, false);
assert_equals(globalDesc.configurable, true);
Global = WebAssembly.Global;
}, "'WebAssembly.Global' data property");
test(() => {
const globalDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Global');
assert_equals(Global, globalDesc.value);
assert_equals(Global.length, 1);
assert_equals(Global.name, "Global");
assertThrows(() => Global(), TypeError);
assertThrows(() => new Global(1), TypeError);
assertThrows(() => new Global({}), TypeError);
assertThrows(() => new Global({value: 'foo'}), TypeError);
assertThrows(() => new Global({value: 'i64'}), TypeError);
assert_equals(new Global({value:'i32'}) instanceof Global, true);
assert_equals(new Global({value:'f32'}) instanceof Global, true);
assert_equals(new Global({value:'f64'}) instanceof Global, true);
assert_equals(new Global({value:'i32', mutable: false}) instanceof Global, true);
assert_equals(new Global({value:'f64', mutable: false}) instanceof Global, true);
assert_equals(new Global({value:'f64', mutable: false}) instanceof Global, true);
assert_equals(new Global({value:'i32', mutable: true}) instanceof Global, true);
assert_equals(new Global({value:'f64', mutable: true}) instanceof Global, true);
assert_equals(new Global({value:'f64', mutable: true}) instanceof Global, true);
assert_equals(new Global({value:'i32'}, 0x132) instanceof Global, true);
assert_equals(new Global({value:'f32'}, 0xf32) instanceof Global, true);
assert_equals(new Global({value:'f64'}, 0xf64) instanceof Global, true);
assert_equals(new Global({value:'i32', mutable: false}, 0x132) instanceof Global, true);
assert_equals(new Global({value:'f32', mutable: false}, 0xf32) instanceof Global, true);
assert_equals(new Global({value:'f64', mutable: false}, 0xf64) instanceof Global, true);
assert_equals(new Global({value:'i32', mutable: true}, 0x132) instanceof Global, true);
assert_equals(new Global({value:'f32', mutable: true}, 0xf32) instanceof Global, true);
assert_equals(new Global({value:'f64', mutable: true}, 0xf64) instanceof Global, true);
}, "'WebAssembly.Global' constructor function");
test(() => {
const globalProtoDesc = Object.getOwnPropertyDescriptor(Global, 'prototype');
assert_equals(typeof globalProtoDesc.value, "object");
assert_equals(globalProtoDesc.writable, false);
assert_equals(globalProtoDesc.enumerable, false);
assert_equals(globalProtoDesc.configurable, false);
}, "'WebAssembly.Global.prototype' data property");
test(() => {
const globalProtoDesc = Object.getOwnPropertyDescriptor(Global, 'prototype');
globalProto = Global.prototype;
assert_equals(globalProto, globalProtoDesc.value);
assert_equals(String(globalProto), "[object WebAssembly.Global]");
assert_equals(Object.getPrototypeOf(globalProto), Object.prototype);
}, "'WebAssembly.Global.prototype' object");
test(() => {
globalI32 = new Global({value: 'i32'}, 0x132);
globalF32 = new Global({value: 'f32'}, 0xf32);
globalF64 = new Global({value: 'f64'}, 0xf64);
globalI32Mut = new Global({value: 'i32', mutable: true}, 0x132);
globalF32Mut = new Global({value: 'f32', mutable: true}, 0xf32);
globalF64Mut = new Global({value: 'f64', mutable: true}, 0xf64);
assert_equals(typeof globalI32, "object");
assert_equals(String(globalI32), "[object WebAssembly.Global]");
assert_equals(Object.getPrototypeOf(globalI32), globalProto);
}, "'WebAssembly.Global' instance objects");
test(() => {
let builder = new WasmModuleBuilder();
builder.addGlobal(kWasmI32).exportAs('i32');
builder.addGlobal(kWasmI64).exportAs('i64');
builder.addGlobal(kWasmF32).exportAs('f32');
builder.addGlobal(kWasmF64).exportAs('f64');
builder.addGlobal(kWasmI32, true).exportAs('i32mut');
builder.addGlobal(kWasmI64, true).exportAs('i64mut');
builder.addGlobal(kWasmF32, true).exportAs('f32mut');
builder.addGlobal(kWasmF64, true).exportAs('f64mut');
let module = new WebAssembly.Module(builder.toBuffer());
let instance = new WebAssembly.Instance(module);
assert_true(instance.exports.i32 instanceof WebAssembly.Global);
assert_true(instance.exports.i64 instanceof WebAssembly.Global);
assert_true(instance.exports.f32 instanceof WebAssembly.Global);
assert_true(instance.exports.f64 instanceof WebAssembly.Global);
assert_true(instance.exports.i32mut instanceof WebAssembly.Global);
assert_true(instance.exports.i64mut instanceof WebAssembly.Global);
assert_true(instance.exports.f32mut instanceof WebAssembly.Global);
assert_true(instance.exports.f64mut instanceof WebAssembly.Global);
// Can't set value of immutable globals.
assertThrows(() => instance.exports.i32.value = 0, TypeError);
assertThrows(() => instance.exports.i64.value = 0, TypeError);
assertThrows(() => instance.exports.f32.value = 0, TypeError);
assertThrows(() => instance.exports.f64.value = 0, TypeError);
instance.exports.i32mut.value = 13579;
instance.exports.f32mut.value = 24680;
instance.exports.f64mut.value = 124816;
globalI64 = instance.exports.i64;
globalI64Mut = instance.exports.i64mut;
}, "Export 'WebAssembly.Global'");
test(() => {
const lengthDesc = Object.getOwnPropertyDescriptor(globalProto, 'value');
assert_equals(typeof lengthDesc.get, "function");
assert_equals(typeof lengthDesc.set, "function");
assert_equals(lengthDesc.enumerable, true);
assert_equals(lengthDesc.configurable, true);
}, "'WebAssembly.Global.prototype.value' accessor data property");
test(() => {
const valueDesc = Object.getOwnPropertyDescriptor(globalProto, 'value');
const valueGetter = valueDesc.get;
assert_equals(valueGetter.length, 0);
assertThrows(() => valueGetter.call(), TypeError);
assertThrows(() => valueGetter.call({}), TypeError);
assert_equals(typeof valueGetter.call(globalI32), "number");
assertThrows(() => valueGetter.call(globalI64), TypeError);
assert_equals(typeof valueGetter.call(globalF32), "number");
assert_equals(typeof valueGetter.call(globalF64), "number");
assert_equals(typeof valueGetter.call(globalI32Mut), "number");
assertThrows(() => valueGetter.call(globalI64Mut), TypeError);
assert_equals(typeof valueGetter.call(globalF32Mut), "number");
assert_equals(typeof valueGetter.call(globalF64Mut), "number");
assert_equals(valueGetter.call(globalI32), 0x132);
assert_equals(valueGetter.call(globalF32), 0xf32);
assert_equals(valueGetter.call(globalF64), 0xf64);
assert_equals(valueGetter.call(globalI32Mut), 0x132);
assert_equals(valueGetter.call(globalF32Mut), 0xf32);
assert_equals(valueGetter.call(globalF64Mut), 0xf64);
}, "'WebAssembly.Global.prototype.value' getter");
test(() => {
const valueDesc = Object.getOwnPropertyDescriptor(globalProto, 'value');
const valueSetter = valueDesc.set;
assert_equals(valueSetter.length, 1);
assertThrows(() => valueSetter.call(), TypeError);
assertThrows(() => valueSetter.call({}), TypeError);
assertThrows(() => valueSetter.call(globalI32, 1234), TypeError);
assertThrows(() => valueSetter.call(globalI64, 1234), TypeError);
assertThrows(() => valueSetter.call(globalF32, 1234), TypeError);
assertThrows(() => valueSetter.call(globalF64, 1234), TypeError);
valueSetter.call(globalI32Mut, 1234);
assertThrows(() => valueSetter.call(globalI64Mut, 1234), TypeError);
valueSetter.call(globalF32Mut, 5678);
valueSetter.call(globalF64Mut, 9012);
assert_equals(globalI32Mut.value, 1234);
assert_equals(globalF32Mut.value, 5678);
assert_equals(globalF64Mut.value, 9012);
}, "'WebAssembly.Global.prototype.value' setter");
test(() => {
const valueOfDesc = Object.getOwnPropertyDescriptor(globalProto, 'valueOf');
assert_equals(typeof valueOfDesc.value, "function");
assert_equals(valueOfDesc.enumerable, false);
assert_equals(valueOfDesc.configurable, true);
}, "'WebAssembly.Global.prototype.valueOf' data property");
test(() => {
const valueOfDesc = Object.getOwnPropertyDescriptor(globalProto, 'valueOf');
const valueOf = valueOfDesc.value;
assert_equals(valueOf.length, 0);
assertThrows(() => valueOf.call(), TypeError);
assertThrows(() => valueOf.call({}), TypeError);
assert_equals(valueOf.call(globalI32), 0x132);
assertThrows(() => valueOf.call(globalI64), TypeError);
assert_equals(valueOf.call(globalF32), 0xf32);
assert_equals(valueOf.call(globalF64), 0xf64);
assert_equals(valueOf.call(globalI32Mut), 1234);
assertThrows(() => valueOf.call(globalI64Mut), TypeError);
assert_equals(valueOf.call(globalF32Mut), 5678);
assert_equals(valueOf.call(globalF64Mut), 9012);
}, "'WebAssembly.Global.prototype.valueOf' method");
test(() => {
assert_equals(new Global({value: 'i32'}).value, 0);
assert_equals(new Global({value: 'f32'}).value, 0);
assert_equals(new Global({value: 'f64'}).value, 0);
}, "'WebAssembly.Global' default value is 0");
test(() => {
let builder = new WasmModuleBuilder();
builder.addImportedGlobal('', 'i32', kWasmI32);
builder.addImportedGlobal('', 'i64', kWasmI64);
builder.addImportedGlobal('', 'f32', kWasmF32);
builder.addImportedGlobal('', 'f64', kWasmF64);
builder.addImportedGlobal('', 'i32mut', kWasmI32, true);
builder.addImportedGlobal('', 'i64mut', kWasmI64, true);
builder.addImportedGlobal('', 'f32mut', kWasmF32, true);
builder.addImportedGlobal('', 'f64mut', kWasmF64, true);
let module = new WebAssembly.Module(builder.toBuffer());
let instance = new WebAssembly.Instance(module, {
'': {
i32: globalI32,
i64: globalI64,
f32: globalF32,
f64: globalF64,
i32mut: globalI32Mut,
i64mut: globalI64Mut,
f32mut: globalF32Mut,
f64mut: globalF64Mut
}
});
}, "Import 'WebAssembly.Global'");
test(() => {
let assertInstanceError = (type, mutable, imports) => {
assertThrows(() => {
let builder = new WasmModuleBuilder();
builder.addImportedGlobal('', 'g', type, mutable);
let module = new WebAssembly.Module(builder.toBuffer());
let instance = new WebAssembly.Instance(module, imports);
}, LinkError);
};
const immutable = false, mutable = true;
// Type mismatch.
assertInstanceError(kWasmI32, immutable, {'': {g: globalI64}});
assertInstanceError(kWasmI32, immutable, {'': {g: globalF32}});
assertInstanceError(kWasmI32, immutable, {'': {g: globalF64}});
assertInstanceError(kWasmI64, immutable, {'': {g: globalI32}});
assertInstanceError(kWasmI64, immutable, {'': {g: globalF32}});
assertInstanceError(kWasmI64, immutable, {'': {g: globalF64}});
assertInstanceError(kWasmF32, immutable, {'': {g: globalI32}});
assertInstanceError(kWasmF32, immutable, {'': {g: globalI64}});
assertInstanceError(kWasmF32, immutable, {'': {g: globalF64}});
assertInstanceError(kWasmF64, immutable, {'': {g: globalI32}});
assertInstanceError(kWasmF64, immutable, {'': {g: globalI64}});
assertInstanceError(kWasmF64, immutable, {'': {g: globalF32}});
assertInstanceError(kWasmI32, mutable, {'': {g: globalI64Mut}});
assertInstanceError(kWasmI32, mutable, {'': {g: globalF32Mut}});
assertInstanceError(kWasmI32, mutable, {'': {g: globalF64Mut}});
assertInstanceError(kWasmI64, mutable, {'': {g: globalI32Mut}});
assertInstanceError(kWasmI64, mutable, {'': {g: globalF32Mut}});
assertInstanceError(kWasmI64, mutable, {'': {g: globalF64Mut}});
assertInstanceError(kWasmF32, mutable, {'': {g: globalI32Mut}});
assertInstanceError(kWasmF32, mutable, {'': {g: globalI64Mut}});
assertInstanceError(kWasmF32, mutable, {'': {g: globalF64Mut}});
assertInstanceError(kWasmF64, mutable, {'': {g: globalI32Mut}});
assertInstanceError(kWasmF64, mutable, {'': {g: globalI64Mut}});
assertInstanceError(kWasmF64, mutable, {'': {g: globalF32Mut}});
// Mutable mismatch.
assertInstanceError(kWasmI32, immutable, {'': {g: globalI32Mut}});
assertInstanceError(kWasmI64, immutable, {'': {g: globalI64Mut}});
assertInstanceError(kWasmF32, immutable, {'': {g: globalF32Mut}});
assertInstanceError(kWasmF64, immutable, {'': {g: globalF64Mut}});
assertInstanceError(kWasmI32, mutable, {'': {g: globalI32}});
assertInstanceError(kWasmI64, mutable, {'': {g: globalI64}});
assertInstanceError(kWasmF32, mutable, {'': {g: globalF32}});
assertInstanceError(kWasmF64, mutable, {'': {g: globalF64}});
// Can't import Number as mutable.
assertInstanceError(kWasmI32, mutable, {'': {g: 1}});
assertInstanceError(kWasmI64, mutable, {'': {g: 1}});
assertInstanceError(kWasmF32, mutable, {'': {g: 1}});
assertInstanceError(kWasmF64, mutable, {'': {g: 1}});
}, "Import 'WebAssembly.Global' type mismatch");
test(() => {
assertThrows(() => WebAssembly.validate(), TypeError);
assertThrows(() => WebAssembly.validate("hi"), TypeError);
@ -673,7 +950,7 @@ test(() => {
assert_true(WebAssembly.validate(complexImportingModuleBinary));
assert_false(WebAssembly.validate(moduleBinaryImporting2Memories));
assert_false(WebAssembly.validate(moduleBinaryWithMemSectionAndMemImport));
}, "'WebAssembly.validate' method"),
}, "'WebAssembly.validate' method");
test(() => {
const compileDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'compile');
@ -712,8 +989,7 @@ assertCompileError([1], TypeError);
assertCompileError([{}], TypeError);
assertCompileError([new Uint8Array()], CompileError);
assertCompileError([new ArrayBuffer()], CompileError);
assertCompileError([new Uint8Array("hi!")], CompileError);
assertCompileError([new ArrayBuffer("hi!")], CompileError);
assertCompileError([kC0DEFEFE], CompileError);
num_tests = 1;
function assertCompileSuccess(bytes) {
@ -726,7 +1002,7 @@ function assertCompileSuccess(bytes) {
}
assertCompileSuccess(emptyModuleBinary);
assertCompileSuccess(emptyModuleBinary.buffer);
assertCompileSuccess(new Uint8Array(emptyModuleBinary));
test(() => {
const instantiateDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'instantiate');
@ -742,7 +1018,6 @@ test(() => {
assert_equals(instantiate, instantiateDesc.value);
assert_equals(instantiate.length, 1);
assert_equals(instantiate.name, "instantiate");
var instantiateErrorTests = 1;
function assertInstantiateError(args, err) {
promise_test(() => {
return instantiate(...args)
@ -751,9 +1026,8 @@ test(() => {
})
.catch(error => {
assert_equals(error instanceof err, true);
assert_equals(Boolean(error.stack.match("jsapi.js")), true);
})
}, `unexpected success in assertInstantiateError ${instantiateErrorTests++}`);
}, 'unexpected success in assertInstantiateError');
}
var scratch_memory = new WebAssembly.Memory({initial:1});
var scratch_table = new WebAssembly.Table({element:"anyfunc", initial:1, maximum:1});
@ -763,8 +1037,7 @@ test(() => {
assertInstantiateError([{}], TypeError);
assertInstantiateError([new Uint8Array()], CompileError);
assertInstantiateError([new ArrayBuffer()], CompileError);
assertInstantiateError([new Uint8Array("hi!")], CompileError);
assertInstantiateError([new ArrayBuffer("hi!")], CompileError);
assertInstantiateError([kC0DEFEFE], CompileError);
assertInstantiateError([importingModule], TypeError);
assertInstantiateError([importingModule, null], TypeError);
assertInstantiateError([importingModuleBinary, null], TypeError);
@ -779,7 +1052,6 @@ test(() => {
assertInstantiateError([complexImportingModuleBinary, {}], TypeError);
assertInstantiateError([complexImportingModuleBinary, {"c": {"d": scratch_memory}}], TypeError);
var instantiateSuccessTests = 1;
function assertInstantiateSuccess(module, imports) {
promise_test(()=> {
return instantiate(module, imports)
@ -798,14 +1070,14 @@ test(() => {
assert_equals(desc.enumerable, true);
assert_equals(desc.configurable, true);
}
})}, `unexpected failure in assertInstantiateSuccess ${instantiateSuccessTests++}`);
})}, 'unexpected failure in assertInstantiateSuccess');
}
assertInstantiateSuccess(emptyModule);
assertInstantiateSuccess(emptyModuleBinary);
assertInstantiateSuccess(emptyModuleBinary.buffer);
assertInstantiateSuccess(new Uint8Array(emptyModuleBinary));
assertInstantiateSuccess(importingModule, {"":{f:()=>{}}});
assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}});
assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}});
assertInstantiateSuccess(new Uint8Array(importingModuleBinary), {"":{f:()=>{}}});
assertInstantiateSuccess(complexImportingModuleBinary, {
a:{b:()=>{}},
c:{d:scratch_memory},
@ -813,4 +1085,104 @@ test(() => {
g:{'⚡':1}});
}, "'WebAssembly.instantiate' function");
const complexReExportingModuleBinary = (() => {
let builder = new WasmModuleBuilder();
let fIndex = builder.addImport('a', 'f', kSig_i_i);
let gIndex = builder.addImport('a', 'g', kSig_i_v);
builder.addImportedMemory('c', 'd');
builder.addImportedTable('e', 'f');
builder.addExport('x', fIndex)
builder.addExport('y', gIndex)
builder.addExportOfKind('z', kExternalMemory, 0)
builder.addExportOfKind('w', kExternalTable, 0)
return builder.toBuffer();
})();
const complexTableReExportingModuleBinary = (() => {
let builder = new WasmModuleBuilder();
builder.addImport('a', '_', kSig_v_v);
let gIndex = builder.addImport('a', 'g', kSig_i_v);
let fIndex = builder.addImport('a', 'f', kSig_i_i);
let hIndex = builder
.addFunction('h', kSig_i_v)
.addBody([
kExprI32Const,
46,
kExprEnd
]).index;
builder.setFunctionTableLength(3);
builder.appendToTable([fIndex, gIndex, hIndex]);
builder.addExportOfKind('tab', kExternalTable, 0);
return builder.toBuffer();
})();
test(() => {
let module = new WebAssembly.Module(complexReExportingModuleBinary);
let memory = new WebAssembly.Memory({initial: 0});
let table = new WebAssembly.Table({initial: 0, element: 'anyfunc'});
let imports = {
a: { f(x) { return x+1; }, g: exportingInstance.exports.f },
c: { d: memory },
e: { f: table },
};
let instance = reExportingInstance =
new WebAssembly.Instance(module, imports);
assert_equals(instance.exports.x.name, "0");
assert_false(instance.exports.x === imports.a.f);
// Previously exported Wasm functions are re-exported with the same value
assert_equals(instance.exports.y, exportingInstance.exports.f);
assert_equals(instance.exports.y.name, "0");
// Re-exported Memory and Table objects have the same value
assert_equals(instance.exports.z, memory);
assert_equals(instance.exports.w, table);
// Importing the same JS function object results in a distinct exported
// function object, whereas previously exported Wasm functions are
// re-exported with the same identity.
let instance2 = new WebAssembly.Instance(module, imports);
assert_false(instance.exports.x === instance2.exports.x);
assert_equals(instance.exports.y, instance2.exports.y);
}, "Exported values have cached JS objects");
test(() => {
let module = new WebAssembly.Module(complexTableReExportingModuleBinary);
let instance = new WebAssembly.Instance(module,
{ a: { _() { }, f: reExportingInstance.exports.x,
g: exportingInstance.exports.f } });
let table = instance.exports.tab;
// The functions that were put in come right back out
assert_equals(table.get(0), reExportingInstance.exports.x);
assert_equals(table.get(1), exportingInstance.exports.f);
// The original function indices are reflected in the name
assert_equals(table.get(0).name, "0");
assert_equals(table.get(1).name, "0");
assert_equals(table.get(2).name, "3");
// All of the functions work
assert_equals(table.get(0)(5), 6);
assert_equals(table.get(1)(), 42);
assert_equals(table.get(2)(), 46);
}, "Tables export cached");
test(() => {
let module = new WebAssembly.Module(exportingModuleIdentityFn );
let instance = new WebAssembly.Instance(module);
let value = 2 ** 31;
let output = instance.exports.id(value);
assert_equals(output, - (2 ** 31));
}, "WebAssembly integers are converted to JavaScript as if by ToInt32");
})();

View File

@ -0,0 +1 @@
|jit-test| test-also-no-wasm-baseline; test-also-no-wasm-ion; test-also-wasm-tiering; include:wasm-testharness.js

View File

@ -0,0 +1,108 @@
// globals.wast:3
let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\xa1\x80\x80\x80\x00\x08\x60\x00\x01\x7f\x60\x00\x01\x7e\x60\x01\x7f\x00\x60\x01\x7e\x00\x60\x00\x01\x7d\x60\x00\x01\x7c\x60\x01\x7d\x00\x60\x01\x7c\x00\x03\x8d\x80\x80\x80\x00\x0c\x00\x01\x00\x01\x02\x03\x04\x05\x04\x05\x06\x07\x06\xbd\x80\x80\x80\x00\x08\x7f\x00\x41\x7e\x0b\x7d\x00\x43\x00\x00\x40\xc0\x0b\x7c\x00\x44\x00\x00\x00\x00\x00\x00\x10\xc0\x0b\x7e\x00\x42\x7b\x0b\x7f\x01\x41\x74\x0b\x7d\x01\x43\x00\x00\x50\xc1\x0b\x7c\x01\x44\x00\x00\x00\x00\x00\x00\x2c\xc0\x0b\x7e\x01\x42\x71\x0b\x07\xe1\x80\x80\x80\x00\x0c\x05\x67\x65\x74\x2d\x61\x00\x00\x05\x67\x65\x74\x2d\x62\x00\x01\x05\x67\x65\x74\x2d\x78\x00\x02\x05\x67\x65\x74\x2d\x79\x00\x03\x05\x73\x65\x74\x2d\x78\x00\x04\x05\x73\x65\x74\x2d\x79\x00\x05\x05\x67\x65\x74\x2d\x31\x00\x06\x05\x67\x65\x74\x2d\x32\x00\x07\x05\x67\x65\x74\x2d\x35\x00\x08\x05\x67\x65\x74\x2d\x36\x00\x09\x05\x73\x65\x74\x2d\x35\x00\x0a\x05\x73\x65\x74\x2d\x36\x00\x0b\x0a\xf5\x80\x80\x80\x00\x0c\x84\x80\x80\x80\x00\x00\x23\x00\x0b\x84\x80\x80\x80\x00\x00\x23\x03\x0b\x84\x80\x80\x80\x00\x00\x23\x04\x0b\x84\x80\x80\x80\x00\x00\x23\x07\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x24\x04\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x24\x07\x0b\x84\x80\x80\x80\x00\x00\x23\x01\x0b\x84\x80\x80\x80\x00\x00\x23\x02\x0b\x84\x80\x80\x80\x00\x00\x23\x05\x0b\x84\x80\x80\x80\x00\x00\x23\x06\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x24\x05\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x24\x06\x0b");
// globals.wast:29
assert_return(() => call($1, "get-a", []), -2);
// globals.wast:30
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7e\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x62\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x97\x80\x80\x80\x00\x01\x91\x80\x80\x80\x00\x00\x02\x40\x10\x00\x01\x42\x7b\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-b", []), int64("-5"))
// globals.wast:31
assert_return(() => call($1, "get-x", []), -12);
// globals.wast:32
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7e\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x79\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x97\x80\x80\x80\x00\x01\x91\x80\x80\x80\x00\x00\x02\x40\x10\x00\x01\x42\x71\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-y", []), int64("-15"))
// globals.wast:34
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7d\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x31\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x9a\x80\x80\x80\x00\x01\x94\x80\x80\x80\x00\x00\x02\x40\x10\x00\xbc\x43\x00\x00\x40\xc0\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-1", []), -3.)
// globals.wast:35
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7c\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x32\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x9e\x80\x80\x80\x00\x01\x98\x80\x80\x80\x00\x00\x02\x40\x10\x00\xbd\x44\x00\x00\x00\x00\x00\x00\x10\xc0\xbd\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-2", []), -4.)
// globals.wast:36
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7d\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x35\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x9a\x80\x80\x80\x00\x01\x94\x80\x80\x80\x00\x00\x02\x40\x10\x00\xbc\x43\x00\x00\x50\xc1\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-5", []), -13.)
// globals.wast:37
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7c\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x36\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x9e\x80\x80\x80\x00\x01\x98\x80\x80\x80\x00\x00\x02\x40\x10\x00\xbd\x44\x00\x00\x00\x00\x00\x00\x2c\xc0\xbd\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-6", []), -14.)
// globals.wast:39
assert_return(() => call($1, "set-x", [6]));
// globals.wast:40
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x01\x7e\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x73\x65\x74\x2d\x79\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x91\x80\x80\x80\x00\x01\x8b\x80\x80\x80\x00\x00\x02\x40\x42\x07\x10\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "set-y", [int64("7")]))
// globals.wast:41
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x01\x7d\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x73\x65\x74\x2d\x35\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x94\x80\x80\x80\x00\x01\x8e\x80\x80\x80\x00\x00\x02\x40\x43\x00\x00\x00\x41\x10\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "set-5", [8.]))
// globals.wast:42
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x01\x7c\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x73\x65\x74\x2d\x36\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x98\x80\x80\x80\x00\x01\x92\x80\x80\x80\x00\x00\x02\x40\x44\x00\x00\x00\x00\x00\x00\x22\x40\x10\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "set-6", [9.]))
// globals.wast:44
assert_return(() => call($1, "get-x", []), 6);
// globals.wast:45
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7e\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x79\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x97\x80\x80\x80\x00\x01\x91\x80\x80\x80\x00\x00\x02\x40\x10\x00\x01\x42\x07\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-y", []), int64("7"))
// globals.wast:46
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7d\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x35\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x9a\x80\x80\x80\x00\x01\x94\x80\x80\x80\x00\x00\x02\x40\x10\x00\xbc\x43\x00\x00\x00\x41\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-5", []), 8.)
// globals.wast:47
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x00\x01\x7c\x02\x8c\x80\x80\x80\x00\x01\x02\x24\x31\x05\x67\x65\x74\x2d\x36\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x9e\x80\x80\x80\x00\x01\x98\x80\x80\x80\x00\x00\x02\x40\x10\x00\xbd\x44\x00\x00\x00\x00\x00\x00\x22\x40\xbd\x51\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // assert_return(() => call($1, "get-6", []), 9.)
// globals.wast:49
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x06\x89\x80\x80\x80\x00\x01\x7d\x00\x43\x00\x00\x00\x00\x0b\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x41\x01\x24\x00\x0b");
// globals.wast:55
let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x89\x80\x80\x80\x00\x01\x7d\x01\x43\x00\x00\x00\x00\x0b\x07\x85\x80\x80\x80\x00\x01\x01\x61\x03\x00");
// globals.wast:56
let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x89\x80\x80\x80\x00\x01\x7d\x01\x43\x00\x00\x00\x00\x0b\x07\x85\x80\x80\x80\x00\x01\x01\x61\x03\x00");
// globals.wast:58
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x8a\x80\x80\x80\x00\x01\x7d\x00\x43\x00\x00\x00\x00\x8c\x0b");
// globals.wast:63
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x86\x80\x80\x80\x00\x01\x7d\x00\x20\x00\x0b");
// globals.wast:68
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x8a\x80\x80\x80\x00\x01\x7d\x00\x43\x00\x00\x80\x3f\x8c\x0b");
// globals.wast:73
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x87\x80\x80\x80\x00\x01\x7f\x00\x41\x00\x01\x0b");
// globals.wast:78
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x85\x80\x80\x80\x00\x01\x7f\x00\x01\x0b");
// globals.wast:83
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x89\x80\x80\x80\x00\x01\x7f\x00\x43\x00\x00\x00\x00\x0b");
// globals.wast:88
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x88\x80\x80\x80\x00\x01\x7f\x00\x41\x00\x41\x00\x0b");
// globals.wast:93
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x84\x80\x80\x80\x00\x01\x7f\x00\x0b");
// globals.wast:98
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x86\x80\x80\x80\x00\x01\x7f\x00\x23\x00\x0b");
// globals.wast:103
assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x8b\x80\x80\x80\x00\x02\x7f\x00\x23\x01\x0b\x7f\x00\x41\x00\x0b");
// globals.wast:108
let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x98\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\x00");
// globals.wast:111
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x94\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\x02");
// globals.wast:124
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x94\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x0a\x67\x6c\x6f\x62\x61\x6c\x5f\x69\x33\x32\x03\x7f\xff");
// globals.wast:138
let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x86\x80\x80\x80\x00\x01\x7f\x00\x41\x00\x0b");
// globals.wast:141
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x86\x80\x80\x80\x00\x01\x7f\x02\x41\x00\x0b");
// globals.wast:153
assert_malformed("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x86\x80\x80\x80\x00\x01\x7f\xff\x41\x00\x0b");

View File

@ -0,0 +1,352 @@
// linking.wast:3
let $1 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x03\x83\x80\x80\x80\x00\x02\x00\x00\x07\x88\x80\x80\x80\x00\x01\x04\x63\x61\x6c\x6c\x00\x00\x0a\x93\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\x10\x01\x0b\x84\x80\x80\x80\x00\x00\x41\x02\x0b");
let $Mf = $1;
// linking.wast:7
register("Mf", $Mf)
// linking.wast:9
let $2 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\x8b\x80\x80\x80\x00\x01\x02\x4d\x66\x04\x63\x61\x6c\x6c\x00\x00\x03\x84\x80\x80\x80\x00\x03\x00\x00\x00\x07\xa1\x80\x80\x80\x00\x03\x07\x4d\x66\x2e\x63\x61\x6c\x6c\x00\x00\x0c\x63\x61\x6c\x6c\x20\x4d\x66\x2e\x63\x61\x6c\x6c\x00\x01\x04\x63\x61\x6c\x6c\x00\x02\x0a\x9c\x80\x80\x80\x00\x03\x84\x80\x80\x80\x00\x00\x10\x00\x0b\x84\x80\x80\x80\x00\x00\x10\x03\x0b\x84\x80\x80\x80\x00\x00\x41\x03\x0b");
let $Nf = $2;
// linking.wast:17
assert_return(() => call($Mf, "call", []), 2);
// linking.wast:18
assert_return(() => call($Nf, "Mf.call", []), 2);
// linking.wast:19
assert_return(() => call($Nf, "call", []), 3);
// linking.wast:20
assert_return(() => call($Nf, "call Mf.call", []), 2);
// linking.wast:22
let $3 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x7f\x00\x02\x96\x80\x80\x80\x00\x01\x08\x73\x70\x65\x63\x74\x65\x73\x74\x09\x70\x72\x69\x6e\x74\x5f\x69\x33\x32\x00\x00\x07\x89\x80\x80\x80\x00\x01\x05\x70\x72\x69\x6e\x74\x00\x00");
// linking.wast:26
register("reexport_f", $3)
// linking.wast:27
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x01\x7e\x00\x02\x94\x80\x80\x80\x00\x01\x0a\x72\x65\x65\x78\x70\x6f\x72\x74\x5f\x66\x05\x70\x72\x69\x6e\x74\x00\x00");
// linking.wast:31
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x94\x80\x80\x80\x00\x01\x0a\x72\x65\x65\x78\x70\x6f\x72\x74\x5f\x66\x05\x70\x72\x69\x6e\x74\x00\x00");
// linking.wast:39
let $4 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x03\x84\x80\x80\x80\x00\x03\x00\x00\x01\x06\x8c\x80\x80\x80\x00\x02\x7f\x00\x41\x2a\x0b\x7f\x01\x41\x8e\x01\x0b\x07\xad\x80\x80\x80\x00\x05\x04\x67\x6c\x6f\x62\x03\x00\x03\x67\x65\x74\x00\x00\x08\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x01\x07\x67\x65\x74\x5f\x6d\x75\x74\x00\x01\x07\x73\x65\x74\x5f\x6d\x75\x74\x00\x02\x0a\x9e\x80\x80\x80\x00\x03\x84\x80\x80\x80\x00\x00\x23\x00\x0b\x84\x80\x80\x80\x00\x00\x23\x01\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x24\x01\x0b");
let $Mg = $4;
// linking.wast:48
register("Mg", $Mg)
// linking.wast:50
let $5 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x00\x02\xbe\x80\x80\x80\x00\x05\x02\x4d\x67\x04\x67\x6c\x6f\x62\x03\x7f\x00\x02\x4d\x67\x08\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x7f\x01\x02\x4d\x67\x03\x67\x65\x74\x00\x00\x02\x4d\x67\x07\x67\x65\x74\x5f\x6d\x75\x74\x00\x00\x02\x4d\x67\x07\x73\x65\x74\x5f\x6d\x75\x74\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x06\x86\x80\x80\x80\x00\x01\x7f\x00\x41\x2b\x0b\x07\xc9\x80\x80\x80\x00\x07\x07\x4d\x67\x2e\x67\x6c\x6f\x62\x03\x00\x06\x4d\x67\x2e\x67\x65\x74\x00\x00\x04\x67\x6c\x6f\x62\x03\x02\x03\x67\x65\x74\x00\x03\x0b\x4d\x67\x2e\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x01\x0a\x4d\x67\x2e\x67\x65\x74\x5f\x6d\x75\x74\x00\x01\x0a\x4d\x67\x2e\x73\x65\x74\x5f\x6d\x75\x74\x00\x02\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x23\x02\x0b");
let $Ng = $5;
// linking.wast:67
assert_return(() => get($Mg, "glob"), 42);
// linking.wast:68
assert_return(() => get($Ng, "Mg.glob"), 42);
// linking.wast:69
assert_return(() => get($Ng, "glob"), 43);
// linking.wast:70
assert_return(() => call($Mg, "get", []), 42);
// linking.wast:71
assert_return(() => call($Ng, "Mg.get", []), 42);
// linking.wast:72
assert_return(() => call($Ng, "get", []), 43);
// linking.wast:74
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x91\x80\x80\x80\x00\x01\x03\x24\x4d\x67\x08\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x7f\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x00\x0a\x98\x80\x80\x80\x00\x01\x92\x80\x80\x80\x00\x00\x02\x40\x23\x00\x01\x41\x8e\x01\x01\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$Mg", $Mg)), "run", [])); // assert_return(() => get($Mg, "mut_glob"), 142)
// linking.wast:75
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x94\x80\x80\x80\x00\x01\x03\x24\x4e\x67\x0b\x4d\x67\x2e\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x7f\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x00\x0a\x98\x80\x80\x80\x00\x01\x92\x80\x80\x80\x00\x00\x02\x40\x23\x00\x01\x41\x8e\x01\x01\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$Ng", $Ng)), "run", [])); // assert_return(() => get($Ng, "Mg.mut_glob"), 142)
// linking.wast:76
assert_return(() => call($Mg, "get_mut", []), 142);
// linking.wast:77
assert_return(() => call($Ng, "Mg.get_mut", []), 142);
// linking.wast:79
assert_return(() => call($Mg, "set_mut", [241]));
// linking.wast:80
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x91\x80\x80\x80\x00\x01\x03\x24\x4d\x67\x08\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x7f\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x00\x0a\x98\x80\x80\x80\x00\x01\x92\x80\x80\x80\x00\x00\x02\x40\x23\x00\x01\x41\xf1\x01\x01\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$Mg", $Mg)), "run", [])); // assert_return(() => get($Mg, "mut_glob"), 241)
// linking.wast:81
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x94\x80\x80\x80\x00\x01\x03\x24\x4e\x67\x0b\x4d\x67\x2e\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x7f\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x00\x0a\x98\x80\x80\x80\x00\x01\x92\x80\x80\x80\x00\x00\x02\x40\x23\x00\x01\x41\xf1\x01\x01\x46\x45\x0d\x00\x0f\x0b\x00\x0b", exports("$Ng", $Ng)), "run", [])); // assert_return(() => get($Ng, "Mg.mut_glob"), 241)
// linking.wast:82
assert_return(() => call($Mg, "get_mut", []), 241);
// linking.wast:83
assert_return(() => call($Ng, "Mg.get_mut", []), 241);
// linking.wast:86
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x90\x80\x80\x80\x00\x01\x02\x4d\x67\x08\x6d\x75\x74\x5f\x67\x6c\x6f\x62\x03\x7f\x00");
// linking.wast:90
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x67\x04\x67\x6c\x6f\x62\x03\x7f\x01");
// linking.wast:97
let $6 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8d\x80\x80\x80\x00\x03\x60\x00\x01\x7f\x60\x00\x00\x60\x01\x7f\x01\x7f\x03\x84\x80\x80\x80\x00\x03\x00\x00\x02\x04\x84\x80\x80\x80\x00\x01\x70\x00\x0a\x07\x92\x80\x80\x80\x00\x03\x03\x74\x61\x62\x01\x00\x01\x68\x00\x01\x04\x63\x61\x6c\x6c\x00\x02\x09\x8a\x80\x80\x80\x00\x01\x00\x41\x02\x0b\x04\x00\x00\x00\x00\x0a\x9f\x80\x80\x80\x00\x03\x84\x80\x80\x80\x00\x00\x41\x04\x0b\x84\x80\x80\x80\x00\x00\x41\x7c\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x11\x00\x00\x0b");
let $Mt = $6;
// linking.wast:110
register("Mt", $Mt)
// linking.wast:112
let $7 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8d\x80\x80\x80\x00\x03\x60\x00\x00\x60\x00\x01\x7f\x60\x01\x7f\x01\x7f\x02\x92\x80\x80\x80\x00\x02\x02\x4d\x74\x04\x63\x61\x6c\x6c\x00\x02\x02\x4d\x74\x01\x68\x00\x01\x03\x84\x80\x80\x80\x00\x03\x01\x02\x02\x04\x85\x80\x80\x80\x00\x01\x70\x01\x05\x05\x07\xa1\x80\x80\x80\x00\x03\x07\x4d\x74\x2e\x63\x61\x6c\x6c\x00\x00\x0c\x63\x61\x6c\x6c\x20\x4d\x74\x2e\x63\x61\x6c\x6c\x00\x03\x04\x63\x61\x6c\x6c\x00\x04\x09\x8b\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x05\x02\x02\x02\x01\x00\x0a\xa1\x80\x80\x80\x00\x03\x84\x80\x80\x80\x00\x00\x41\x05\x0b\x86\x80\x80\x80\x00\x00\x20\x00\x10\x00\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x11\x01\x00\x0b");
let $Nt = $7;
// linking.wast:131
assert_return(() => call($Mt, "call", [2]), 4);
// linking.wast:132
assert_return(() => call($Nt, "Mt.call", [2]), 4);
// linking.wast:133
assert_return(() => call($Nt, "call", [2]), 5);
// linking.wast:134
assert_return(() => call($Nt, "call Mt.call", [2]), 4);
// linking.wast:136
assert_trap(() => call($Mt, "call", [1]));
// linking.wast:137
assert_trap(() => call($Nt, "Mt.call", [1]));
// linking.wast:138
assert_return(() => call($Nt, "call", [1]), 5);
// linking.wast:139
assert_trap(() => call($Nt, "call Mt.call", [1]));
// linking.wast:141
assert_trap(() => call($Mt, "call", [0]));
// linking.wast:142
assert_trap(() => call($Nt, "Mt.call", [0]));
// linking.wast:143
assert_return(() => call($Nt, "call", [0]), 5);
// linking.wast:144
assert_trap(() => call($Nt, "call Mt.call", [0]));
// linking.wast:146
assert_trap(() => call($Mt, "call", [20]));
// linking.wast:147
assert_trap(() => call($Nt, "Mt.call", [20]));
// linking.wast:148
assert_trap(() => call($Nt, "call", [7]));
// linking.wast:149
assert_trap(() => call($Nt, "call Mt.call", [20]));
// linking.wast:151
assert_return(() => call($Nt, "call", [3]), -4);
// linking.wast:152
assert_trap(() => call($Nt, "call", [4]));
// linking.wast:154
let $8 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x8a\x80\x80\x80\x00\x02\x60\x00\x01\x7f\x60\x01\x7f\x01\x7f\x02\x93\x80\x80\x80\x00\x02\x02\x4d\x74\x01\x68\x00\x00\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x05\x03\x83\x80\x80\x80\x00\x02\x00\x01\x07\x88\x80\x80\x80\x00\x01\x04\x63\x61\x6c\x6c\x00\x02\x09\x88\x80\x80\x80\x00\x01\x00\x41\x01\x0b\x02\x01\x00\x0a\x96\x80\x80\x80\x00\x02\x84\x80\x80\x80\x00\x00\x41\x06\x0b\x87\x80\x80\x80\x00\x00\x20\x00\x11\x00\x00\x0b");
let $Ot = $8;
// linking.wast:167
assert_return(() => call($Mt, "call", [3]), 4);
// linking.wast:168
assert_return(() => call($Nt, "Mt.call", [3]), 4);
// linking.wast:169
assert_return(() => call($Nt, "call Mt.call", [3]), 4);
// linking.wast:170
assert_return(() => call($Ot, "call", [3]), 4);
// linking.wast:172
assert_return(() => call($Mt, "call", [2]), -4);
// linking.wast:173
assert_return(() => call($Nt, "Mt.call", [2]), -4);
// linking.wast:174
assert_return(() => call($Nt, "call", [2]), 5);
// linking.wast:175
assert_return(() => call($Nt, "call Mt.call", [2]), -4);
// linking.wast:176
assert_return(() => call($Ot, "call", [2]), -4);
// linking.wast:178
assert_return(() => call($Mt, "call", [1]), 6);
// linking.wast:179
assert_return(() => call($Nt, "Mt.call", [1]), 6);
// linking.wast:180
assert_return(() => call($Nt, "call", [1]), 5);
// linking.wast:181
assert_return(() => call($Nt, "call Mt.call", [1]), 6);
// linking.wast:182
assert_return(() => call($Ot, "call", [1]), 6);
// linking.wast:184
assert_trap(() => call($Mt, "call", [0]));
// linking.wast:185
assert_trap(() => call($Nt, "Mt.call", [0]));
// linking.wast:186
assert_return(() => call($Nt, "call", [0]), 5);
// linking.wast:187
assert_trap(() => call($Nt, "call Mt.call", [0]));
// linking.wast:188
assert_trap(() => call($Ot, "call", [0]));
// linking.wast:190
assert_trap(() => call($Ot, "call", [20]));
// linking.wast:192
let $9 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x09\x87\x80\x80\x80\x00\x01\x00\x41\x09\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b");
// linking.wast:198
let $10 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x06\x86\x80\x80\x80\x00\x01\x7f\x00\x41\x05\x0b\x07\x85\x80\x80\x80\x00\x01\x01\x67\x03\x00");
let $G1 = $10;
// linking.wast:199
register("G1", $G1)
// linking.wast:200
let $11 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x89\x80\x80\x80\x00\x01\x02\x47\x31\x01\x67\x03\x7f\x00\x06\x86\x80\x80\x80\x00\x01\x7f\x00\x23\x00\x0b\x07\x85\x80\x80\x80\x00\x01\x01\x67\x03\x01");
let $G2 = $11;
// linking.wast:204
assert_return(() => get($G2, "g"), 5);
// linking.wast:206
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x09\x87\x80\x80\x80\x00\x01\x00\x41\x0a\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b");
// linking.wast:215
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\x96\x80\x80\x80\x00\x02\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x0a\x02\x4d\x74\x03\x6d\x65\x6d\x02\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x09\x8d\x80\x80\x80\x00\x02\x00\x41\x07\x0b\x01\x00\x00\x41\x09\x0b\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x41\x00\x0b");
// linking.wast:225
assert_trap(() => call($Mt, "call", [7]));
// linking.wast:227
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x0a\x03\x82\x80\x80\x80\x00\x01\x00\x09\x8d\x80\x80\x80\x00\x02\x00\x41\x07\x0b\x01\x00\x00\x41\x0c\x0b\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x41\x00\x0b");
// linking.wast:236
assert_trap(() => call($Mt, "call", [7]));
// linking.wast:238
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x85\x80\x80\x80\x00\x01\x60\x00\x01\x7f\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x74\x03\x74\x61\x62\x01\x70\x00\x0a\x03\x82\x80\x80\x80\x00\x01\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x09\x87\x80\x80\x80\x00\x01\x00\x41\x07\x0b\x01\x00\x0a\x8a\x80\x80\x80\x00\x01\x84\x80\x80\x80\x00\x00\x41\x00\x0b\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x80\x80\x04\x0b\x01\x64");
// linking.wast:248
assert_trap(() => call($Mt, "call", [7]));
// linking.wast:253
let $12 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x03\x82\x80\x80\x80\x00\x01\x00\x05\x84\x80\x80\x80\x00\x01\x01\x01\x05\x07\x8e\x80\x80\x80\x00\x02\x03\x6d\x65\x6d\x02\x00\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x0b\x90\x80\x80\x80\x00\x01\x00\x41\x0a\x0b\x0a\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09");
let $Mm = $12;
// linking.wast:261
register("Mm", $Mm)
// linking.wast:263
let $13 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x8b\x80\x80\x80\x00\x01\x02\x4d\x6d\x04\x6c\x6f\x61\x64\x00\x00\x03\x82\x80\x80\x80\x00\x01\x00\x05\x83\x80\x80\x80\x00\x01\x00\x01\x07\x92\x80\x80\x80\x00\x02\x07\x4d\x6d\x2e\x6c\x6f\x61\x64\x00\x00\x04\x6c\x6f\x61\x64\x00\x01\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x0b\x8c\x80\x80\x80\x00\x01\x00\x41\x0a\x0b\x06\xf0\xf1\xf2\xf3\xf4\xf5");
let $Nm = $13;
// linking.wast:275
assert_return(() => call($Mm, "load", [12]), 2);
// linking.wast:276
assert_return(() => call($Nm, "Mm.load", [12]), 2);
// linking.wast:277
assert_return(() => call($Nm, "load", [12]), 242);
// linking.wast:279
let $14 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x8b\x80\x80\x80\x00\x01\x02\x4d\x6d\x03\x6d\x65\x6d\x02\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x6c\x6f\x61\x64\x00\x00\x0a\x8d\x80\x80\x80\x00\x01\x87\x80\x80\x80\x00\x00\x20\x00\x2d\x00\x00\x0b\x0b\x8e\x80\x80\x80\x00\x01\x00\x41\x05\x0b\x08\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7");
let $Om = $14;
// linking.wast:288
assert_return(() => call($Mm, "load", [12]), 167);
// linking.wast:289
assert_return(() => call($Nm, "Mm.load", [12]), 167);
// linking.wast:290
assert_return(() => call($Nm, "load", [12]), 242);
// linking.wast:291
assert_return(() => call($Om, "load", [12]), 167);
// linking.wast:293
let $15 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8b\x80\x80\x80\x00\x01\x02\x4d\x6d\x03\x6d\x65\x6d\x02\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x00\x41\xff\xff\x03\x0b\x01\x61");
// linking.wast:298
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8b\x80\x80\x80\x00\x01\x02\x4d\x6d\x03\x6d\x65\x6d\x02\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x80\x80\x04\x0b\x01\x61");
// linking.wast:306
let $16 = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x86\x80\x80\x80\x00\x01\x60\x01\x7f\x01\x7f\x02\x8c\x80\x80\x80\x00\x01\x02\x4d\x6d\x03\x6d\x65\x6d\x02\x01\x01\x08\x03\x82\x80\x80\x80\x00\x01\x00\x07\x88\x80\x80\x80\x00\x01\x04\x67\x72\x6f\x77\x00\x00\x0a\x8c\x80\x80\x80\x00\x01\x86\x80\x80\x80\x00\x00\x20\x00\x40\x00\x0b");
let $Pm = $16;
// linking.wast:314
assert_return(() => call($Pm, "grow", [0]), 1);
// linking.wast:315
assert_return(() => call($Pm, "grow", [2]), 1);
// linking.wast:316
assert_return(() => call($Pm, "grow", [0]), 3);
// linking.wast:317
assert_return(() => call($Pm, "grow", [1]), 3);
// linking.wast:318
assert_return(() => call($Pm, "grow", [1]), 4);
// linking.wast:319
assert_return(() => call($Pm, "grow", [0]), 5);
// linking.wast:320
assert_return(() => call($Pm, "grow", [1]), -1);
// linking.wast:321
assert_return(() => call($Pm, "grow", [0]), 5);
// linking.wast:323
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\xa7\x80\x80\x80\x00\x03\x08\x73\x70\x65\x63\x74\x65\x73\x74\x05\x70\x72\x69\x6e\x74\x00\x00\x02\x4d\x6d\x03\x6d\x65\x6d\x02\x00\x01\x02\x4d\x6d\x03\x74\x61\x62\x01\x70\x00\x00\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x03\x61\x62\x63");
// linking.wast:332
assert_return(() => call($Mm, "load", [0]), 0);
// linking.wast:334
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x02\x8b\x80\x80\x80\x00\x01\x02\x4d\x6d\x03\x6d\x65\x6d\x02\x00\x01\x0b\x91\x80\x80\x80\x00\x02\x00\x41\x00\x0b\x03\x61\x62\x63\x00\x41\x80\x80\x14\x0b\x01\x64");
// linking.wast:342
assert_return(() => call($Mm, "load", [0]), 0);
// linking.wast:344
assert_unlinkable("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x84\x80\x80\x80\x00\x01\x60\x00\x00\x02\x8b\x80\x80\x80\x00\x01\x02\x4d\x6d\x03\x6d\x65\x6d\x02\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x04\x84\x80\x80\x80\x00\x01\x70\x00\x00\x09\x87\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x01\x00\x0a\x88\x80\x80\x80\x00\x01\x82\x80\x80\x80\x00\x00\x0b\x0b\x89\x80\x80\x80\x00\x01\x00\x41\x00\x0b\x03\x61\x62\x63");
// linking.wast:354
assert_return(() => call($Mm, "load", [0]), 0);

View File

@ -678,7 +678,7 @@ InitFromBailout(JSContext* cx, size_t frameNo,
// | ReturnAddr | <-- return into main jitcode after IC
// +===============+
JitSpew(JitSpew_BaselineBailouts, " Unpacking %s:%zu", script->filename(), script->lineno());
JitSpew(JitSpew_BaselineBailouts, " Unpacking %s:%u", script->filename(), script->lineno());
JitSpew(JitSpew_BaselineBailouts, " [BASELINE-JS FRAME]");
// Calculate and write the previous frame pointer value.
@ -1065,7 +1065,7 @@ InitFromBailout(JSContext* cx, size_t frameNo,
#endif
#ifdef JS_JITSPEW
JitSpew(JitSpew_BaselineBailouts, " Resuming %s pc offset %d (op %s) (line %d) of %s:%zu",
JitSpew(JitSpew_BaselineBailouts, " Resuming %s pc offset %d (op %s) (line %d) of %s:%u",
resumeAfter ? "after" : "at", (int) pcOff, CodeName[op],
PCToLineNumber(script, pc), script->filename(), script->lineno());
JitSpew(JitSpew_BaselineBailouts, " Bailout kind: %s",
@ -1241,7 +1241,7 @@ InitFromBailout(JSContext* cx, size_t frameNo,
ReportOutOfMemory(cx);
return false;
}
snprintf(buf, len, "%s %s %s on line %u of %s:%zu",
snprintf(buf, len, "%s %s %s on line %u of %s:%u",
BailoutKindString(bailoutKind),
resumeAfter ? "after" : "at",
CodeName[op],
@ -1565,7 +1565,7 @@ jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation,
// | ||||| |
// +---------------+
JitSpew(JitSpew_BaselineBailouts, "Bailing to baseline %s:%zu (IonScript=%p) (FrameType=%d)",
JitSpew(JitSpew_BaselineBailouts, "Bailing to baseline %s:%u (IonScript=%p) (FrameType=%d)",
iter.script()->filename(), iter.script()->lineno(), (void*) iter.ionScript(),
(int) prevFrameType);
@ -1613,7 +1613,7 @@ jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation,
RootedFunction callee(cx, iter.maybeCallee());
RootedScript scr(cx, iter.script());
if (callee) {
JitSpew(JitSpew_BaselineBailouts, " Callee function (%s:%zu)",
JitSpew(JitSpew_BaselineBailouts, " Callee function (%s:%u)",
scr->filename(), scr->lineno());
} else {
JitSpew(JitSpew_BaselineBailouts, " No callee!");
@ -1739,7 +1739,7 @@ InvalidateAfterBailout(JSContext* cx, HandleScript outerScript, const char* reas
static void
HandleBoundsCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
{
JitSpew(JitSpew_IonBailouts, "Bounds check failure %s:%zu, inlined into %s:%zu",
JitSpew(JitSpew_IonBailouts, "Bounds check failure %s:%u, inlined into %s:%u",
innerScript->filename(), innerScript->lineno(),
outerScript->filename(), outerScript->lineno());
@ -1754,7 +1754,7 @@ HandleBoundsCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript i
static void
HandleShapeGuardFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
{
JitSpew(JitSpew_IonBailouts, "Shape guard failure %s:%zu, inlined into %s:%zu",
JitSpew(JitSpew_IonBailouts, "Shape guard failure %s:%u, inlined into %s:%u",
innerScript->filename(), innerScript->lineno(),
outerScript->filename(), outerScript->lineno());
@ -1769,7 +1769,7 @@ HandleShapeGuardFailure(JSContext* cx, HandleScript outerScript, HandleScript in
static void
HandleBaselineInfoBailout(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
{
JitSpew(JitSpew_IonBailouts, "Baseline info failure %s:%zu, inlined into %s:%zu",
JitSpew(JitSpew_IonBailouts, "Baseline info failure %s:%u, inlined into %s:%u",
innerScript->filename(), innerScript->lineno(),
outerScript->filename(), outerScript->lineno());
@ -1779,7 +1779,7 @@ HandleBaselineInfoBailout(JSContext* cx, HandleScript outerScript, HandleScript
static void
HandleLexicalCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
{
JitSpew(JitSpew_IonBailouts, "Lexical check failure %s:%zu, inlined into %s:%zu",
JitSpew(JitSpew_IonBailouts, "Lexical check failure %s:%u, inlined into %s:%u",
innerScript->filename(), innerScript->lineno(),
outerScript->filename(), outerScript->lineno());
@ -1982,7 +1982,7 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo)
}
JitSpew(JitSpew_BaselineBailouts,
" Restored outerScript=(%s:%zu,%u) innerScript=(%s:%zu,%u) (bailoutKind=%u)",
" Restored outerScript=(%s:%u,%u) innerScript=(%s:%u,%u) (bailoutKind=%u)",
outerScript->filename(), outerScript->lineno(), outerScript->getWarmUpCount(),
innerScript->filename(), innerScript->lineno(), innerScript->getWarmUpCount(),
(unsigned) bailoutKind);

View File

@ -86,10 +86,10 @@ BaselineCompiler::addPCMappingEntry(bool addIndexEntry)
MethodStatus
BaselineCompiler::compile()
{
JitSpew(JitSpew_BaselineScripts, "Baseline compiling script %s:%zu (%p)",
JitSpew(JitSpew_BaselineScripts, "Baseline compiling script %s:%u (%p)",
script->filename(), script->lineno(), script);
JitSpew(JitSpew_Codegen, "# Emitting baseline code for script %s:%zu",
JitSpew(JitSpew_Codegen, "# Emitting baseline code for script %s:%u",
script->filename(), script->lineno());
TraceLoggerThread* logger = TraceLoggerForCurrentThread(cx);
@ -222,7 +222,7 @@ BaselineCompiler::compile()
baselineScript->setMethod(code);
baselineScript->setTemplateEnvironment(templateEnv);
JitSpew(JitSpew_BaselineScripts, "Created BaselineScript %p (raw %p) for %s:%zu",
JitSpew(JitSpew_BaselineScripts, "Created BaselineScript %p (raw %p) for %s:%u",
(void*) baselineScript.get(), (void*) code->raw(),
script->filename(), script->lineno());
@ -278,7 +278,7 @@ BaselineCompiler::compile()
// Always register a native => bytecode mapping entry, since profiler can be
// turned on with baseline jitcode on stack, and baseline jitcode cannot be invalidated.
{
JitSpew(JitSpew_Profiling, "Added JitcodeGlobalEntry for baseline script %s:%zu (%p)",
JitSpew(JitSpew_Profiling, "Added JitcodeGlobalEntry for baseline script %s:%u (%p)",
script->filename(), script->lineno(), baselineScript.get());
// Generate profiling string.

View File

@ -320,7 +320,7 @@ SpewPatchBaselineFrame(uint8_t* oldReturnAddress, uint8_t* newReturnAddress,
JSScript* script, ICEntry::Kind frameKind, jsbytecode* pc)
{
JitSpew(JitSpew_BaselineDebugModeOSR,
"Patch return %p -> %p on BaselineJS frame (%s:%zu) from %s at %s",
"Patch return %p -> %p on BaselineJS frame (%s:%u) from %s at %s",
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
ICEntryKindToString(frameKind), CodeName[(JSOp)*pc]);
}
@ -330,7 +330,7 @@ SpewPatchBaselineFrameFromExceptionHandler(uint8_t* oldReturnAddress, uint8_t* n
JSScript* script, jsbytecode* pc)
{
JitSpew(JitSpew_BaselineDebugModeOSR,
"Patch return %p -> %p on BaselineJS frame (%s:%zu) from exception handler at %s",
"Patch return %p -> %p on BaselineJS frame (%s:%u) from exception handler at %s",
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
CodeName[(JSOp)*pc]);
}
@ -667,7 +667,7 @@ RecompileBaselineScriptForDebugMode(JSContext* cx, JSScript* script,
if (oldBaselineScript->hasDebugInstrumentation() == observing)
return true;
JitSpew(JitSpew_BaselineDebugModeOSR, "Recompiling (%s:%zu) for %s",
JitSpew(JitSpew_BaselineDebugModeOSR, "Recompiling (%s:%u) for %s",
script->filename(), script->lineno(), observing ? "DEBUGGING" : "NORMAL EXECUTION");
AutoKeepTypeScripts keepTypes(cx);

View File

@ -2105,7 +2105,7 @@ TryAttachCallStub(JSContext* cx, ICCall_Fallback* stub, HandleScript script, jsb
fun->native(), constructing ? "yes" : "no", isSpread ? "yes" : "no");
} else {
JitSpew(JitSpew_BaselineIC,
" Generating Call_Scripted stub (fun=%p, %s:%zu, cons=%s, spread=%s)",
" Generating Call_Scripted stub (fun=%p, %s:%u, cons=%s, spread=%s)",
fun.get(), fun->nonLazyScript()->filename(), fun->nonLazyScript()->lineno(),
constructing ? "yes" : "no", isSpread ? "yes" : "no");
}

View File

@ -27,8 +27,8 @@ C1Spewer::beginFunction(MIRGraph* graph, JSScript* script)
out_.printf("begin_compilation\n");
if (script) {
out_.printf(" name \"%s:%zu\"\n", script->filename(), script->lineno());
out_.printf(" method \"%s:%zu\"\n", script->filename(), script->lineno());
out_.printf(" name \"%s:%u\"\n", script->filename(), script->lineno());
out_.printf(" method \"%s:%u\"\n", script->filename(), script->lineno());
} else {
out_.printf(" name \"wasm compilation\"\n");
out_.printf(" method \"wasm compilation\"\n");

View File

@ -5357,7 +5357,7 @@ CodeGenerator::maybeCreateScriptCounts()
JSScript* innerScript = block->info().script();
description = (char*) js_calloc(200);
if (description) {
snprintf(description, 200, "%s:%zu",
snprintf(description, 200, "%s:%u",
innerScript->filename(), innerScript->lineno());
}
}
@ -10145,7 +10145,7 @@ CodeGenerator::generateWasm(wasm::SigIdDesc sigId, wasm::BytecodeOffset trapOffs
bool
CodeGenerator::generate()
{
JitSpew(JitSpew_Codegen, "# Emitting code for script %s:%zu",
JitSpew(JitSpew_Codegen, "# Emitting code for script %s:%u",
gen->info().script()->filename(),
gen->info().script()->lineno());

View File

@ -632,7 +632,7 @@ void
JitRealm::sweep(JS::Realm* realm)
{
// Any outstanding compilations should have been cancelled by the GC.
MOZ_ASSERT(!HasOffThreadIonCompile(JS::GetCompartmentForRealm(realm)));
MOZ_ASSERT(!HasOffThreadIonCompile(realm));
stubCodes_->sweep();
@ -2159,7 +2159,7 @@ IonCompile(JSContext* cx, JSScript* script,
// If possible, compile the script off thread.
if (options.offThreadCompilationAvailable()) {
JitSpew(JitSpew_IonSyncLogs, "Can't log script %s:%zu"
JitSpew(JitSpew_IonSyncLogs, "Can't log script %s:%u"
". (Compiled on background thread.)",
builderScript->filename(), builderScript->lineno());
@ -2355,7 +2355,7 @@ Compile(JSContext* cx, HandleScript script, BaselineFrame* osrFrame, jsbytecode*
}
if (!CanIonCompileScript(cx, script)) {
JitSpew(JitSpew_IonAbort, "Aborted compilation of %s:%zu", script->filename(), script->lineno());
JitSpew(JitSpew_IonAbort, "Aborted compilation of %s:%u", script->filename(), script->lineno());
return Method_CantCompile;
}
@ -2625,7 +2625,7 @@ jit::IonCompileScriptForBaseline(JSContext* cx, BaselineFrame* frame, jsbytecode
// Ensure that Ion-compiled code is available.
JitSpew(JitSpew_BaselineOSR,
"WarmUpCounter for %s:%zu reached %d at pc %p, trying to switch to Ion!",
"WarmUpCounter for %s:%u reached %d at pc %p, trying to switch to Ion!",
script->filename(), script->lineno(), (int) script->getWarmUpCount(), (void*) pc);
MethodStatus stat;
@ -2729,7 +2729,7 @@ InvalidateActivation(FreeOp* fop, const JitActivationIterator& activations, bool
else if (frame.isBailoutJS())
type = "Bailing";
JitSpew(JitSpew_IonInvalidate,
"#%zu %s JS frame @ %p, %s:%zu (fun: %p, script: %p, pc %p)",
"#%zu %s JS frame @ %p, %s:%u (fun: %p, script: %p, pc %p)",
frameno, type, frame.fp(), frame.script()->maybeForwardedFilename(),
frame.script()->lineno(), frame.maybeCallee(), (JSScript*)frame.script(),
frame.returnAddressToFp());
@ -2843,8 +2843,8 @@ jit::InvalidateAll(FreeOp* fop, Zone* zone)
{
// The caller should previously have cancelled off thread compilation.
#ifdef DEBUG
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
MOZ_ASSERT(!HasOffThreadIonCompile(comp));
for (RealmsInZoneIter realm(zone); !realm.done(); realm.next())
MOZ_ASSERT(!HasOffThreadIonCompile(realm));
#endif
if (zone->isAtomsZone())
return;
@ -2887,7 +2887,7 @@ jit::Invalidate(TypeZone& types, FreeOp* fop,
if (!ionScript)
continue;
JitSpew(JitSpew_IonInvalidate, " Invalidate %s:%zu, IonScript %p",
JitSpew(JitSpew_IonInvalidate, " Invalidate %s:%u, IonScript %p",
info.script()->filename(), info.script()->lineno(), ionScript);
// Keep the ion script alive during the invalidation and flag this
@ -2979,7 +2979,7 @@ jit::Invalidate(JSContext* cx, JSScript* script, bool resetUses, bool cancelOffT
filename = "<unknown>";
// Construct the descriptive string.
UniqueChars buf = JS_smprintf("Invalidate %s:%zu", filename, script->lineno());
UniqueChars buf = JS_smprintf("Invalidate %s:%u", filename, script->lineno());
// Ignore the event on allocation failure.
if (buf) {
@ -3015,7 +3015,7 @@ jit::FinishInvalidation(FreeOp* fop, JSScript* script)
void
jit::ForbidCompilation(JSContext* cx, JSScript* script)
{
JitSpew(JitSpew_IonAbort, "Disabling Ion compilation of script %s:%zu",
JitSpew(JitSpew_IonAbort, "Disabling Ion compilation of script %s:%u",
script->filename(), script->lineno());
CancelOffThreadIonCompile(script);

View File

@ -325,7 +325,7 @@ IonBuilder::InliningDecision
IonBuilder::DontInline(JSScript* targetScript, const char* reason)
{
if (targetScript) {
JitSpew(JitSpew_Inlining, "Cannot inline %s:%zu: %s",
JitSpew(JitSpew_Inlining, "Cannot inline %s:%u: %s",
targetScript->filename(), targetScript->lineno(), reason);
} else {
JitSpew(JitSpew_Inlining, "Cannot inline: %s", reason);
@ -751,11 +751,11 @@ IonBuilder::build()
#ifdef JS_JITSPEW
if (info().isAnalysis()) {
JitSpew(JitSpew_IonScripts, "Analyzing script %s:%zu (%p) %s",
JitSpew(JitSpew_IonScripts, "Analyzing script %s:%u (%p) %s",
script()->filename(), script()->lineno(), (void*)script(),
AnalysisModeString(info().analysisMode()));
} else {
JitSpew(JitSpew_IonScripts, "%sompiling script %s:%zu (%p) (warmup-counter=%" PRIu32 ", level=%s)",
JitSpew(JitSpew_IonScripts, "%sompiling script %s:%u (%p) (warmup-counter=%" PRIu32 ", level=%s)",
(script()->hasIonScript() ? "Rec" : "C"),
script()->filename(), script()->lineno(), (void*)script(),
script()->getWarmUpCount(), OptimizationLevelString(optimizationInfo().level()));
@ -925,7 +925,7 @@ IonBuilder::buildInline(IonBuilder* callerBuilder, MResumePoint* callerResumePoi
MOZ_TRY(init());
JitSpew(JitSpew_IonScripts, "Inlining script %s:%zu (%p)",
JitSpew(JitSpew_IonScripts, "Inlining script %s:%u (%p)",
script()->filename(), script()->lineno(), (void*)script());
callerBuilder_ = callerBuilder;
@ -1214,7 +1214,7 @@ IonBuilder::initEnvironmentChain(MDefinition* callee)
void
IonBuilder::initArgumentsObject()
{
JitSpew(JitSpew_IonMIR, "%s:%zu - Emitting code to initialize arguments object! block=%p",
JitSpew(JitSpew_IonMIR, "%s:%u - Emitting code to initialize arguments object! block=%p",
script()->filename(), script()->lineno(), current);
MOZ_ASSERT(info().needsArgsObj());
@ -1426,7 +1426,7 @@ GetOrCreateControlFlowGraph(TempAllocator& tempAlloc, JSScript* script,
}
if (JitSpewEnabled(JitSpew_CFG)) {
JitSpew(JitSpew_CFG, "Generating graph for %s:%zu",
JitSpew(JitSpew_CFG, "Generating graph for %s:%u",
script->filename(), script->lineno());
Fprinter& print = JitSpewPrinter();
cfg->dump(print, script);
@ -4028,7 +4028,7 @@ IonBuilder::makeInliningDecision(JSObject* targetArg, CallInfo& callInfo)
info().analysisMode() != Analysis_DefiniteProperties)
{
trackOptimizationOutcome(TrackedOutcome::CantInlineNotHot);
JitSpew(JitSpew_Inlining, "Cannot inline %s:%zu: callee is insufficiently hot.",
JitSpew(JitSpew_Inlining, "Cannot inline %s:%u: callee is insufficiently hot.",
targetScript->filename(), targetScript->lineno());
return InliningDecision_WarmUpCountTooLow;
}

View File

@ -158,7 +158,7 @@ IonGetPropertyIC::update(JSContext* cx, HandleScript outerScript, IonGetProperty
// 2) There's no need to dynamically monitor the return type. This would
// be complicated since (due to GVN) there can be multiple pc's
// associated with a single idempotent cache.
JitSpew(JitSpew_IonIC, "Invalidating from idempotent cache %s:%zu",
JitSpew(JitSpew_IonIC, "Invalidating from idempotent cache %s:%u",
outerScript->filename(), outerScript->lineno());
outerScript->setInvalidatedIdempotentCache();

View File

@ -314,7 +314,7 @@ JSJitFrameIter::dumpBaseline() const
fprintf(stderr, " global frame, no callee\n");
}
fprintf(stderr, " file %s line %zu\n",
fprintf(stderr, " file %s line %u\n",
script()->filename(), script()->lineno());
JSContext* cx = TlsContext.get();
@ -431,7 +431,7 @@ JSJitFrameIter::verifyReturnAddressUsingNativeToBytecodeMap()
JitSpew(JitSpew_Profiling, "Found bytecode location of depth %d:", depth);
for (size_t i = 0; i < location.length(); i++) {
JitSpew(JitSpew_Profiling, " %s:%zu - %zu",
JitSpew(JitSpew_Profiling, " %s:%u - %zu",
location[i].script->filename(), location[i].script->lineno(),
size_t(location[i].pc - location[i].script->code()));
}
@ -444,7 +444,7 @@ JSJitFrameIter::verifyReturnAddressUsingNativeToBytecodeMap()
MOZ_ASSERT_IF(idx < location.length() - 1, inlineFrames.more());
JitSpew(JitSpew_Profiling,
"Match %d: ION %s:%zu(%zu) vs N2B %s:%zu(%zu)",
"Match %d: ION %s:%u(%zu) vs N2B %s:%u(%zu)",
(int)idx,
inlineFrames.script()->filename(),
inlineFrames.script()->lineno(),

View File

@ -25,7 +25,7 @@ JSONSpewer::beginFunction(JSScript* script)
{
beginObject();
if (script)
formatProperty("name", "%s:%zu", script->filename(), script->lineno());
formatProperty("name", "%s:%u", script->filename(), script->lineno());
else
property("name", "wasm compilation");
beginListProperty("passes");

View File

@ -221,6 +221,10 @@ HandleExceptionIon(JSContext* cx, const InlineFrameIterator& frame, ResumeFromEx
switch (tn->kind) {
case JSTRY_FOR_IN:
case JSTRY_DESTRUCTURING_ITERCLOSE:
// See corresponding comment in ProcessTryNotes.
if (inForOfIterClose)
break;
MOZ_ASSERT_IF(tn->kind == JSTRY_FOR_IN,
JSOp(*(script->main() + tn->start + tn->length)) == JSOP_ENDITER);
CloseLiveIteratorIon(cx, frame, tn);
@ -360,16 +364,34 @@ static void
CloseLiveIteratorsBaselineForUncatchableException(JSContext* cx, const JSJitFrameIter& frame,
jsbytecode* pc)
{
bool inForOfIterClose = false;
for (TryNoteIterBaseline tni(cx, frame.baselineFrame(), pc); !tni.done(); ++tni) {
JSTryNote* tn = *tni;
switch (tn->kind) {
case JSTRY_FOR_IN: {
// See corresponding comment in ProcessTryNotes.
if (inForOfIterClose)
break;
if (tn->kind == JSTRY_FOR_IN) {
uint8_t* framePointer;
uint8_t* stackPointer;
BaselineFrameAndStackPointersFromTryNote(tn, frame, &framePointer, &stackPointer);
Value iterValue(*(Value*) stackPointer);
RootedObject iterObject(cx, &iterValue.toObject());
UnwindIteratorForUncatchableException(iterObject);
break;
}
case JSTRY_FOR_OF_ITERCLOSE:
inForOfIterClose = true;
break;
case JSTRY_FOR_OF:
inForOfIterClose = false;
break;
default:
break;
}
}
}
@ -425,6 +447,10 @@ ProcessTryNotesBaseline(JSContext* cx, const JSJitFrameIter& frame, EnvironmentI
}
case JSTRY_FOR_IN: {
// See corresponding comment in ProcessTryNotes.
if (inForOfIterClose)
break;
uint8_t* framePointer;
uint8_t* stackPointer;
BaselineFrameAndStackPointersFromTryNote(tn, frame, &framePointer, &stackPointer);
@ -435,6 +461,10 @@ ProcessTryNotesBaseline(JSContext* cx, const JSJitFrameIter& frame, EnvironmentI
}
case JSTRY_DESTRUCTURING_ITERCLOSE: {
// See corresponding comment in ProcessTryNotes.
if (inForOfIterClose)
break;
uint8_t* framePointer;
uint8_t* stackPointer;
BaselineFrameAndStackPointersFromTryNote(tn, frame, &framePointer, &stackPointer);
@ -2324,7 +2354,7 @@ InlineFrameIterator::dump() const
fprintf(stderr, " global frame, no callee\n");
}
fprintf(stderr, " file %s line %zu\n",
fprintf(stderr, " file %s line %u\n",
script()->filename(), script()->lineno());
fprintf(stderr, " script = %p, pc = %p\n", (void*) script(), pc());

View File

@ -328,7 +328,7 @@ JitcodeGlobalEntry::createScriptString(JSContext* cx, JSScript* script, size_t*
size_t linenoLength = 0;
char linenoStr[15];
if (hasName || (script->functionNonDelazifying() || script->isForEval())) {
linenoLength = SprintfLiteral(linenoStr, "%zu", script->lineno());
linenoLength = SprintfLiteral(linenoStr, "%u", script->lineno());
hasLineno = true;
}
@ -1547,13 +1547,13 @@ JitcodeIonTable::WriteIonTable(CompactBufferWriter& writer,
MOZ_ASSERT(writer.length() == 0);
MOZ_ASSERT(scriptListSize > 0);
JitSpew(JitSpew_Profiling, "Writing native to bytecode map for %s:%zu (%zu entries)",
JitSpew(JitSpew_Profiling, "Writing native to bytecode map for %s:%u (%zu entries)",
scriptList[0]->filename(), scriptList[0]->lineno(),
mozilla::PointerRangeSize(start, end));
JitSpew(JitSpew_Profiling, " ScriptList of size %d", int(scriptListSize));
for (uint32_t i = 0; i < scriptListSize; i++) {
JitSpew(JitSpew_Profiling, " Script %d - %s:%zu",
JitSpew(JitSpew_Profiling, " Script %d - %s:%u",
int(i), scriptList[i]->filename(), scriptList[i]->lineno());
}

View File

@ -1166,7 +1166,7 @@ MConstant::printOpcode(GenericPrinter& out) const
}
if (fun->hasScript()) {
JSScript* script = fun->nonLazyScript();
out.printf(" (%s:%zu)",
out.printf(" (%s:%u)",
script->filename() ? script->filename() : "", script->lineno());
}
out.printf(" at %p", (void*) fun);

View File

@ -172,7 +172,7 @@ RematerializedFrame::dump()
fprintf(stderr, " global frame, no callee\n");
}
fprintf(stderr, " file %s line %zu offset %zu\n",
fprintf(stderr, " file %s line %u offset %zu\n",
script()->filename(), script()->lineno(),
script()->pcToOffset(pc()));

View File

@ -51,7 +51,7 @@ FallbackICSpew(JSContext* cx, ICFallbackStub* stub, const char* fmt, ...)
va_end(args);
JitSpew(JitSpew_BaselineICFallback,
"Fallback hit for (%s:%zu) (pc=%zu,line=%d,uses=%d,stubs=%zu): %s",
"Fallback hit for (%s:%u) (pc=%zu,line=%d,uses=%d,stubs=%zu): %s",
script->filename(),
script->lineno(),
script->pcToOffset(pc),
@ -76,7 +76,7 @@ TypeFallbackICSpew(JSContext* cx, ICTypeMonitor_Fallback* stub, const char* fmt,
va_end(args);
JitSpew(JitSpew_BaselineICFallback,
"Type monitor fallback hit for (%s:%zu) (pc=%zu,line=%d,uses=%d,stubs=%d): %s",
"Type monitor fallback hit for (%s:%u) (pc=%zu,line=%d,uses=%d,stubs=%d): %s",
script->filename(),
script->lineno(),
script->pcToOffset(pc),

View File

@ -284,7 +284,7 @@ CodeGeneratorShared::dumpNativeToBytecodeEntries()
{
#ifdef JS_JITSPEW
InlineScriptTree* topTree = gen->info().inlineScriptTree();
JitSpewStart(JitSpew_Profiling, "Native To Bytecode Entries for %s:%zu\n",
JitSpewStart(JitSpew_Profiling, "Native To Bytecode Entries for %s:%u\n",
topTree->script()->filename(), topTree->script()->lineno());
for (unsigned i = 0; i < nativeToBytecodeList_.length(); i++)
dumpNativeToBytecodeEntry(i);
@ -307,7 +307,7 @@ CodeGeneratorShared::dumpNativeToBytecodeEntry(uint32_t idx)
if (nextRef->tree == ref.tree)
pcDelta = nextRef->pc - ref.pc;
}
JitSpewStart(JitSpew_Profiling, " %08zx [+%-6d] => %-6ld [%-4d] {%-10s} (%s:%zu",
JitSpewStart(JitSpew_Profiling, " %08zx [+%-6d] => %-6ld [%-4d] {%-10s} (%s:%u",
ref.nativeOffset.offset(),
nativeDelta,
(long) (ref.pc - script->code()),
@ -316,7 +316,7 @@ CodeGeneratorShared::dumpNativeToBytecodeEntry(uint32_t idx)
script->filename(), script->lineno());
for (tree = tree->caller(); tree; tree = tree->caller()) {
JitSpewCont(JitSpew_Profiling, " <= %s:%zu", tree->script()->filename(),
JitSpewCont(JitSpew_Profiling, " <= %s:%u", tree->script()->filename(),
tree->script()->lineno());
}
JitSpewCont(JitSpew_Profiling, ")");

View File

@ -674,7 +674,7 @@ JS_SetExternalStringSizeofCallback(JSContext* cx, JSExternalStringSizeofCallback
cx->runtime()->externalStringSizeofCallback = callback;
}
JS_PUBLIC_API(JSCompartment*)
JS_PUBLIC_API(Realm*)
JS::EnterRealm(JSContext* cx, JSObject* target)
{
AssertHeapIsIdle();
@ -682,7 +682,7 @@ JS::EnterRealm(JSContext* cx, JSObject* target)
Realm* oldRealm = cx->realm();
cx->enterRealmOf(target);
return JS::GetCompartmentForRealm(oldRealm);
return oldRealm;
}
JS_PUBLIC_API(void)
@ -890,7 +890,7 @@ JS_TransplantObject(JSContext* cx, HandleObject origobj, HandleObject target)
// destination, then we know that we won't find a wrapper in the
// destination's cross compartment map and that the same
// object will continue to work.
AutoRealmUnchecked ar(cx, origobj->compartment());
AutoRealmUnchecked ar(cx, origobj->realm());
if (!JSObject::swap(cx, origobj, target))
MOZ_CRASH();
newIdentity = origobj;
@ -924,7 +924,7 @@ JS_TransplantObject(JSContext* cx, HandleObject origobj, HandleObject target)
// Lastly, update the original object to point to the new one.
if (origobj->compartment() != destination) {
RootedObject newIdentityWrapper(cx, newIdentity);
AutoRealmUnchecked ar(cx, origobj->compartment());
AutoRealmUnchecked ar(cx, origobj->realm());
if (!JS_WrapObject(cx, &newIdentityWrapper))
MOZ_CRASH();
MOZ_ASSERT(Wrapper::wrappedObject(newIdentityWrapper) == newIdentity);

View File

@ -1046,7 +1046,7 @@ JS_RefreshCrossCompartmentWrappers(JSContext* cx, JS::Handle<JSObject*> obj);
*
* void foo(JSContext* cx, JSObject* obj) {
* // in 'oldRealm'
* JSCompartment* oldRealm = JS::EnterRealm(cx, obj);
* JS::Realm* oldRealm = JS::EnterRealm(cx, obj);
* // in the realm of 'obj'
* JS::LeaveRealm(cx, oldRealm);
* // back in 'oldRealm'
@ -1089,10 +1089,10 @@ namespace JS {
/** NB: This API is infallible; a nullptr return value does not indicate error.
*
* Entering a compartment roots the compartment and its global object until the
* matching JS::LeaveRealm() call.
* Entering a realm roots the realm and its global object until the matching
* JS::LeaveRealm() call.
*/
extern JS_PUBLIC_API(JSCompartment*)
extern JS_PUBLIC_API(JS::Realm*)
EnterRealm(JSContext* cx, JSObject* target);
extern JS_PUBLIC_API(void)

View File

@ -712,6 +712,9 @@ case "$target" in
# the same thing as C4244, we disable C4267, too.
CFLAGS="$CFLAGS -wd4244 -wd4267"
CXXFLAGS="$CXXFLAGS -wd4244 -wd4267 -wd4251"
# Silence "warning C4065: switch statement contains 'default' but no
# 'case' labels". See bug 1461304.
CXXFLAGS="$CXXFLAGS -wd4065"
if test -n "$CLANG_CL"; then
# XXX We should combine some of these with our generic GCC-style
# warning checks.

View File

@ -613,6 +613,7 @@ js::RemapWrapper(JSContext* cx, JSObject* wobjArg, JSObject* newTargetArg)
MOZ_ASSERT(!JS_IsDeadWrapper(origTarget),
"We don't want a dead proxy in the wrapper map");
Value origv = ObjectValue(*origTarget);
Realm* wrealm = wobj->realm();
JSCompartment* wcompartment = wobj->compartment();
AutoDisableProxyCheck adpc;
@ -637,7 +638,7 @@ js::RemapWrapper(JSContext* cx, JSObject* wobjArg, JSObject* newTargetArg)
// wrapper, |wobj|, since it's been nuked anyway. The wrap() function has
// the choice to reuse |wobj| or not.
RootedObject tobj(cx, newTarget);
AutoRealmUnchecked ar(cx, wcompartment);
AutoRealmUnchecked ar(cx, wrealm);
if (!wcompartment->rewrap(cx, &tobj, wobj))
MOZ_CRASH();

View File

@ -6177,7 +6177,7 @@ ReflectTrackedOptimizations(JSContext* cx, unsigned argc, Value* vp)
uint8_t* addr = ion->method()->raw() + endOffset;
entry.youngestFrameLocationAtAddr(rt, addr, &script, &pc);
if (!sp.jsprintf("{\"location\":\"%s:%zu\",\"offset\":%zu,\"index\":%u}%s",
if (!sp.jsprintf("{\"location\":\"%s:%u\",\"offset\":%zu,\"index\":%u}%s",
script->filename(), script->lineno(), script->pcToOffset(pc), index,
iter.more() ? "," : ""))
{

View File

@ -209,11 +209,11 @@ js::DumpCompartmentPCCounts(JSContext* cx)
if (!sprinter.init())
return false;
fprintf(stdout, "--- SCRIPT %s:%zu ---\n", script->filename(), script->lineno());
fprintf(stdout, "--- SCRIPT %s:%u ---\n", script->filename(), script->lineno());
if (!DumpPCCounts(cx, script, &sprinter))
return false;
fputs(sprinter.string(), stdout);
fprintf(stdout, "--- END SCRIPT %s:%zu ---\n", script->filename(), script->lineno());
fprintf(stdout, "--- END SCRIPT %s:%u ---\n", script->filename(), script->lineno());
}
return true;

View File

@ -150,7 +150,7 @@ LCovSource::writeScript(JSScript* script)
return false;
numFunctionsFound_++;
outFN_.printf("FN:%zu,", script->lineno());
outFN_.printf("FN:%u,", script->lineno());
if (!writeScriptName(outFN_, script))
return false;
outFN_.put("\n", 1);

View File

@ -375,7 +375,7 @@ class MOZ_RAII js::EnterDebuggeeNoExecute
}
const char* filename = script->filename() ? script->filename() : "(none)";
char linenoStr[15];
SprintfLiteral(linenoStr, "%zu", script->lineno());
SprintfLiteral(linenoStr, "%u", script->lineno());
unsigned flags = warning ? JSREPORT_WARNING : JSREPORT_ERROR;
// FIXME: filename should be UTF-8 (bug 987069).
return JS_ReportErrorFlagsAndNumberLatin1(cx, flags, GetErrorMessage, nullptr,
@ -2395,8 +2395,7 @@ class MOZ_RAII ExecutionObservableRealms : public Debugger::ExecutionObservableS
// AbstractFramePtr can't refer to non-remateralized Ion frames or
// non-debuggee wasm frames, so if iter refers to one such, we know we
// don't match.
return iter.hasUsableAbstractFramePtr() &&
realms_.has(JS::GetRealmForCompartment(iter.compartment()));
return iter.hasUsableAbstractFramePtr() && realms_.has(iter.realm());
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
@ -3745,7 +3744,7 @@ Debugger::addAllGlobalsAsDebuggees(JSContext* cx, unsigned argc, Value* vp)
for (RealmsInZoneIter r(zone); !r.done(); r.next()) {
if (r == dbg->object->realm() || r->creationOptions().invisibleToDebugger())
continue;
JS::GetCompartmentForRealm(r)->scheduledForDestruction = false;
r->compartment()->scheduledForDestruction = false;
GlobalObject* global = r->maybeGlobal();
if (global) {
Rooted<GlobalObject*> rg(cx, global);
@ -4962,7 +4961,7 @@ Debugger::findAllGlobals(JSContext* cx, unsigned argc, Value* vp)
if (r->creationOptions().invisibleToDebugger())
continue;
JS::GetCompartmentForRealm(r)->scheduledForDestruction = false;
r->compartment()->scheduledForDestruction = false;
GlobalObject* global = r->maybeGlobal();
@ -5416,7 +5415,7 @@ struct DebuggerScriptGetStartLineMatcher
using ReturnType = uint32_t;
ReturnType match(HandleScript script) {
return uint32_t(script->lineno());
return script->lineno();
}
ReturnType match(Handle<WasmInstanceObject*> wasmInstance) {
return 1;

View File

@ -3712,14 +3712,14 @@ AnalyzeEntrainedVariablesInScript(JSContext* cx, HandleScript script, HandleScri
buf.printf(" ");
}
buf.printf("(%s:%zu) has variables entrained by ", script->filename(), script->lineno());
buf.printf("(%s:%u) has variables entrained by ", script->filename(), script->lineno());
if (JSAtom* name = innerScript->functionNonDelazifying()->displayAtom()) {
buf.putString(name);
buf.printf(" ");
}
buf.printf("(%s:%zu) ::", innerScript->filename(), innerScript->lineno());
buf.printf("(%s:%u) ::", innerScript->filename(), innerScript->lineno());
for (PropertyNameSet::Range r = remainingNames.all(); !r.empty(); r.popFront()) {
buf.printf(" ");

View File

@ -506,13 +506,13 @@ GlobalObject::new_(JSContext* cx, const Class* clasp, JSPrincipals* principals,
MOZ_ASSERT(!cx->isExceptionPending());
MOZ_ASSERT_IF(cx->realm(), !cx->realm()->isAtomsRealm());
JSCompartment* compartment = NewCompartment(cx, principals, options);
if (!compartment)
Realm* realm = NewRealm(cx, principals, options);
if (!realm)
return nullptr;
Rooted<GlobalObject*> global(cx);
{
AutoRealmUnchecked ar(cx, compartment);
AutoRealmUnchecked ar(cx, realm);
global = GlobalObject::createInternal(cx, clasp);
if (!global)
return nullptr;

View File

@ -219,7 +219,7 @@ GetSelectorRuntime(const CompilationSelector& selector)
struct Matcher
{
JSRuntime* match(JSScript* script) { return script->runtimeFromMainThread(); }
JSRuntime* match(JSCompartment* comp) { return comp->runtimeFromMainThread(); }
JSRuntime* match(Realm* realm) { return realm->runtimeFromMainThread(); }
JSRuntime* match(Zone* zone) { return zone->runtimeFromMainThread(); }
JSRuntime* match(ZonesInState zbs) { return zbs.runtime; }
JSRuntime* match(JSRuntime* runtime) { return runtime; }
@ -236,7 +236,7 @@ JitDataStructuresExist(const CompilationSelector& selector)
struct Matcher
{
bool match(JSScript* script) { return !!script->realm()->jitRealm(); }
bool match(JSCompartment* comp) { return !!JS::GetRealmForCompartment(comp)->jitRealm(); }
bool match(Realm* realm) { return !!realm->jitRealm(); }
bool match(Zone* zone) { return !!zone->jitZone(); }
bool match(ZonesInState zbs) { return zbs.runtime->hasJitRuntime(); }
bool match(JSRuntime* runtime) { return runtime->hasJitRuntime(); }
@ -255,7 +255,7 @@ IonBuilderMatches(const CompilationSelector& selector, jit::IonBuilder* builder)
jit::IonBuilder* builder_;
bool match(JSScript* script) { return script == builder_->script(); }
bool match(JSCompartment* comp) { return comp == builder_->script()->compartment(); }
bool match(Realm* realm) { return realm == builder_->script()->realm(); }
bool match(Zone* zone) { return zone == builder_->script()->zone(); }
bool match(JSRuntime* runtime) { return runtime == builder_->script()->runtimeFromAnyThread(); }
bool match(AllCompilations all) { return true; }
@ -343,36 +343,36 @@ js::CancelOffThreadIonCompile(const CompilationSelector& selector, bool discardL
#ifdef DEBUG
bool
js::HasOffThreadIonCompile(JSCompartment* comp)
js::HasOffThreadIonCompile(Realm* realm)
{
AutoLockHelperThreadState lock;
if (!HelperThreadState().threads || JS::GetRealmForCompartment(comp)->isAtomsRealm())
if (!HelperThreadState().threads || realm->isAtomsRealm())
return false;
GlobalHelperThreadState::IonBuilderVector& worklist = HelperThreadState().ionWorklist(lock);
for (size_t i = 0; i < worklist.length(); i++) {
jit::IonBuilder* builder = worklist[i];
if (builder->script()->compartment() == comp)
if (builder->script()->realm() == realm)
return true;
}
for (auto& helper : *HelperThreadState().threads) {
if (helper.ionBuilder() && helper.ionBuilder()->script()->compartment() == comp)
if (helper.ionBuilder() && helper.ionBuilder()->script()->realm() == realm)
return true;
}
GlobalHelperThreadState::IonBuilderVector& finished = HelperThreadState().ionFinishedList(lock);
for (size_t i = 0; i < finished.length(); i++) {
jit::IonBuilder* builder = finished[i];
if (builder->script()->compartment() == comp)
if (builder->script()->realm() == realm)
return true;
}
JSRuntime* rt = comp->runtimeFromMainThread();
JSRuntime* rt = realm->runtimeFromMainThread();
jit::IonBuilder* builder = rt->jitRuntime()->ionLazyLinkList(rt).getFirst();
while (builder) {
if (builder->script()->compartment() == comp)
if (builder->script()->realm() == realm)
return true;
builder = builder->getNext();
}
@ -1652,7 +1652,7 @@ bool
GlobalHelperThreadState::finishParseTask(JSContext* cx, ParseTaskKind kind,
JS::OffThreadToken* token, F&& finishCallback)
{
MOZ_ASSERT(cx->compartment());
MOZ_ASSERT(cx->realm());
ScopedJSDeletePtr<ParseTask> parseTask(removeFinishedParseTask(kind, token));
@ -1663,7 +1663,7 @@ GlobalHelperThreadState::finishParseTask(JSContext* cx, ParseTaskKind kind,
return false;
}
mergeParseTaskCompartment(cx, parseTask, cx->compartment());
mergeParseTaskRealm(cx, parseTask, cx->realm());
bool ok = finishCallback(parseTask);
@ -1828,18 +1828,17 @@ GlobalHelperThreadState::cancelParseTask(JSRuntime* rt, ParseTaskKind kind,
}
void
GlobalHelperThreadState::mergeParseTaskCompartment(JSContext* cx, ParseTask* parseTask,
JSCompartment* dest)
GlobalHelperThreadState::mergeParseTaskRealm(JSContext* cx, ParseTask* parseTask, Realm* dest)
{
// After we call LeaveParseTaskZone() it's not safe to GC until we have
// finished merging the contents of the parse task's compartment into the
// destination compartment.
// finished merging the contents of the parse task's realm into the
// destination realm.
JS::AutoAssertNoGC nogc(cx);
LeaveParseTaskZone(cx->runtime(), parseTask);
// Move the parsed script and all its contents into the desired compartment.
gc::MergeCompartments(parseTask->parseGlobal->compartment(), dest);
// Move the parsed script and all its contents into the desired realm.
gc::MergeRealms(parseTask->parseGlobal->realm(), dest);
}
void

View File

@ -305,7 +305,7 @@ class GlobalHelperThreadState
void cancelParseTask(JSRuntime* rt, ParseTaskKind kind, JS::OffThreadToken* token);
void mergeParseTaskCompartment(JSContext* cx, ParseTask* parseTask, JSCompartment* dest);
void mergeParseTaskRealm(JSContext* cx, ParseTask* parseTask, JS::Realm* dest);
void trace(JSTracer* trc, js::gc::AutoTraceSession& session);
@ -529,7 +529,7 @@ struct ZonesInState { JSRuntime* runtime; JS::Zone::GCState state; };
struct CompilationsUsingNursery { JSRuntime* runtime; };
using CompilationSelector = mozilla::Variant<JSScript*,
JSCompartment*,
JS::Realm*,
Zone*,
ZonesInState,
JSRuntime*,
@ -549,9 +549,9 @@ CancelOffThreadIonCompile(JSScript* script)
}
inline void
CancelOffThreadIonCompile(JSCompartment* comp)
CancelOffThreadIonCompile(JS::Realm* realm)
{
CancelOffThreadIonCompile(CompilationSelector(comp), true);
CancelOffThreadIonCompile(CompilationSelector(realm), true);
}
inline void
@ -580,7 +580,7 @@ CancelOffThreadIonCompilesUsingNurseryPointers(JSRuntime* runtime)
#ifdef DEBUG
bool
HasOffThreadIonCompile(JSCompartment* comp);
HasOffThreadIonCompile(JS::Realm* realm);
#endif
/* Cancel all scheduled, in progress or finished parses for runtime. */

View File

@ -1197,11 +1197,30 @@ UnwindIteratorsForUncatchableException(JSContext* cx, const InterpreterRegs& reg
{
// c.f. the regular (catchable) TryNoteIterInterpreter loop in
// ProcessTryNotes.
bool inForOfIterClose = false;
for (TryNoteIterInterpreter tni(cx, regs); !tni.done(); ++tni) {
JSTryNote* tn = *tni;
if (tn->kind == JSTRY_FOR_IN) {
switch (tn->kind) {
case JSTRY_FOR_IN: {
// See corresponding comment in ProcessTryNotes.
if (inForOfIterClose)
break;
Value* sp = regs.spForStackDepth(tn->stackDepth);
UnwindIteratorForUncatchableException(&sp[-1].toObject());
break;
}
case JSTRY_FOR_OF_ITERCLOSE:
inForOfIterClose = true;
break;
case JSTRY_FOR_OF:
inForOfIterClose = false;
break;
default:
break;
}
}
}
@ -1262,6 +1281,12 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
return FinallyContinuation;
case JSTRY_FOR_IN: {
// Don't let (extra) values pushed on the stack while closing a
// for-of iterator confuse us into thinking we still have to close
// an inner for-in iterator.
if (inForOfIterClose)
break;
/* This is similar to JSOP_ENDITER in the interpreter loop. */
DebugOnly<jsbytecode*> pc = regs.fp()->script()->main() + tn->start + tn->length;
MOZ_ASSERT(JSOp(*pc) == JSOP_ENDITER);
@ -1272,6 +1297,10 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
}
case JSTRY_DESTRUCTURING_ITERCLOSE: {
// See note above.
if (inForOfIterClose)
break;
// Whether the destructuring iterator is done is at the top of the
// stack. The iterator object is second from the top.
MOZ_ASSERT(tn->stackDepth > 1);

View File

@ -91,8 +91,8 @@ js::AutoAtomsRealm::AutoAtomsRealm(JSContext* cx,
: AutoRealm(cx, cx->atomsRealm(lock), lock)
{}
js::AutoRealmUnchecked::AutoRealmUnchecked(JSContext* cx, JSCompartment* target)
: AutoRealm(cx, JS::GetRealmForCompartment(target))
js::AutoRealmUnchecked::AutoRealmUnchecked(JSContext* cx, JS::Realm* target)
: AutoRealm(cx, target)
{}
inline bool

View File

@ -904,6 +904,10 @@ class JS::Realm : private JSCompartment
size_t* privateData,
size_t* scriptCountsMapArg);
JSCompartment* compartment() {
return this;
}
JS::Zone* zone() {
return zone_;
}
@ -1384,7 +1388,7 @@ class AutoAtomsRealm : protected AutoRealm
class AutoRealmUnchecked : protected AutoRealm
{
public:
inline AutoRealmUnchecked(JSContext* cx, JSCompartment* target);
inline AutoRealmUnchecked(JSContext* cx, JS::Realm* target);
};
/*

View File

@ -835,14 +835,11 @@ CreateFunctionPrototype(JSContext* cx, JSProtoKey key)
* give it the guts to be one.
*/
RootedObject enclosingEnv(cx, &self->lexicalEnvironment());
JSObject* functionProto_ =
NewFunctionWithProto(cx, nullptr, 0, JSFunction::INTERPRETED,
enclosingEnv, nullptr, objectProto, AllocKind::FUNCTION,
SingletonObject);
if (!functionProto_)
return nullptr;
RootedFunction functionProto(cx, &functionProto_->as<JSFunction>());
RootedFunction functionProto(cx, NewFunctionWithProto(cx, nullptr, 0, JSFunction::INTERPRETED,
enclosingEnv, nullptr, objectProto,
AllocKind::FUNCTION, SingletonObject));
if (!functionProto)
return nullptr;
const char* rawSource = "function () {\n}";
size_t sourceLen = strlen(rawSource);

View File

@ -3437,7 +3437,7 @@ dumpValue(const Value& v, js::GenericPrinter& out)
}
if (fun->hasScript()) {
JSScript* script = fun->nonLazyScript();
out.printf(" (%s:%zu)",
out.printf(" (%s:%u)",
script->filename() ? script->filename() : "", script->lineno());
}
out.printf(" at %p>", (void*) fun);
@ -3717,7 +3717,7 @@ js::DumpInterpreterFrame(JSContext* cx, js::GenericPrinter& out, InterpreterFram
}
out.putChar('\n');
out.printf("file %s line %zu\n",
out.printf("file %s line %u\n",
i.script()->filename(), i.script()->lineno());
if (jsbytecode* pc = i.pc()) {

View File

@ -1295,11 +1295,11 @@ class JSScript : public js::gc::TenuredCell
return mainOffset_;
}
size_t lineno() const {
uint32_t lineno() const {
return lineno_;
}
size_t column() const {
uint32_t column() const {
return column_;
}

View File

@ -32,7 +32,7 @@ class CompilerConstraintList;
class ObjectGroupRealm;
namespace gc {
void MergeCompartments(JSCompartment* source, JSCompartment* target);
void MergeRealms(JS::Realm* source, JS::Realm* target);
} // namespace gc
/*

View File

@ -225,7 +225,7 @@ JSRuntime::init(JSContext* cx, uint32_t maxbytes, uint32_t maxNurseryBytes)
return false;
gc.atomsZone = atomsZone.get();
if (!atomsZone->compartments().append(JS::GetCompartmentForRealm(atomsRealm.get())))
if (!atomsZone->compartments().append(atomsRealm->compartment()))
return false;
atomsRealm->setIsSystem(true);

View File

@ -1474,7 +1474,7 @@ SavedStacks::insertFrames(JSContext* cx, MutableHandleSavedFrame frame,
// needed to construct the SavedFrame::Lookup.
Rooted<LocationValue> location(cx);
{
AutoRealmUnchecked ar(cx, iter.compartment());
AutoRealmUnchecked ar(cx, iter.realm());
if (!cx->realm()->savedStacks().getLocation(cx, iter, &location))
return false;
}

View File

@ -2791,12 +2791,10 @@ JSRuntime::createSelfHostingGlobal(JSContext* cx)
options.creationOptions().setNewZone();
options.behaviors().setDiscardSource(true);
JSCompartment* compartment = NewCompartment(cx, nullptr, options);
if (!compartment)
Realm* realm = NewRealm(cx, nullptr, options);
if (!realm)
return nullptr;
JS::Realm* realm = JS::GetRealmForCompartment(compartment);
static const ClassOps shgClassOps = {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
@ -2809,7 +2807,7 @@ JSRuntime::createSelfHostingGlobal(JSContext* cx)
&shgClassOps
};
AutoRealmUnchecked ar(cx, compartment);
AutoRealmUnchecked ar(cx, realm);
Rooted<GlobalObject*> shg(cx, GlobalObject::createInternal(cx, &shgClass));
if (!shg)
return nullptr;

View File

@ -451,7 +451,6 @@ class BaseShape : public gc::TenuredCell
friend class Shape;
friend struct StackBaseShape;
friend struct StackShape;
friend void gc::MergeCompartments(JSCompartment* source, JSCompartment* target);
enum Flag {
/* Owned by the referring shape. */

View File

@ -901,6 +901,17 @@ FrameIter::compartment() const
MOZ_CRASH("Unexpected state");
}
Realm*
FrameIter::realm() const
{
MOZ_ASSERT(!done());
if (hasScript())
return script()->realm();
return wasmInstance()->realm();
}
bool
FrameIter::isEvalFrame() const
{
@ -1622,9 +1633,9 @@ jit::JitActivation::getRematerializedFrame(JSContext* cx, const JSJitFrameIter&
MaybeReadFallback recover(cx, this, &iter);
// Frames are often rematerialized with the cx inside a Debugger's
// compartment. To recover slots and to create CallObjects, we need to
// be in the activation's compartment.
AutoRealmUnchecked ar(cx, compartment_);
// realm. To recover slots and to create CallObjects, we need to
// be in the script's realm.
AutoRealmUnchecked ar(cx, iter.script()->realm());
if (!RematerializedFrame::RematerializeInlineFrames(cx, top, inlineIter, recover, frames))
return nullptr;

View File

@ -2045,6 +2045,7 @@ class FrameIter
FrameIter& operator++();
JS::Realm* realm() const;
JSCompartment* compartment() const;
Activation* activation() const { return data_.activations_.activation(); }

View File

@ -2574,7 +2574,7 @@ TypeZone::processPendingRecompiles(FreeOp* fop, RecompileInfoVector& recompiles)
void
TypeZone::addPendingRecompile(JSContext* cx, const RecompileInfo& info)
{
InferSpew(ISpewOps, "addPendingRecompile: %p:%s:%zu",
InferSpew(ISpewOps, "addPendingRecompile: %p:%s:%u",
info.script(), info.script()->filename(), info.script()->lineno());
AutoEnterOOMUnsafeRegion oomUnsafe;
@ -4417,10 +4417,10 @@ ObjectGroup::sweep(const AutoSweepObjectGroup& sweep, AutoClearTypeInferenceStat
if (auto* layout = maybeUnboxedLayout(sweep)) {
// Remove unboxed layouts that are about to be finalized from the
// compartment wide list while we are still on the main thread.
// realm wide list while we are still on the main thread.
ObjectGroup* group = this;
if (IsAboutToBeFinalizedUnbarriered(&group))
layout->detachFromCompartment();
layout->detachFromRealm();
if (layout->newScript())
layout->newScript()->sweep();
@ -4700,7 +4700,7 @@ TypeScript::printTypes(JSContext* cx, HandleScript script) const
fprintf(stderr, "Eval");
else
fprintf(stderr, "Main");
fprintf(stderr, " %#" PRIxPTR " %s:%zu ",
fprintf(stderr, " %#" PRIxPTR " %s:%u ",
uintptr_t(script.get()), script->filename(), script->lineno());
if (script->functionNonDelazifying()) {

View File

@ -305,7 +305,7 @@ UnboxedLayout::makeConstructorCode(JSContext* cx, HandleObjectGroup group)
}
void
UnboxedLayout::detachFromCompartment()
UnboxedLayout::detachFromRealm()
{
if (isInList())
remove();

View File

@ -124,7 +124,7 @@ class UnboxedLayout : public mozilla::LinkedListElement<UnboxedLayout>
constructorCode_.init(nullptr);
}
void detachFromCompartment();
void detachFromRealm();
const PropertyVector& properties() const {
return properties_;

View File

@ -133,7 +133,7 @@ MarkScript(const js::jit::JitCode* code, const JSScript* script, const char* mod
// Line numbers begin at 1, but columns begin at 0.
// Text editors start at 1,1 so fixup is performed to match.
char namebuf[512];
SprintfLiteral(namebuf, "%s:%zu:%zu",
SprintfLiteral(namebuf, "%s:%u:%u",
script->filename(), script->lineno(), script->column() + 1);
method.method_name = &namebuf[0];

View File

@ -954,7 +954,7 @@ HandleFault(PEXCEPTION_POINTERS exception)
if (!IsHeapAccessAddress(*instance, faultingAddress))
return false;
MOZ_ASSERT(activation->compartment() == JS::GetCompartmentForRealm(instance->realm()));
MOZ_ASSERT(activation->compartment() == instance->realm()->compartment());
return HandleOutOfBounds(context, pc, faultingAddress, moduleSegment, *instance, activation, ppc);
}
@ -1061,7 +1061,7 @@ HandleMachException(JSContext* cx, const ExceptionRequest& request)
return false;
JitActivation* activation = cx->activation()->asJit();
MOZ_ASSERT(activation->compartment() == JS::GetCompartmentForRealm(instance->realm()));
MOZ_ASSERT(activation->compartment() == instance->realm()->compartment());
if (request.body.exception == EXC_BAD_INSTRUCTION) {
Trap trap;
@ -1283,7 +1283,7 @@ HandleFault(int signum, siginfo_t* info, void* ctx)
return false;
JitActivation* activation = TlsContext.get()->activation()->asJit();
MOZ_ASSERT(activation->compartment() == JS::GetCompartmentForRealm(instance->realm()));
MOZ_ASSERT(activation->compartment() == instance->realm()->compartment());
if (signum == kWasmTrapSignal) {
// Wasm traps for MIPS raise only integer overflow fp exception.

View File

@ -33,14 +33,6 @@ inline bool IsInServoTraversal()
MOZ_ASSERT(sInServoTraversal || NS_IsMainThread());
return sInServoTraversal;
}
inline bool IsInServoTraversalWithoutMainThreadAssertion()
{
// This is for cases when we _only_ want to query whether we're in Servo
// traversal, without asserting in the case of other non-main-thread callers.
// Use this only if the calling code is safe to use off the main thread.
return sInServoTraversal;
}
} // namespace mozilla
#define MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_) \

View File

@ -519,6 +519,13 @@ var Addons = {
let listItem = this._getElementForAddon(addon.id);
function setDisabled(addon, value) {
if (value) {
return addon.enable();
}
return addon.disable();
}
let opType;
if (addon.type == "theme") {
if (aValue) {
@ -527,18 +534,18 @@ var Addons = {
let item = list.firstElementChild;
while (item) {
if (item.addon && (item.addon.type == "theme") && (item.addon.isActive)) {
item.addon.userDisabled = true;
item.addon.disable();
item.setAttribute("isDisabled", true);
break;
}
item = item.nextSibling;
}
}
addon.userDisabled = !aValue;
setDisabled(addon, !aValue);
} else if (addon.type == "locale") {
addon.userDisabled = !aValue;
setDisabled(addon, !aValue);
} else {
addon.userDisabled = !aValue;
setDisabled(addon, !aValue);
opType = this._getOpTypeForOperations(addon.pendingOperations);
if ((addon.pendingOperations & AddonManager.PENDING_ENABLE) ||

View File

@ -47,7 +47,7 @@ BlocklistPrompt.prototype = {
if (aAddons[i].item instanceof Ci.nsIPluginTag)
aAddons[i].item.disabled = true;
else
aAddons[i].item.userDisabled = true;
aAddons[i].item.disable();
}
},
classID: Components.ID("{4e6ea350-b09a-11df-94e2-0800200c9a66}"),

View File

@ -16,3 +16,4 @@ tags = webextensions
[test_ext_pageAction_show_hide.html]
[test_ext_pageAction_getPopup_setPopup.html]
[test_ext_popup_behavior.html]
skip-if = (os == "android" && !debug) #Bug 1463383 - timeout

View File

@ -413,6 +413,10 @@ add_task(async function test_options_ui_open_in_tab() {
});
add_task(async function test_options_ui_on_disable_and_enable() {
// Temporarily disabled for races.
/* eslint-disable no-unreachable */
return;
let addonID = "test-options-ui-disable-enable@mozilla.org";
function optionsScript() {

View File

@ -37,17 +37,6 @@
#pragma clang diagnostic pop
#endif
/*
* Force-include hunspell_alloc_hooks.h and hunspell_fopen_hooks.h for hunspell,
* so that we don't need to modify them directly.
*
* HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/moz.build
*/
#if defined(HUNSPELL_STATIC)
#include "hunspell_alloc_hooks.h"
#include "hunspell_fopen_hooks.h"
#endif
/*
* Force-include sdkdecls.h for building the chromium sandbox code.
*

View File

@ -943,6 +943,9 @@ case "$target" in
# may not be declared inline, as of VS2015 Update 2.
CFLAGS="$CFLAGS -wd4244 -wd4267"
CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
# Silence "warning C4065: switch statement contains 'default' but no
# 'case' labels". See bug 1461304.
CXXFLAGS="$CXXFLAGS -wd4065"
if test -n "$CLANG_CL"; then
# XXX We should combine some of these with our generic GCC-style
# warning checks.

View File

@ -336,6 +336,7 @@ class OmniJarSubFormatter(PiecemealFormatter):
path[1] in ['pref', 'preferences'])
return path[0] in [
'modules',
'dictionaries',
'greprefs.js',
'hyphenation',
'localization',

View File

@ -9,6 +9,7 @@ Replace localized parts of a packaged directory with data from a langpack
directory.
'''
import json
import os
import mozpack.path as mozpath
from mozpack.packager.formats import (
@ -23,6 +24,7 @@ from mozpack.packager import (
)
from mozpack.files import (
ComposedFinder,
GeneratedFile,
ManifestFile,
)
from mozpack.copier import (
@ -160,6 +162,7 @@ def _repack(app_finder, l10n_finder, copier, formatter, non_chrome=set()):
# Create a new package, with non localized bits coming from the original
# package, and localized bits coming from the langpack.
packager = SimplePackager(formatter)
built_in_addons = None
for p, f in app_finder:
if is_manifest(p):
# Remove localized manifest entries.
@ -177,7 +180,8 @@ def _repack(app_finder, l10n_finder, copier, formatter, non_chrome=set()):
if base:
subpath = mozpath.relpath(p, base)
path = mozpath.normpath(mozpath.join(paths[base],
subpath))
subpath))
if path:
files = [f for p, f in l10n_finder.find(path)]
if not len(files):
@ -189,6 +193,8 @@ def _repack(app_finder, l10n_finder, copier, formatter, non_chrome=set()):
os.path.join(finderBase, path))
else:
packager.add(path, files[0])
elif p.endswith('built_in_addons.json'):
built_in_addons = (p, f)
else:
packager.add(p, f)
@ -209,13 +215,25 @@ def _repack(app_finder, l10n_finder, copier, formatter, non_chrome=set()):
packager.close()
dictionaries = {}
# Add any remaining non chrome files.
for pattern in non_chrome:
for base in bases:
for p, f in l10n_finder.find(mozpath.join(base, pattern)):
if not formatter.contains(p):
if p.startswith('dictionaries/') and p.endswith('.dic'):
base, ext = os.path.splitext(os.path.basename(p))
dictionaries[base] = p
formatter.add(p, f)
# Update the built-in add-ons manifest with the new list of dictionaries
# from the langpack.
if built_in_addons:
data = json.load(built_in_addons[1].open())
data['dictionaries'] = dictionaries
formatter.add(built_in_addons[0], GeneratedFile(json.dumps(data)))
# Resources in `localization` directories are packaged from the source and then
# if localized versions are present in the l10n dir, we package them as well
# keeping the source dir resources as a runtime fallback.

View File

@ -93,7 +93,7 @@ AddonUtilsInternal.prototype = {
if ("enabled" in options && !options.enabled) {
log.info("Marking add-on as disabled for install: " +
install.name);
install.addon.userDisabled = true;
install.addon.disable();
}
},
onInstallEnded(install, addon) {
@ -352,7 +352,11 @@ AddonUtilsInternal.prototype = {
}
this._log.info("Updating userDisabled flag: " + addon.id + " -> " + value);
addon.userDisabled = !!value;
if (value) {
addon.disable();
} else {
addon.enable();
}
},
};

Some files were not shown because too many files have changed in this diff Show More