This commit is contained in:
Ryan VanderMeulen 2014-04-18 22:11:32 -04:00
Родитель d647776123 05e02e5efd
Коммит 724e36869a
128 изменённых файлов: 1211 добавлений и 754 удалений

Просмотреть файл

@ -783,10 +783,6 @@ var CustomEventManager = {
case 'inputmethod-update-layouts':
KeyboardHelper.handleEvent(detail);
break;
case 'nfc-hardware-state-change':
Services.obs.notifyObservers(null, 'nfc-hardware-state-change',
JSON.stringify({ nfcHardwareState: detail.nfcHardwareState }));
break;
}
}
}

Просмотреть файл

@ -29,6 +29,7 @@
.fullscreenButton,
.playButton,
.castingButton,
.muteButton {
-moz-appearance: none;
min-height: 42px;
@ -62,6 +63,10 @@
background: url("chrome://b2g/content/images/play-hdpi.png") no-repeat center;
}
.castingButton {
display: none;
}
.muteButton {
background: url("chrome://b2g/content/images/mute-hdpi.png") no-repeat center;
}

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="55bcc2d7e44dc805c24b57d1e783fc26e8a2ee86"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>
@ -131,6 +131,6 @@
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="8afce6d5d48b71b6e7cb917179fb6147fb747521"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="72e3a520e3c700839f07ba0113fd527b923c3330"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="6a7ada569fd37c09ed4bbee6eb78cea5b467b229"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="baaf899afb158b9530690002f3656e958e3eb047"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
</manifest>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="52c909ccead537f8f9dbf634f3e6639078a8b0bd">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="55bcc2d7e44dc805c24b57d1e783fc26e8a2ee86"/>

Просмотреть файл

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "26f2c60c0ba0e64114467663c33c82360c13f4cf",
"revision": "38d1561fe26c12f371c44a47c498722ce06518c2",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

Просмотреть файл

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>
@ -127,7 +127,7 @@
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="6a7ada569fd37c09ed4bbee6eb78cea5b467b229"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="baaf899afb158b9530690002f3656e958e3eb047"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="76c94ac5dc3b8e17cc23d9cc3e2662b0d5d28b2e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e93b6de9633a162b735252e8182974456f741f4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

Просмотреть файл

@ -29,6 +29,7 @@
.fullscreenButton,
.playButton,
.castingButton,
.muteButton {
-moz-appearance: none;
min-height: 42px;
@ -62,6 +63,10 @@
background: url("chrome://browser/skin/images/play-hdpi.png") no-repeat center;
}
.castingButton {
display: none;
}
.muteButton {
background: url("chrome://browser/skin/images/mute-hdpi.png") no-repeat center;
}

Просмотреть файл

@ -6,10 +6,9 @@
#ifndef nsCCUncollectableMarker_h_
#define nsCCUncollectableMarker_h_
#include "nsIObserver.h"
#include "js/TracingAPI.h"
#include "mozilla/Attributes.h"
struct JSTracer;
#include "nsIObserver.h"
class nsCCUncollectableMarker MOZ_FINAL : public nsIObserver
{

Просмотреть файл

@ -53,6 +53,7 @@
#include "mozilla/CORSMode.h"
#include "mozilla/Attributes.h"
#include "mozilla/unused.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gCspPRLog;
@ -814,11 +815,10 @@ NotifyOffThreadScriptLoadCompletedRunnable::Run()
static void
OffThreadScriptLoaderCallback(void *aToken, void *aCallbackData)
{
NotifyOffThreadScriptLoadCompletedRunnable* aRunnable =
static_cast<NotifyOffThreadScriptLoadCompletedRunnable*>(aCallbackData);
nsRefPtr<NotifyOffThreadScriptLoadCompletedRunnable> aRunnable =
dont_AddRef(static_cast<NotifyOffThreadScriptLoadCompletedRunnable*>(aCallbackData));
aRunnable->SetToken(aToken);
NS_DispatchToMainThread(aRunnable);
NS_RELEASE(aRunnable);
}
nsresult
@ -848,12 +848,9 @@ nsScriptLoader::AttemptAsyncScriptParse(nsScriptLoadRequest* aRequest)
return NS_ERROR_FAILURE;
}
NotifyOffThreadScriptLoadCompletedRunnable* runnable =
nsRefPtr<NotifyOffThreadScriptLoadCompletedRunnable> runnable =
new NotifyOffThreadScriptLoadCompletedRunnable(aRequest, this);
// This reference will be consumed by OffThreadScriptLoaderCallback.
NS_ADDREF(runnable);
if (!JS::CompileOffThread(cx, options,
aRequest->mScriptText.get(), aRequest->mScriptText.Length(),
OffThreadScriptLoaderCallback,
@ -863,6 +860,7 @@ nsScriptLoader::AttemptAsyncScriptParse(nsScriptLoadRequest* aRequest)
mDocument->BlockOnload();
unused << runnable.forget();
return NS_OK;
}

Просмотреть файл

@ -12,7 +12,7 @@
#ifndef nsXULElement_h__
#define nsXULElement_h__
#include "js/Tracer.h"
#include "js/TracingAPI.h"
#include "mozilla/Attributes.h"
#include "nsIDOMEvent.h"
#include "nsIServiceManager.h"

Просмотреть файл

@ -25,6 +25,7 @@
#include "mozilla/Attributes.h"
#include "js/TracingAPI.h"
#include "js/TypeDecls.h"
class nsIRDFResource;
@ -42,7 +43,6 @@ class nsIXULPrototypeScript;
#include "nsURIHashKey.h"
#include "nsInterfaceHashtable.h"
struct JSTracer;
struct PRLogModuleInfo;
class nsRefMapEntry : public nsStringHashKey

Просмотреть файл

@ -22,7 +22,7 @@
#include "nsNetUtil.h"
#include "nsAppDirectoryServiceDefs.h"
#include "js/Tracer.h"
#include "js/TracingAPI.h"
#include "mozilla/Preferences.h"
#include "mozilla/scache/StartupCache.h"

Просмотреть файл

@ -6,6 +6,7 @@
#ifndef nsXULPrototypeDocument_h__
#define nsXULPrototypeDocument_h__
#include "js/TracingAPI.h"
#include "mozilla/Attributes.h"
#include "nsAutoPtr.h"
#include "nsCOMArray.h"
@ -21,7 +22,6 @@ class nsNodeInfoManager;
class nsXULPrototypeElement;
class nsXULPrototypePI;
class nsXULPDGlobalObject;
struct JSTracer;
namespace mozilla {
namespace dom {

Просмотреть файл

@ -76,13 +76,11 @@ function InterAppCommService() {
// "app://subApp1.gaiamobile.org/manifest.webapp": {
// pageURL: "app://subApp1.gaiamobile.org/handler.html",
// description: "blah blah",
// appStatus: Ci.nsIPrincipal.APP_STATUS_CERTIFIED,
// rules: { ... }
// },
// "app://subApp2.gaiamobile.org/manifest.webapp": {
// pageURL: "app://subApp2.gaiamobile.org/handler.html",
// description: "blah blah",
// appStatus: Ci.nsIPrincipal.APP_STATUS_PRIVILEGED,
// rules: { ... }
// }
// },
@ -90,7 +88,6 @@ function InterAppCommService() {
// "app://subApp3.gaiamobile.org/manifest.webapp": {
// pageURL: "app://subApp3.gaiamobile.org/handler.html",
// description: "blah blah",
// appStatus: Ci.nsIPrincipal.APP_STATUS_INSTALLED,
// rules: { ... }
// }
// }
@ -214,14 +211,14 @@ function InterAppCommService() {
InterAppCommService.prototype = {
registerConnection: function(aKeyword, aHandlerPageURI, aManifestURI,
aDescription, aAppStatus, aRules) {
aDescription, aRules) {
let manifestURL = aManifestURI.spec;
let pageURL = aHandlerPageURI.spec;
if (DEBUG) {
debug("registerConnection: aKeyword: " + aKeyword +
" manifestURL: " + manifestURL + " pageURL: " + pageURL +
" aDescription: " + aDescription + " aAppStatus: " + aAppStatus +
" aDescription: " + aDescription +
" aRules.minimumAccessLevel: " + aRules.minimumAccessLevel +
" aRules.manifestURLs: " + aRules.manifestURLs +
" aRules.installOrigins: " + aRules.installOrigins);
@ -235,7 +232,6 @@ InterAppCommService.prototype = {
subAppManifestURLs[manifestURL] = {
pageURL: pageURL,
description: aDescription,
appStatus: aAppStatus,
rules: aRules,
manifestURL: manifestURL
};
@ -300,7 +296,7 @@ InterAppCommService.prototype = {
return false;
},
_matchInstallOrigins: function(aRules, aManifestURL) {
_matchInstallOrigins: function(aRules, aInstallOrigin) {
if (!aRules || !Array.isArray(aRules.installOrigins)) {
if (DEBUG) {
debug("rules.installOrigins is not available. No need to match.");
@ -308,31 +304,30 @@ InterAppCommService.prototype = {
return true;
}
let installOrigin =
appsService.getAppByManifestURL(aManifestURL).installOrigin;
let installOrigins = aRules.installOrigins;
if (installOrigins.indexOf(installOrigin) != -1) {
if (installOrigins.indexOf(aInstallOrigin) != -1) {
return true;
}
if (DEBUG) {
debug("rules.installOrigins is not matched!" +
" aManifestURL: " + aManifestURL +
" installOrigins: " + installOrigins +
" installOrigin : " + installOrigin);
" installOrigin : " + aInstallOrigin);
}
return false;
},
_matchRules: function(aPubAppManifestURL, aPubAppStatus, aPubRules,
aSubAppManifestURL, aSubAppStatus, aSubRules) {
_matchRules: function(aPubAppManifestURL, aPubRules,
aSubAppManifestURL, aSubRules) {
let pubApp = appsService.getAppByManifestURL(aPubAppManifestURL);
let subApp = appsService.getAppByManifestURL(aSubAppManifestURL);
// TODO Bug 907068 In the initiative step, we only expose this API to
// certified apps to meet the time line. Eventually, we need to make
// it available for the non-certified apps as well. For now, only the
// certified apps can match the rules.
if (aPubAppStatus != Ci.nsIPrincipal.APP_STATUS_CERTIFIED ||
aSubAppStatus != Ci.nsIPrincipal.APP_STATUS_CERTIFIED) {
if (pubApp.appStatus != Ci.nsIPrincipal.APP_STATUS_CERTIFIED ||
subApp.appStatus != Ci.nsIPrincipal.APP_STATUS_CERTIFIED) {
if (DEBUG) {
debug("Only certified apps are allowed to do connections.");
}
@ -347,8 +342,8 @@ InterAppCommService.prototype = {
}
// Check minimumAccessLevel.
if (!this._matchMinimumAccessLevel(aPubRules, aSubAppStatus) ||
!this._matchMinimumAccessLevel(aSubRules, aPubAppStatus)) {
if (!this._matchMinimumAccessLevel(aPubRules, subApp.appStatus) ||
!this._matchMinimumAccessLevel(aSubRules, pubApp.appStatus)) {
return false;
}
@ -359,8 +354,8 @@ InterAppCommService.prototype = {
}
// Check installOrigins.
if (!this._matchInstallOrigins(aPubRules, aSubAppManifestURL) ||
!this._matchInstallOrigins(aSubRules, aPubAppManifestURL)) {
if (!this._matchInstallOrigins(aPubRules, subApp.installOrigin) ||
!this._matchInstallOrigins(aSubRules, pubApp.installOrigin)) {
return false;
}
@ -452,7 +447,6 @@ InterAppCommService.prototype = {
let pubAppManifestURL = aMessage.manifestURL;
let outerWindowID = aMessage.outerWindowID;
let requestID = aMessage.requestID;
let pubAppStatus = aMessage.appStatus;
let subAppManifestURLs = this._registeredConnections[keyword];
if (!subAppManifestURLs) {
@ -486,12 +480,11 @@ InterAppCommService.prototype = {
// Only rule-matched publishers/subscribers are allowed to connect.
let subscribedInfo = subAppManifestURLs[subAppManifestURL];
let subAppStatus = subscribedInfo.appStatus;
let subRules = subscribedInfo.rules;
let matched =
this._matchRules(pubAppManifestURL, pubAppStatus, pubRules,
subAppManifestURL, subAppStatus, subRules);
this._matchRules(pubAppManifestURL, pubRules,
subAppManifestURL, subRules);
if (!matched) {
if (DEBUG) {
debug("Rules are not matched. Skipping: " + subAppManifestURL);

Просмотреть файл

@ -0,0 +1,76 @@
/* 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/. */
"use strict";
const Cu = Components.utils;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
this.EXPORTED_SYMBOLS = ["ScriptPreloader"];
function debug(aMsg) {
//dump("--*-- ScriptPreloader: " + aMsg + "\n");
}
this.ScriptPreloader = {
#ifdef MOZ_B2G
_enabled: true,
#else
_enabled: false,
#endif
preload: function(aApp, aManifest) {
debug("Preloading " + aApp.origin);
let deferred = Promise.defer();
if (!this._enabled) {
deferred.resolve();
return deferred.promise;
}
if (aManifest.precompile &&
Array.isArray(aManifest.precompile) &&
aManifest.precompile.length > 0) {
let origin = Services.io.newURI(aApp.origin, null, null);
let toLoad = aManifest.precompile.length;
let principal =
Services.scriptSecurityManager
.getAppCodebasePrincipal(origin, aApp.localId, false);
aManifest.precompile.forEach((aPath) => {
let uri = Services.io.newURI(aPath, null, origin);
debug("Script to compile: " + uri.spec);
try {
Services.scriptloader.precompileScript(uri, principal,
(aSubject, aTopic, aData) => {
let uri = aSubject.QueryInterface(Ci.nsIURI);
debug("Done compiling " + uri.spec);
toLoad--;
if (toLoad == 0) {
deferred.resolve();
}
});
} catch (e) {
// Resolve the promise if precompileScript throws.
deferred.resolve();
}
});
} else {
// The precompile field is not an array, let the developer know.
// We don't want to have to enable debug for that to show up.
if (aManifest.precompile) {
Cu.reportError("ASM.JS compilation failed: the 'precompile' manifest " +
"property should be an array of script uris.\n");
}
deferred.resolve();
}
return deferred.promise;
}
}

Просмотреть файл

@ -486,7 +486,6 @@ WebappsApplication.prototype = {
rules: aRules,
manifestURL: this.manifestURL,
outerWindowID: this._id,
appStatus: this._appStatus,
requestID: this.getPromiseResolverId({
resolve: aResolve,
reject: aReject

Просмотреть файл

@ -61,6 +61,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebappOSUtils",
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ScriptPreloader",
"resource://gre/modules/ScriptPreloader.jsm");
#ifdef MOZ_WIDGET_GONK
XPCOMUtils.defineLazyGetter(this, "libcutils", function() {
Cu.import("resource://gre/modules/systemlibs.js");
@ -734,7 +737,6 @@ this.DOMApplicationRegistry = {
handlerPageURI,
manifestURI,
connection.description,
AppsUtils.getAppManifestStatus(manifest),
connection.rules);
}
},
@ -1489,7 +1491,9 @@ this.DOMApplicationRegistry = {
delete app.retryingDownload;
this._saveApps().then(() => {
// Update the asm.js scripts we need to compile.
ScriptPreloader.preload(app, aData)
.then(() => this._saveApps()).then(() => {
// Update the handlers and permissions for this app.
this.updateAppHandlers(aOldManifest, aData, app);
@ -2595,13 +2599,19 @@ onInstallSuccessAck: function onInstallSuccessAck(aManifestURL,
manifest: aManifest,
manifestURL: aNewApp.manifestURL
});
this.broadcastMessage("Webapps:FireEvent", {
eventType: ["downloadsuccess", "downloadapplied"],
manifestURL: aNewApp.manifestURL
});
if (aInstallSuccessCallback) {
aInstallSuccessCallback(aManifest, zipFile.path);
}
// Check if we have asm.js code to preload for this application.
ScriptPreloader.preload(aNewApp, aManifest)
.then(() => {
this.broadcastMessage("Webapps:FireEvent", {
eventType: ["downloadsuccess", "downloadapplied"],
manifestURL: aNewApp.manifestURL
});
if (aInstallSuccessCallback) {
aInstallSuccessCallback(aManifest, zipFile.path);
}
}
);
});
},

Просмотреть файл

@ -36,6 +36,7 @@ EXTRA_JS_MODULES += [
EXTRA_PP_JS_MODULES += [
'AppsUtils.jsm',
'OperatorApps.jsm',
'ScriptPreloader.jsm',
'Webapps.jsm',
]

Просмотреть файл

@ -174,20 +174,6 @@ Crypto::ImportUserCertificates(const nsAString& aNickname,
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::PopChallengeResponse(const nsAString& aChallenge,
nsAString& aReturn,
ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::Random(int32_t aNumBytes, nsAString& aReturn, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::SignText(JSContext* aContext,
const nsAString& aStringToSign,
@ -205,12 +191,6 @@ Crypto::Logout(ErrorResult& aRv)
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::DisableRightClick(ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
#endif
/* static */ uint8_t*

Просмотреть файл

@ -66,12 +66,6 @@ public:
nsAString& aReturn,
ErrorResult& aRv);
virtual void PopChallengeResponse(const nsAString& aChallenge,
nsAString& aReturn,
ErrorResult& aRv);
virtual void Random(int32_t aNumBytes, nsAString& aReturn, ErrorResult& aRv);
virtual void SignText(JSContext* aContext,
const nsAString& aStringToSign,
const nsAString& aCaOption,
@ -80,7 +74,6 @@ public:
virtual void Logout(ErrorResult& aRv);
virtual void DisableRightClick(ErrorResult& aRv);
#endif
// WebIDL

Просмотреть файл

@ -11,7 +11,7 @@
#include "js/Id.h" // must come before js/RootingAPI.h
#include "js/Value.h" // must come before js/RootingAPI.h
#include "js/RootingAPI.h"
#include "js/Tracer.h"
#include "js/TracingAPI.h"
class XPCWrappedNativeScope;

Просмотреть файл

@ -8,7 +8,7 @@
#include "nsWrapperCache.h"
#include "js/GCAPI.h"
#include "js/Tracer.h"
#include "js/TracingAPI.h"
inline JSObject*
nsWrapperCache::GetWrapper() const

Просмотреть файл

@ -10,7 +10,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/RootingAPI.h"
#include "js/Tracer.h"
#include "js/TracingAPI.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsWrapperCache.h"

Просмотреть файл

@ -16,7 +16,7 @@ interface nsIURI;
*
* [1] https://wiki.mozilla.org/WebAPI/Inter_App_Communication_Alt_proposal
*/
[scriptable, uuid(7fdd8b68-0b0a-11e3-9b4c-afbc236da250)]
[scriptable, uuid(b3d711a4-c6a4-11e3-8fd3-738e7fbcb6d6)]
interface nsIInterAppCommService : nsISupports
{
/*
@ -27,14 +27,11 @@ interface nsIInterAppCommService : nsISupports
* @param handlerPageURI The URI of the handler's page.
* @param manifestURI The webapp's manifest URI.
* @param description The connection's description.
* @param appStatus The app status can be Ci.nsIPrincipal.APP_STATUS_[
* NOT_INSTALLED, INSTALLED, PRIVILEGED, CERTIFIED].
* @param rules The connection's rules.
*/
void registerConnection(in DOMString keyword,
in nsIURI handlerPageURI,
in nsIURI manifestURI,
in DOMString description,
in unsigned short appStatus,
in jsval rules);
};

Просмотреть файл

@ -416,7 +416,6 @@ function Nfc() {
this.worker.onmessage = this.onmessage.bind(this);
Services.obs.addObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED, false);
Services.obs.addObserver(this, NFC.TOPIC_HARDWARE_STATE, false);
gMessageManager.init(this);
let lock = gSettingsService.createLock();
@ -657,28 +656,11 @@ Nfc.prototype = {
this.handle(setting.key, setting.value);
}
break;
case NFC.TOPIC_HARDWARE_STATE:
let state = JSON.parse(data);
if (state) {
let level = this.hardwareStateToPowerlevel(state.nfcHardwareState);
this.setConfig({ powerLevel: level });
}
break;
}
},
setConfig: function setConfig(prop) {
this.sendToWorker("config", prop);
},
hardwareStateToPowerlevel: function hardwareStateToPowerlevel(state) {
switch (state) {
case 0: return NFC.NFC_POWER_LEVEL_DISABLED;
case 1: return NFC.NFC_POWER_LEVEL_ENABLED;
case 2: return NFC.NFC_POWER_LEVEL_ENABLED;
case 3: return NFC.NFC_POWER_LEVEL_LOW;
default: return NFC.NFC_POWER_LEVEL_UNKNOWN;
}
}
};

Просмотреть файл

@ -45,10 +45,15 @@ this.NFC_NOTIFICATION_TECH_DISCOVERED = 2001;
this.NFC_NOTIFICATION_TECH_LOST = 2002;
this.NFC_TECHS = {
0:'NDEF',
1:'NDEF_WRITEABLE',
2:'NDEF_FORMATABLE',
3:'P2P'
0:"NDEF",
1:"NDEF_WRITEABLE",
2:"NDEF_FORMATABLE",
3:"P2P",
4:"NFC_A",
5:"NFC_B",
6:"NFC_F",
7:"NFC_V",
8:"NFC_ISO_DEP"
};
// TODO: Bug 933595. Fill-in all error codes for Gonk/nfcd protocol
@ -63,7 +68,6 @@ this.NFC_POWER_LEVEL_ENABLED = 2;
this.TOPIC_MOZSETTINGS_CHANGED = "mozsettings-changed";
this.TOPIC_XPCOM_SHUTDOWN = "xpcom-shutdown";
this.TOPIC_HARDWARE_STATE = "nfc-hardware-state-change";
this.SETTING_NFC_ENABLED = "nfc.enabled";
this.NFC_PEER_EVENT_READY = 0x01;

Просмотреть файл

@ -17,12 +17,7 @@ ok("generateCRMFRequest" in window.crypto,
"generateCRMFRequest in window.crypto");
ok("importUserCertificates" in window.crypto,
"importUserCertificates in window.crypto");
ok("popChallengeResponse" in window.crypto,
"popChallengeResponse in window.crypto");
ok("random" in window.crypto, "random in window.crypto");
ok("signText" in window.crypto, "signText in window.crypto");
ok("disableRightClick" in window.crypto,
"disableRightClick in window.crypto");
function jsCallback () {
}

Просмотреть файл

@ -17,12 +17,7 @@ ok(!("generateCRMFRequest" in window.crypto),
"generateCRMFRequest not in window.crypto");
ok(!("importUserCertificates" in window.crypto),
"importUserCertificates not in window.crypto");
ok(!("popChallengeResponse" in window.crypto),
"popChallengeResponse not in window.crypto");
ok(!("random" in window.crypto), "random not in window.crypto");
ok(!("signText" in window.crypto), "signText not in window.crypto");
ok(!("disableRightClick" in window.crypto),
"disableRightClick not in window.crypto");
</script>
</body></html>

Просмотреть файл

@ -39,21 +39,12 @@ interface CryptoLegacy {
DOMString cmmfResponse,
boolean doForcedBackup);
[Throws]
DOMString popChallengeResponse(DOMString challenge);
[Throws]
DOMString random(long numBytes);
DOMString signText(DOMString stringToSign,
DOMString caOption,
ByteString... args);
[Throws]
void logout();
[Throws]
void disableRightClick();
};
Crypto implements CryptoLegacy;

Просмотреть файл

@ -29,7 +29,5 @@
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

Просмотреть файл

@ -4,14 +4,14 @@
* 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/. */
#ifndef js_Tracer_h
#define js_Tracer_h
#ifndef js_TracingAPI_h
#define js_TracingAPI_h
#include "mozilla/NullPtr.h"
#include "jspubtd.h"
struct JSTracer;
class JS_PUBLIC_API(JSTracer);
namespace JS {
template <typename T> class Heap;
@ -46,75 +46,102 @@ enum WeakMapTraceKind {
TraceWeakMapKeysValues = 2
};
struct JSTracer {
JSRuntime *runtime;
JSTraceCallback callback;
JSTraceNamePrinter debugPrinter;
const void *debugPrintArg;
size_t debugPrintIndex;
WeakMapTraceKind eagerlyTraceWeakMaps;
class JS_PUBLIC_API(JSTracer)
{
public:
JSTracer(JSRuntime *rt, JSTraceCallback traceCallback,
WeakMapTraceKind weakTraceKind = TraceWeakMapValues);
// Set debugging information about a reference to a traceable thing to prepare
// for the following call to JS_CallTracer.
//
// When printer is null, arg must be const char * or char * C string naming
// the reference and index must be either (size_t)-1 indicating that the name
// alone describes the reference or it must be an index into some array vector
// that stores the reference.
//
// When printer callback is not null, the arg and index arguments are
// available to the callback as debugPrintArg_ and debugPrintIndex_ fields
// of JSTracer.
//
// The storage for name or callback's arguments needs to live only until
// the following call to JS_CallTracer returns.
void setTracingDetails(JSTraceNamePrinter printer, const void *arg, size_t index) {
debugPrinter_ = printer;
debugPrintArg_ = arg;
debugPrintIndex_ = index;
}
void setTracingIndex(const char *name, size_t index) {
setTracingDetails(nullptr, (void *)name, index);
}
void setTracingName(const char *name) {
setTracingDetails(nullptr, (void *)name, size_t(-1));
}
// Remove the currently set tracing details.
void clearTracingDetails() {
debugPrinter_ = nullptr;
debugPrintArg_ = nullptr;
}
// Return true if tracing details are currently set.
bool hasTracingDetails() const;
// Get the string set with the most recent call to setTracingName or return
// fallback if a name printer function has been installed.
const char *tracingName(const char *fallback) const;
// Build a description of this edge in the heap graph. This call may invoke
// the debug printer, which may inspect arbitrary areas of the heap.
const char *getTracingEdgeName(char *buffer, size_t bufferSize);
// Access the currently active tracing details.
JSTraceNamePrinter debugPrinter() const;
const void *debugPrintArg() const;
size_t debugPrintIndex() const;
// Return the runtime set on the tracer.
JSRuntime *runtime() const { return runtime_; }
// Return the weak map tracing behavior set on this tracer.
WeakMapTraceKind eagerlyTraceWeakMaps() const { return eagerlyTraceWeakMaps_; }
// Update the trace callback.
void setTraceCallback(JSTraceCallback traceCallback);
#ifdef JS_GC_ZEAL
void *realLocation;
// Sets the "real" location for a marked reference, when passing the address
// directly is not feasable. This address is used for matching against the
// store buffer when verifying the correctness of the entrees there.
//
// This is currently complicated by our need to nest calls for Values
// stored as keys in hash tables.
void setTracingLocation(void *location);
void unsetTracingLocation();
void **tracingLocation(void **thingp);
#else
void setTracingLocation(void *location) {}
void unsetTracingLocation() {}
void **tracingLocation(void **thingp) { return nullptr; }
#endif
// We expose |callback| directly so that IS_GC_MARKING_TRACER can compare
// it to GCMarker::GrayCallback.
JSTraceCallback callback;
private:
JSRuntime *runtime_;
JSTraceNamePrinter debugPrinter_;
const void *debugPrintArg_;
size_t debugPrintIndex_;
WeakMapTraceKind eagerlyTraceWeakMaps_;
#ifdef JS_GC_ZEAL
void *realLocation_;
#endif
};
// Set debugging information about a reference to a traceable thing to prepare
// for the following call to JS_CallTracer.
//
// When printer is null, arg must be const char * or char * C string naming
// the reference and index must be either (size_t)-1 indicating that the name
// alone describes the reference or it must be an index into some array vector
// that stores the reference.
//
// When printer callback is not null, the arg and index arguments are
// available to the callback as debugPrintArg and debugPrintIndex fields
// of JSTracer.
//
// The storage for name or callback's arguments needs to live only until
// the following call to JS_CallTracer returns.
//
# define JS_SET_TRACING_DETAILS(trc, printer, arg, index) \
JS_BEGIN_MACRO \
(trc)->debugPrinter = (printer); \
(trc)->debugPrintArg = (arg); \
(trc)->debugPrintIndex = (index); \
JS_END_MACRO
// Sets the real location for a marked reference, when passing the address
// directly is not feasable.
//
// FIXME: This is currently overcomplicated by our need to nest calls for Values
// stored as keys in hash tables, but will get simplified once we can rekey
// in-place.
//
#ifdef JS_GC_ZEAL
# define JS_SET_TRACING_LOCATION(trc, location) \
JS_BEGIN_MACRO \
if (!(trc)->realLocation || !(location)) \
(trc)->realLocation = (location); \
JS_END_MACRO
# define JS_UNSET_TRACING_LOCATION(trc) \
JS_BEGIN_MACRO \
(trc)->realLocation = nullptr; \
JS_END_MACRO
#else
# define JS_SET_TRACING_LOCATION(trc, location) \
JS_BEGIN_MACRO \
JS_END_MACRO
# define JS_UNSET_TRACING_LOCATION(trc) \
JS_BEGIN_MACRO \
JS_END_MACRO
#endif
// Convenience macro to describe the argument of JS_CallTracer using C string
// and index.
# define JS_SET_TRACING_INDEX(trc, name, index) \
JS_SET_TRACING_DETAILS(trc, nullptr, name, index)
// Convenience macro to describe the argument of JS_CallTracer using C string.
# define JS_SET_TRACING_NAME(trc, name) \
JS_SET_TRACING_DETAILS(trc, nullptr, name, (size_t)-1)
// The JS_Call*Tracer family of functions traces the given GC thing reference.
// This performs the tracing action configured on the given JSTracer:
// typically calling the JSTracer::callback or marking the thing as live.
@ -165,7 +192,7 @@ inline void
JS_CallHashSetObjectTracer(JSTracer *trc, HashSetEnum &e, JSObject *const &key, const char *name)
{
JSObject *updated = key;
JS_SET_TRACING_LOCATION(trc, reinterpret_cast<void *>(&const_cast<JSObject *&>(key)));
trc->setTracingLocation(reinterpret_cast<void *>(&const_cast<JSObject *&>(key)));
JS_CallObjectTracer(trc, &updated, name);
if (updated != key)
e.rekeyFront(key, updated);
@ -176,10 +203,6 @@ JS_CallHashSetObjectTracer(JSTracer *trc, HashSetEnum &e, JSObject *const &key,
extern JS_PUBLIC_API(void)
JS_CallTenuredObjectTracer(JSTracer *trc, JS::TenuredHeap<JSObject *> *objp, const char *name);
// API for JSTraceCallback implementations.
extern JS_PUBLIC_API(void)
JS_TracerInit(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback);
extern JS_PUBLIC_API(void)
JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind);
@ -190,7 +213,4 @@ extern JS_PUBLIC_API(void)
JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc,
void *thing, JSGCTraceKind kind, bool includeDetails);
extern JS_PUBLIC_API(const char *)
JS_GetTraceEdgeName(JSTracer *trc, char *buffer, int bufferSize);
#endif /* js_Tracer_h */
#endif /* js_TracingAPI_h */

Просмотреть файл

@ -829,7 +829,7 @@ HashableValue
HashableValue::mark(JSTracer *trc) const
{
HashableValue hv(*this);
JS_SET_TRACING_LOCATION(trc, (void *)this);
trc->setTracingLocation((void *)this);
gc::MarkValue(trc, &hv.value, "key");
return hv;
}

Просмотреть файл

@ -665,7 +665,7 @@ regexp_test_impl(JSContext *cx, CallArgs args)
MatchConduit conduit(&match);
RegExpRunStatus status = ExecuteRegExp(cx, args, conduit);
args.rval().setBoolean(status == RegExpRunStatus_Success);
return (status != RegExpRunStatus_Error);
return status != RegExpRunStatus_Error;
}
/* Separate interface for use by IonMonkey. */
@ -676,7 +676,7 @@ js::regexp_test_raw(JSContext *cx, HandleObject regexp, HandleString input, bool
MatchConduit conduit(&match);
RegExpRunStatus status = ExecuteRegExp(cx, regexp, input, conduit, UpdateRegExpStatics);
*result = (status == RegExpRunStatus_Success);
return (status != RegExpRunStatus_Error);
return status != RegExpRunStatus_Error;
}
bool
@ -701,5 +701,5 @@ js::regexp_test_no_statics(JSContext *cx, unsigned argc, Value *vp)
MatchConduit conduit(&match);
RegExpRunStatus status = ExecuteRegExp(cx, regexp, string, conduit, DontUpdateRegExpStatics);
args.rval().setBoolean(status == RegExpRunStatus_Success);
return (status != RegExpRunStatus_Error);
return status != RegExpRunStatus_Error;
}

Просмотреть файл

@ -684,20 +684,24 @@ struct JSCountHeapNode {
typedef HashSet<void *, PointerHasher<void *, 3>, SystemAllocPolicy> VisitedSet;
typedef struct JSCountHeapTracer {
class CountHeapTracer
{
public:
CountHeapTracer(JSRuntime *rt, JSTraceCallback callback) : base(rt, callback) {}
JSTracer base;
VisitedSet visited;
JSCountHeapNode *traceList;
JSCountHeapNode *recycleList;
bool ok;
} JSCountHeapTracer;
};
static void
CountHeapNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind)
{
JS_ASSERT(trc->callback == CountHeapNotify);
JSCountHeapTracer *countTracer = (JSCountHeapTracer *)trc;
CountHeapTracer *countTracer = (CountHeapTracer *)trc;
void *thing = *thingp;
if (!countTracer->ok)
@ -793,8 +797,7 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp)
}
}
JSCountHeapTracer countTracer;
JS_TracerInit(&countTracer.base, JS_GetRuntime(cx), CountHeapNotify);
CountHeapTracer countTracer(JS_GetRuntime(cx), CountHeapNotify);
if (!countTracer.visited.init()) {
JS_ReportOutOfMemory(cx);
return false;

Просмотреть файл

@ -815,7 +815,7 @@ class MOZ_STACK_CLASS TokenStream
#endif
static bool isRawEOLChar(int32_t c) {
return (c == '\n' || c == '\r' || c == LINE_SEPARATOR || c == PARA_SEPARATOR);
return c == '\n' || c == '\r' || c == LINE_SEPARATOR || c == PARA_SEPARATOR;
}
// Finds the next EOL, but stops once 'max' jschars have been scanned

Просмотреть файл

@ -22,8 +22,8 @@ js::TraceRuntime(JSTracer *trc)
{
JS_ASSERT(!IS_GC_MARKING_TRACER(trc));
MinorGC(trc->runtime, JS::gcreason::EVICT_NURSERY);
AutoPrepareForTracing prep(trc->runtime, WithAtoms);
MinorGC(trc->runtime(), JS::gcreason::EVICT_NURSERY);
AutoPrepareForTracing prep(trc->runtime(), WithAtoms);
MarkRuntime(trc);
}

Просмотреть файл

@ -153,7 +153,7 @@ CheckMarkedThing(JSTracer *trc, T *thing)
JS_ASSERT(thing);
/* This function uses data that's not available in the nursery. */
if (IsInsideNursery(trc->runtime, thing))
if (IsInsideNursery(trc->runtime(), thing))
return;
/*
@ -164,10 +164,10 @@ CheckMarkedThing(JSTracer *trc, T *thing)
return;
JS_ASSERT(thing->zone());
JS_ASSERT(thing->zone()->runtimeFromMainThread() == trc->runtime);
JS_ASSERT(trc->debugPrinter || trc->debugPrintArg);
JS_ASSERT(thing->zone()->runtimeFromMainThread() == trc->runtime());
JS_ASSERT(trc->hasTracingDetails());
DebugOnly<JSRuntime *> rt = trc->runtime;
DebugOnly<JSRuntime *> rt = trc->runtime();
JS_ASSERT_IF(IS_GC_MARKING_TRACER(trc) && rt->gcManipulatingDeadZones,
!thing->zone()->scheduledForDestruction);
@ -217,7 +217,7 @@ MarkInternal(JSTracer *trc, T **thingp)
* not needed in this case because we perform a minor collection before
* each incremental slice.
*/
if (IsInsideNursery(trc->runtime, thing))
if (IsInsideNursery(trc->runtime(), thing))
return;
/*
@ -239,17 +239,16 @@ MarkInternal(JSTracer *trc, T **thingp)
thing->zone()->maybeAlive = true;
} else {
trc->callback(trc, (void **)thingp, MapTypeToTraceKind<T>::kind);
JS_UNSET_TRACING_LOCATION(trc);
trc->unsetTracingLocation();
}
trc->debugPrinter = nullptr;
trc->debugPrintArg = nullptr;
trc->clearTracingDetails();
}
#define JS_ROOT_MARKING_ASSERT(trc) \
JS_ASSERT_IF(IS_GC_MARKING_TRACER(trc), \
trc->runtime->gcIncrementalState == NO_INCREMENTAL || \
trc->runtime->gcIncrementalState == MARK_ROOTS);
trc->runtime()->gcIncrementalState == NO_INCREMENTAL || \
trc->runtime()->gcIncrementalState == MARK_ROOTS);
namespace js {
namespace gc {
@ -258,7 +257,7 @@ template <typename T>
void
MarkUnbarriered(JSTracer *trc, T **thingp, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkInternal(trc, thingp);
}
@ -266,14 +265,14 @@ template <typename T>
static void
Mark(JSTracer *trc, BarrieredPtr<T> *thing, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkInternal(trc, thing->unsafeGet());
}
void
MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
JS_ASSERT(atom->isPermanent());
@ -287,11 +286,10 @@ MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name)
void *thing = atom;
trc->callback(trc, &thing, JSTRACE_STRING);
JS_ASSERT(thing == atom);
JS_UNSET_TRACING_LOCATION(trc);
trc->unsetTracingLocation();
}
trc->debugPrinter = nullptr;
trc->debugPrintArg = nullptr;
trc->clearTracingDetails();
}
} /* namespace gc */
@ -302,7 +300,7 @@ static void
MarkRoot(JSTracer *trc, T **thingp, const char *name)
{
JS_ROOT_MARKING_ASSERT(trc);
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkInternal(trc, thingp);
}
@ -312,7 +310,7 @@ MarkRange(JSTracer *trc, size_t len, HeapPtr<T> *vec, const char *name)
{
for (size_t i = 0; i < len; ++i) {
if (vec[i].get()) {
JS_SET_TRACING_INDEX(trc, name, i);
trc->setTracingIndex(name, i);
MarkInternal(trc, vec[i].unsafeGet());
}
}
@ -325,7 +323,7 @@ MarkRootRange(JSTracer *trc, size_t len, T **vec, const char *name)
JS_ROOT_MARKING_ASSERT(trc);
for (size_t i = 0; i < len; ++i) {
if (vec[i]) {
JS_SET_TRACING_INDEX(trc, name, i);
trc->setTracingIndex(name, i);
MarkInternal(trc, &vec[i]);
}
}
@ -537,7 +535,7 @@ gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind)
static void
MarkGCThingInternal(JSTracer *trc, void **thingp, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
JS_ASSERT(thingp);
if (!*thingp)
return;
@ -564,24 +562,24 @@ MarkIdInternal(JSTracer *trc, jsid *id)
{
if (JSID_IS_STRING(*id)) {
JSString *str = JSID_TO_STRING(*id);
JS_SET_TRACING_LOCATION(trc, (void *)id);
trc->setTracingLocation((void *)id);
MarkInternal(trc, &str);
*id = NON_INTEGER_ATOM_TO_JSID(reinterpret_cast<JSAtom *>(str));
} else if (MOZ_UNLIKELY(JSID_IS_OBJECT(*id))) {
JSObject *obj = JSID_TO_OBJECT(*id);
JS_SET_TRACING_LOCATION(trc, (void *)id);
trc->setTracingLocation((void *)id);
MarkInternal(trc, &obj);
*id = OBJECT_TO_JSID(obj);
} else {
/* Unset realLocation manually if we do not call MarkInternal. */
JS_UNSET_TRACING_LOCATION(trc);
trc->unsetTracingLocation();
}
}
void
gc::MarkId(JSTracer *trc, BarrieredId *id, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkIdInternal(trc, id->unsafeGet());
}
@ -589,14 +587,14 @@ void
gc::MarkIdRoot(JSTracer *trc, jsid *id, const char *name)
{
JS_ROOT_MARKING_ASSERT(trc);
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkIdInternal(trc, id);
}
void
gc::MarkIdUnbarriered(JSTracer *trc, jsid *id, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkIdInternal(trc, id);
}
@ -604,7 +602,7 @@ void
gc::MarkIdRange(JSTracer *trc, size_t len, HeapId *vec, const char *name)
{
for (size_t i = 0; i < len; ++i) {
JS_SET_TRACING_INDEX(trc, name, i);
trc->setTracingIndex(name, i);
MarkIdInternal(trc, vec[i].unsafeGet());
}
}
@ -614,7 +612,7 @@ gc::MarkIdRootRange(JSTracer *trc, size_t len, jsid *vec, const char *name)
{
JS_ROOT_MARKING_ASSERT(trc);
for (size_t i = 0; i < len; ++i) {
JS_SET_TRACING_INDEX(trc, name, i);
trc->setTracingIndex(name, i);
MarkIdInternal(trc, &vec[i]);
}
}
@ -627,7 +625,7 @@ MarkValueInternal(JSTracer *trc, Value *v)
if (v->isMarkable()) {
JS_ASSERT(v->toGCThing());
void *thing = v->toGCThing();
JS_SET_TRACING_LOCATION(trc, (void *)v);
trc->setTracingLocation((void *)v);
MarkKind(trc, &thing, v->gcKind());
if (v->isString())
v->setString((JSString *)thing);
@ -635,14 +633,14 @@ MarkValueInternal(JSTracer *trc, Value *v)
v->setObjectOrNull((JSObject *)thing);
} else {
/* Unset realLocation manually if we do not call MarkInternal. */
JS_UNSET_TRACING_LOCATION(trc);
trc->unsetTracingLocation();
}
}
void
gc::MarkValue(JSTracer *trc, BarrieredValue *v, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkValueInternal(trc, v->unsafeGet());
}
@ -650,7 +648,7 @@ void
gc::MarkValueRoot(JSTracer *trc, Value *v, const char *name)
{
JS_ROOT_MARKING_ASSERT(trc);
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkValueInternal(trc, v);
}
@ -658,7 +656,7 @@ void
gc::MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name)
{
JS_ROOT_MARKING_ASSERT(trc);
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
if (v->isSingleObject()) {
JSObject *obj = v->singleObject();
MarkInternal(trc, &obj);
@ -674,7 +672,7 @@ void
gc::MarkValueRange(JSTracer *trc, size_t len, BarrieredValue *vec, const char *name)
{
for (size_t i = 0; i < len; ++i) {
JS_SET_TRACING_INDEX(trc, name, i);
trc->setTracingIndex(name, i);
MarkValueInternal(trc, vec[i].unsafeGet());
}
}
@ -684,7 +682,7 @@ gc::MarkValueRootRange(JSTracer *trc, size_t len, Value *vec, const char *name)
{
JS_ROOT_MARKING_ASSERT(trc);
for (size_t i = 0; i < len; ++i) {
JS_SET_TRACING_INDEX(trc, name, i);
trc->setTracingIndex(name, i);
MarkValueInternal(trc, &vec[i]);
}
}
@ -734,7 +732,7 @@ gc::IsSlotMarked(HeapSlot *s)
void
gc::MarkSlot(JSTracer *trc, HeapSlot *s, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkValueInternal(trc, s->unsafeGet());
}
@ -742,7 +740,7 @@ void
gc::MarkArraySlots(JSTracer *trc, size_t len, HeapSlot *vec, const char *name)
{
for (size_t i = 0; i < len; ++i) {
JS_SET_TRACING_INDEX(trc, name, i);
trc->setTracingIndex(name, i);
MarkValueInternal(trc, vec[i].unsafeGet());
}
}
@ -752,7 +750,7 @@ gc::MarkObjectSlots(JSTracer *trc, JSObject *obj, uint32_t start, uint32_t nslot
{
JS_ASSERT(obj->isNative());
for (uint32_t i = start; i < (start + nslots); ++i) {
JS_SET_TRACING_DETAILS(trc, js_GetObjectSlotName, obj, i);
trc->setTracingDetails(js_GetObjectSlotName, obj, i);
MarkValueInternal(trc, obj->nativeGetSlotRef(i).unsafeGet());
}
}
@ -766,7 +764,7 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell)
uint32_t color = AsGCMarker(trc)->getMarkColor();
JS_ASSERT(color == BLACK || color == GRAY);
if (IsInsideNursery(trc->runtime, cell)) {
if (IsInsideNursery(trc->runtime(), cell)) {
JS_ASSERT(color == BLACK);
return false;
}
@ -782,7 +780,7 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell)
*/
if (cell->isMarked(GRAY)) {
JS_ASSERT(!zone->isCollecting());
trc->runtime->gcFoundBlackGrayEdges = true;
trc->runtime()->gcFoundBlackGrayEdges = true;
}
return zone->isGCMarking();
} else {
@ -827,14 +825,14 @@ gc::MarkCrossCompartmentSlot(JSTracer *trc, JSObject *src, HeapSlot *dst, const
void
gc::MarkObject(JSTracer *trc, HeapPtr<GlobalObject, JSScript *> *thingp, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkInternal(trc, thingp->unsafeGet());
}
void
gc::MarkValueUnbarriered(JSTracer *trc, Value *v, const char *name)
{
JS_SET_TRACING_NAME(trc, name);
trc->setTracingName(name);
MarkValueInternal(trc, v);
}
@ -862,8 +860,8 @@ gc::IsCellAboutToBeFinalized(Cell **thingp)
static void
PushMarkStack(GCMarker *gcmarker, ObjectImpl *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
if (thing->markIfUnmarked(gcmarker->getMarkColor()))
gcmarker->pushObject(thing);
@ -879,7 +877,7 @@ PushMarkStack(GCMarker *gcmarker, ObjectImpl *thing)
static void
MaybePushMarkStackBetweenSlices(GCMarker *gcmarker, JSObject *thing)
{
JSRuntime *rt = gcmarker->runtime;
JSRuntime *rt = gcmarker->runtime();
JS_COMPARTMENT_ASSERT(rt, thing);
JS_ASSERT_IF(rt->isHeapBusy(), !IsInsideNursery(rt, thing));
@ -890,8 +888,8 @@ MaybePushMarkStackBetweenSlices(GCMarker *gcmarker, JSObject *thing)
static void
PushMarkStack(GCMarker *gcmarker, JSFunction *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
if (thing->markIfUnmarked(gcmarker->getMarkColor()))
gcmarker->pushObject(thing);
@ -900,8 +898,8 @@ PushMarkStack(GCMarker *gcmarker, JSFunction *thing)
static void
PushMarkStack(GCMarker *gcmarker, types::TypeObject *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
if (thing->markIfUnmarked(gcmarker->getMarkColor()))
gcmarker->pushType(thing);
@ -910,8 +908,8 @@ PushMarkStack(GCMarker *gcmarker, types::TypeObject *thing)
static void
PushMarkStack(GCMarker *gcmarker, JSScript *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
/*
* We mark scripts directly rather than pushing on the stack as they can
@ -925,8 +923,8 @@ PushMarkStack(GCMarker *gcmarker, JSScript *thing)
static void
PushMarkStack(GCMarker *gcmarker, LazyScript *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
/*
* We mark lazy scripts directly rather than pushing on the stack as they
@ -942,8 +940,8 @@ ScanShape(GCMarker *gcmarker, Shape *shape);
static void
PushMarkStack(GCMarker *gcmarker, Shape *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
/* We mark shapes directly rather than pushing on the stack. */
if (thing->markIfUnmarked(gcmarker->getMarkColor()))
@ -953,8 +951,8 @@ PushMarkStack(GCMarker *gcmarker, Shape *thing)
static void
PushMarkStack(GCMarker *gcmarker, jit::JitCode *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
if (thing->markIfUnmarked(gcmarker->getMarkColor()))
gcmarker->pushJitCode(thing);
@ -966,8 +964,8 @@ ScanBaseShape(GCMarker *gcmarker, BaseShape *base);
static void
PushMarkStack(GCMarker *gcmarker, BaseShape *thing)
{
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime, thing));
JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing);
JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing));
/* We mark base shapes directly rather than pushing on the stack. */
if (thing->markIfUnmarked(gcmarker->getMarkColor()))
@ -1028,7 +1026,7 @@ ScanBaseShape(GCMarker *gcmarker, BaseShape *base)
static inline void
ScanLinearString(GCMarker *gcmarker, JSLinearString *str)
{
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime, str);
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), str);
JS_ASSERT(str->isMarked());
/*
@ -1041,7 +1039,7 @@ ScanLinearString(GCMarker *gcmarker, JSLinearString *str)
JS_ASSERT(str->JSString::isLinear());
if (str->isPermanentAtom())
break;
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime, str);
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), str);
if (!str->markIfUnmarked())
break;
}
@ -1064,7 +1062,7 @@ ScanRope(GCMarker *gcmarker, JSRope *rope)
for (;;) {
JS_DIAGNOSTICS_ASSERT(GetGCThingTraceKind(rope) == JSTRACE_STRING);
JS_DIAGNOSTICS_ASSERT(rope->JSString::isRope());
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime, rope);
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), rope);
JS_ASSERT(rope->isMarked());
JSRope *next = nullptr;
@ -1118,7 +1116,7 @@ PushMarkStack(GCMarker *gcmarker, JSString *str)
if (str->isPermanentAtom())
return;
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime, str);
JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), str);
/*
* As string can only refer to other strings we fully scan its GC graph
@ -1490,7 +1488,7 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
if (tag == ObjectTag) {
obj = reinterpret_cast<JSObject *>(addr);
JS_COMPARTMENT_ASSERT(runtime, obj);
JS_COMPARTMENT_ASSERT(runtime(), obj);
goto scan_obj;
}
@ -1504,14 +1502,14 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
if (v.isString()) {
JSString *str = v.toString();
if (!str->isPermanentAtom()) {
JS_COMPARTMENT_ASSERT_STR(runtime, str);
JS_ASSERT(runtime->isAtomsZone(str->zone()) || str->zone() == obj->zone());
JS_COMPARTMENT_ASSERT_STR(runtime(), str);
JS_ASSERT(runtime()->isAtomsZone(str->zone()) || str->zone() == obj->zone());
if (str->markIfUnmarked())
ScanString(this, str);
}
} else if (v.isObject()) {
JSObject *obj2 = &v.toObject();
JS_COMPARTMENT_ASSERT(runtime, obj2);
JS_COMPARTMENT_ASSERT(runtime(), obj2);
JS_ASSERT(obj->compartment() == obj2->compartment());
if (obj2->markIfUnmarked(getMarkColor())) {
pushValueArray(obj, vp, end);
@ -1524,7 +1522,7 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
scan_obj:
{
JS_COMPARTMENT_ASSERT(runtime, obj);
JS_COMPARTMENT_ASSERT(runtime(), obj);
budget.step();
if (budget.isOverBudget()) {
@ -1544,8 +1542,8 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
// Global objects all have the same trace hook. That hook is safe without barriers
// if the gloal has no custom trace hook of it's own, or has been moved to a different
// compartment, and so can't have one.
JS_ASSERT_IF(runtime->gcMode() == JSGC_MODE_INCREMENTAL &&
runtime->gcIncrementalEnabled &&
JS_ASSERT_IF(runtime()->gcMode() == JSGC_MODE_INCREMENTAL &&
runtime()->gcIncrementalEnabled &&
!(clasp->trace == JS_GlobalObjectTraceHook &&
(!obj->compartment()->options().getTrace() ||
!obj->isOwnGlobal())),
@ -1586,7 +1584,7 @@ bool
GCMarker::drainMarkStack(SliceBudget &budget)
{
#ifdef DEBUG
JSRuntime *rt = runtime;
JSRuntime *rt = runtime();
struct AutoCheckCompartment {
JSRuntime *runtime;
@ -1681,18 +1679,18 @@ struct UnmarkGrayTracer : public JSTracer
* up any color mismatches involving weakmaps when it runs.
*/
UnmarkGrayTracer(JSRuntime *rt)
: tracingShape(false), previousShape(nullptr), unmarkedAny(false)
{
JS_TracerInit(this, rt, UnmarkGrayChildren);
eagerlyTraceWeakMaps = DoNotTraceWeakMaps;
}
: JSTracer(rt, UnmarkGrayChildren, DoNotTraceWeakMaps),
tracingShape(false),
previousShape(nullptr),
unmarkedAny(false)
{}
UnmarkGrayTracer(JSTracer *trc, bool tracingShape)
: tracingShape(tracingShape), previousShape(nullptr), unmarkedAny(false)
{
JS_TracerInit(this, trc->runtime, UnmarkGrayChildren);
eagerlyTraceWeakMaps = DoNotTraceWeakMaps;
}
: JSTracer(trc->runtime(), UnmarkGrayChildren, DoNotTraceWeakMaps),
tracingShape(tracingShape),
previousShape(nullptr),
unmarkedAny(false)
{}
/* True iff we are tracing the immediate children of a shape. */
bool tracingShape;
@ -1739,17 +1737,17 @@ UnmarkGrayChildren(JSTracer *trc, void **thingp, JSGCTraceKind kind)
{
void *thing = *thingp;
int stackDummy;
if (!JS_CHECK_STACK_SIZE(trc->runtime->mainThread.nativeStackLimit[StackForSystemCode], &stackDummy)) {
if (!JS_CHECK_STACK_SIZE(trc->runtime()->mainThread.nativeStackLimit[StackForSystemCode], &stackDummy)) {
/*
* If we run out of stack, we take a more drastic measure: require that
* we GC again before the next CC.
*/
trc->runtime->gcGrayBitsValid = false;
trc->runtime()->gcGrayBitsValid = false;
return;
}
UnmarkGrayTracer *tracer = static_cast<UnmarkGrayTracer *>(trc);
if (!IsInsideNursery(trc->runtime, thing)) {
if (!IsInsideNursery(trc->runtime(), thing)) {
if (!JS::GCThingIsMarkedGray(thing))
return;

Просмотреть файл

@ -299,7 +299,7 @@ class MinorCollectionTracer : public JSTracer
}
MinorCollectionTracer(JSRuntime *rt, Nursery *nursery)
: JSTracer(),
: JSTracer(rt, Nursery::MinorGCCallback, TraceWeakMapKeysValues),
nursery(nursery),
session(rt, MinorCollecting),
tenuredSize(0),
@ -308,8 +308,6 @@ class MinorCollectionTracer : public JSTracer
savedRuntimeNeedBarrier(rt->needsBarrier()),
disableStrictProxyChecking(rt)
{
JS_TracerInit(this, rt, Nursery::MinorGCCallback);
eagerlyTraceWeakMaps = TraceWeakMapKeysValues;
rt->gcNumber++;
/*
@ -337,8 +335,8 @@ class MinorCollectionTracer : public JSTracer
}
~MinorCollectionTracer() {
runtime->setNeedsBarrier(savedRuntimeNeedBarrier);
if (runtime->gcIncrementalState != NO_INCREMENTAL)
runtime()->setNeedsBarrier(savedRuntimeNeedBarrier);
if (runtime()->gcIncrementalState != NO_INCREMENTAL)
ArrayBufferObject::restoreArrayBufferLists(liveArrayBuffers);
}
};
@ -536,7 +534,7 @@ void *
js::Nursery::moveToTenured(MinorCollectionTracer *trc, JSObject *src)
{
Zone *zone = src->zone();
AllocKind dstKind = GetObjectAllocKindForCopy(trc->runtime, src);
AllocKind dstKind = GetObjectAllocKindForCopy(trc->runtime(), src);
JSObject *dst = static_cast<JSObject *>(allocateFromTenured(zone, dstKind));
if (!dst)
CrashAtUnhandlableOOM("Failed to allocate object while tenuring.");

Просмотреть файл

@ -88,10 +88,10 @@ static void
MarkExactStackRoots(JSTracer *trc)
{
for (unsigned i = 0; i < THING_ROOT_LIMIT; i++) {
for (ContextIter cx(trc->runtime); !cx.done(); cx.next())
for (ContextIter cx(trc->runtime()); !cx.done(); cx.next())
MarkExactStackRootList(trc, cx->thingGCRooters[i], ThingRootKind(i));
MarkExactStackRootList(trc, trc->runtime->mainThread.thingGCRooters[i], ThingRootKind(i));
MarkExactStackRootList(trc, trc->runtime()->mainThread.thingGCRooters[i], ThingRootKind(i));
}
}
#endif /* JSGC_USE_EXACT_ROOTING */
@ -197,7 +197,7 @@ MarkIfGCThingWord(JSTracer *trc, uintptr_t w)
ArenaHeader *aheader;
AllocKind thingKind;
ConservativeGCTest status =
IsAddressableGCThing(trc->runtime, w, IS_GC_MARKING_TRACER(trc),
IsAddressableGCThing(trc->runtime(), w, IS_GC_MARKING_TRACER(trc),
&thingKind, &aheader, &thing);
if (status != CGCT_VALID)
return status;
@ -215,16 +215,16 @@ MarkIfGCThingWord(JSTracer *trc, uintptr_t w)
const char pattern[] = "machine_stack %p";
char nameBuf[sizeof(pattern) - 2 + sizeof(thing) * 2];
JS_snprintf(nameBuf, sizeof(nameBuf), pattern, thing);
JS_SET_TRACING_NAME(trc, nameBuf);
trc->setTracingName(nameBuf);
#endif
JS_SET_TRACING_LOCATION(trc, (void *)w);
trc->setTracingLocation((void *)w);
void *tmp = thing;
MarkKind(trc, &tmp, traceKind);
JS_ASSERT(tmp == thing);
#ifdef DEBUG
if (trc->runtime->gcIncrementalState == MARK_ROOTS)
trc->runtime->mainThread.gcSavedRoots.append(
if (trc->runtime()->gcIncrementalState == MARK_ROOTS)
trc->runtime()->mainThread.gcSavedRoots.append(
PerThreadData::SavedGCRoot(thing, traceKind));
#endif
@ -286,7 +286,7 @@ MarkRangeConservativelyAndSkipIon(JSTracer *trc, JSRuntime *rt, const uintptr_t
static MOZ_NEVER_INLINE void
MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots)
{
JSRuntime *rt = trc->runtime;
JSRuntime *rt = trc->runtime();
#ifdef DEBUG
if (useSavedRoots) {
@ -294,7 +294,7 @@ MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots)
root != rt->mainThread.gcSavedRoots.end();
root++)
{
JS_SET_TRACING_NAME(trc, "cstack");
trc->setTracingName("cstack");
MarkKind(trc, &root->thing, root->kind);
}
return;
@ -469,7 +469,7 @@ AutoGCRooter::trace(JSTracer *trc)
AutoObjectObjectHashMap::HashMapImpl &map = static_cast<AutoObjectObjectHashMap *>(this)->map;
for (AutoObjectObjectHashMap::Enum e(map); !e.empty(); e.popFront()) {
MarkObjectRoot(trc, &e.front().value(), "AutoObjectObjectHashMap value");
JS_SET_TRACING_LOCATION(trc, (void *)&e.front().key());
trc->setTracingLocation((void *)&e.front().key());
JSObject *key = e.front().key();
MarkObjectRoot(trc, &key, "AutoObjectObjectHashMap key");
if (key != e.front().key())
@ -562,7 +562,7 @@ AutoGCRooter::trace(JSTracer *trc)
/* static */ void
AutoGCRooter::traceAll(JSTracer *trc)
{
for (ContextIter cx(trc->runtime); !cx.done(); cx.next()) {
for (ContextIter cx(trc->runtime()); !cx.done(); cx.next()) {
for (js::AutoGCRooter *gcr = cx->autoGCRooters; gcr; gcr = gcr->down)
gcr->trace(trc);
}
@ -571,7 +571,7 @@ AutoGCRooter::traceAll(JSTracer *trc)
/* static */ void
AutoGCRooter::traceAllWrappers(JSTracer *trc)
{
for (ContextIter cx(trc->runtime); !cx.done(); cx.next()) {
for (ContextIter cx(trc->runtime()); !cx.done(); cx.next()) {
for (js::AutoGCRooter *gcr = cx->autoGCRooters; gcr; gcr = gcr->down) {
if (gcr->tag_ == WRAPVECTOR || gcr->tag_ == WRAPPER)
gcr->trace(trc);
@ -645,7 +645,7 @@ struct PersistentRootedMarker
void
js::gc::MarkPersistentRootedChains(JSTracer *trc)
{
JSRuntime *rt = trc->runtime;
JSRuntime *rt = trc->runtime();
// Mark the PersistentRooted chains of types that may be null.
PersistentRootedMarker<JSFunction*>::markChainIfNotNull<MarkObjectRoot>(
@ -667,7 +667,7 @@ js::gc::MarkPersistentRootedChains(JSTracer *trc)
void
js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
{
JSRuntime *rt = trc->runtime;
JSRuntime *rt = trc->runtime();
JS_ASSERT(trc->callback != GCMarker::GrayCallback);
JS_ASSERT(!rt->mainThread.suppressGC);
@ -718,7 +718,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
MarkScriptRoot(trc, &vec[i].script, "scriptAndCountsVector");
}
if (!rt->isBeingDestroyed() && !trc->runtime->isHeapMinorCollecting()) {
if (!rt->isBeingDestroyed() && !trc->runtime()->isHeapMinorCollecting()) {
if (!IS_GC_MARKING_TRACER(trc) || rt->atomsCompartment()->zone()->isCollecting()) {
MarkPermanentAtoms(trc);
MarkAtoms(trc);
@ -749,7 +749,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
/* We can't use GCCompartmentsIter if we're called from TraceRuntime. */
for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
if (trc->runtime->isHeapMinorCollecting())
if (trc->runtime()->isHeapMinorCollecting())
c->globalWriteBarriered = false;
if (IS_GC_MARKING_TRACER(trc) && !c->zone()->isCollecting())
@ -804,7 +804,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
void
js::gc::BufferGrayRoots(GCMarker *gcmarker)
{
JSRuntime *rt = gcmarker->runtime;
JSRuntime *rt = gcmarker->runtime();
gcmarker->startBufferingGrayRoots();
if (JSTraceDataOp op = rt->gcGrayRootTracer.op)
(*op)(gcmarker, rt->gcGrayRootTracer.data);

Просмотреть файл

@ -26,7 +26,7 @@ StoreBuffer::SlotsEdge::mark(JSTracer *trc)
{
JSObject *obj = object();
if (trc->runtime->gcNursery.isInside(obj))
if (trc->runtime()->gcNursery.isInside(obj))
return;
if (!obj->isNative()) {

Просмотреть файл

@ -20,8 +20,8 @@
#include "ds/LifoAlloc.h"
#include "gc/Nursery.h"
#include "gc/Tracer.h"
#include "js/MemoryMetrics.h"
#include "js/Tracer.h"
namespace js {
@ -61,7 +61,7 @@ class HashKeyRef : public BufferableRef
typename Map::Ptr p = map->lookup(key);
if (!p)
return;
JS_SET_TRACING_LOCATION(trc, (void*)&*p);
trc->setTracingLocation(&*p);
Mark(trc, &key, "HashKeyRef");
map->rekeyIfMoved(prior, key);
}

Просмотреть файл

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "js/Tracer.h"
#include "gc/Tracer.h"
#include "jsapi.h"
#include "jsfun.h"
@ -91,18 +91,12 @@ JS_CallTenuredObjectTracer(JSTracer *trc, JS::TenuredHeap<JSObject *> *objp, con
if (!obj)
return;
JS_SET_TRACING_LOCATION(trc, (void*)objp);
trc->setTracingLocation((void*)objp);
MarkObjectUnbarriered(trc, &obj, name);
objp->setPtr(obj);
}
JS_PUBLIC_API(void)
JS_TracerInit(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback)
{
InitTracer(trc, rt, callback);
}
JS_PUBLIC_API(void)
JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
{
@ -112,7 +106,7 @@ JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
JS_PUBLIC_API(void)
JS_TraceRuntime(JSTracer *trc)
{
AssertHeapIsIdle(trc->runtime);
AssertHeapIsIdle(trc->runtime());
TraceRuntime(trc);
}
@ -245,20 +239,90 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing,
buf[bufsize - 1] = '\0';
}
extern JS_PUBLIC_API(const char *)
JS_GetTraceEdgeName(JSTracer *trc, char *buffer, int bufferSize)
JSTracer::JSTracer(JSRuntime *rt, JSTraceCallback traceCallback,
WeakMapTraceKind weakTraceKind /* = TraceWeakMapValues */)
: callback(traceCallback)
, runtime_(rt)
, debugPrinter_(nullptr)
, debugPrintArg_(nullptr)
, debugPrintIndex_(size_t(-1))
, eagerlyTraceWeakMaps_(weakTraceKind)
#ifdef JS_GC_ZEAL
, realLocation_(nullptr)
#endif
{
if (trc->debugPrinter) {
trc->debugPrinter(trc, buffer, bufferSize);
return buffer;
}
if (trc->debugPrintIndex != (size_t) - 1) {
JS_snprintf(buffer, bufferSize, "%s[%lu]",
(const char *)trc->debugPrintArg,
trc->debugPrintIndex);
return buffer;
}
return (const char*)trc->debugPrintArg;
}
bool
JSTracer::hasTracingDetails() const
{
return debugPrinter_ || debugPrintArg_;
}
const char *
JSTracer::tracingName(const char *fallback) const
{
JS_ASSERT(hasTracingDetails());
return debugPrinter_ ? fallback : (const char *)debugPrintArg_;
}
const char *
JSTracer::getTracingEdgeName(char *buffer, size_t bufferSize)
{
if (debugPrinter_) {
debugPrinter_(this, buffer, bufferSize);
return buffer;
}
if (debugPrintIndex_ != size_t(-1)) {
JS_snprintf(buffer, bufferSize, "%s[%lu]",
(const char *)debugPrintArg_,
debugPrintIndex_);
return buffer;
}
return (const char*)debugPrintArg_;
}
JSTraceNamePrinter
JSTracer::debugPrinter() const
{
return debugPrinter_;
}
const void *
JSTracer::debugPrintArg() const
{
return debugPrintArg_;
}
size_t
JSTracer::debugPrintIndex() const
{
return debugPrintIndex_;
}
void
JSTracer::setTraceCallback(JSTraceCallback traceCallback)
{
callback = traceCallback;
}
#ifdef JS_GC_ZEAL
void
JSTracer::setTracingLocation(void *location)
{
if (!realLocation_ || !location)
realLocation_ = location;
}
void
JSTracer::unsetTracingLocation()
{
realLocation_ = nullptr;
}
void **
JSTracer::tracingLocation(void **thingp)
{
return realLocation_ ? (void **)realLocation_ : thingp;
}
#endif

12
js/src/gc/Tracer.h Normal file
Просмотреть файл

@ -0,0 +1,12 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef js_Tracer_h
#define js_Tracer_h
#include "js/TracingAPI.h"
#endif /* js_Tracer_h */

Просмотреть файл

@ -59,7 +59,7 @@ struct EdgeValue
{
void *thing;
JSGCTraceKind kind;
char *label;
const char *label;
};
struct VerifyNode
@ -102,7 +102,9 @@ struct VerifyPreTracer : JSTracer
char *term;
NodeMap nodemap;
VerifyPreTracer(JSRuntime *rt) : noggc(rt), root(nullptr) {}
VerifyPreTracer(JSRuntime *rt, JSTraceCallback callback)
: JSTracer(rt, callback), noggc(rt), number(rt->gcNumber), count(0), root(nullptr)
{}
~VerifyPreTracer() {
js_free(root);
@ -118,7 +120,7 @@ AccumulateEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind)
{
VerifyPreTracer *trc = (VerifyPreTracer *)jstrc;
JS_ASSERT(!IsInsideNursery(trc->runtime, *(uintptr_t **)thingp));
JS_ASSERT(!IsInsideNursery(trc->runtime(), *(uintptr_t **)thingp));
trc->edgeptr += sizeof(EdgeValue);
if (trc->edgeptr >= trc->term) {
@ -131,7 +133,7 @@ AccumulateEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind)
node->edges[i].thing = *thingp;
node->edges[i].kind = kind;
node->edges[i].label = trc->debugPrinter ? nullptr : (char *)trc->debugPrintArg;
node->edges[i].label = trc->tracingName("<unknown>");
node->count++;
}
@ -191,15 +193,17 @@ gc::StartVerifyPreBarriers(JSRuntime *rt)
for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront())
r.front()->bitmap.clear();
VerifyPreTracer *trc = js_new<VerifyPreTracer>(rt);
rt->gcNumber++;
VerifyPreTracer *trc = js_new<VerifyPreTracer>(rt, JSTraceCallback(nullptr));
if (!trc)
return;
rt->gcNumber++;
trc->number = rt->gcNumber;
trc->count = 0;
JS_TracerInit(trc, rt, AccumulateEdge);
/*
* Passing a function pointer directly to js_new trips a compiler bug in
* MSVC. Work around by filling the pointer after allocating with nullptr.
*/
trc->setTraceCallback(AccumulateEdge);
const size_t size = 64 * 1024 * 1024;
trc->root = (VerifyNode *)js_malloc(size);
@ -305,7 +309,7 @@ AssertMarkedOrAllocated(const EdgeValue &edge)
return;
char msgbuf[1024];
const char *label = edge.label ? edge.label : "<unknown>";
const char *label = edge.label;
JS_snprintf(msgbuf, sizeof(msgbuf), "[barrier verifier] Unmarked edge: %s", label);
MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__);
@ -347,7 +351,7 @@ gc::EndVerifyPreBarriers(JSRuntime *rt)
rt->gcIncrementalState = NO_INCREMENTAL;
if (!compartmentCreated && IsIncrementalGCSafe(rt)) {
JS_TracerInit(trc, rt, CheckEdge);
trc->setTraceCallback(CheckEdge);
/* Start after the roots. */
VerifyNode *node = NextNode(trc->root);
@ -372,7 +376,8 @@ gc::EndVerifyPreBarriers(JSRuntime *rt)
/*** Post-Barrier Verifyier ***/
struct VerifyPostTracer : JSTracer {
struct VerifyPostTracer : JSTracer
{
/* The gcNumber when the verification began. */
uint64_t number;
@ -382,6 +387,10 @@ struct VerifyPostTracer : JSTracer {
/* The set of edges in the StoreBuffer at the end of verification. */
typedef HashSet<void **, PointerHasher<void **, 3>, SystemAllocPolicy> EdgeSet;
EdgeSet *edges;
VerifyPostTracer(JSRuntime *rt, JSTraceCallback callback)
: JSTracer(rt, callback), number(rt->gcNumber), count(0)
{}
};
/*
@ -401,14 +410,13 @@ gc::StartVerifyPostBarriers(JSRuntime *rt)
MinorGC(rt, JS::gcreason::EVICT_NURSERY);
VerifyPostTracer *trc = js_new<VerifyPostTracer>();
rt->gcNumber++;
VerifyPostTracer *trc = js_new<VerifyPostTracer>(rt, JSTraceCallback(nullptr));
if (!trc)
return;
rt->gcVerifyPostData = trc;
rt->gcNumber++;
trc->number = rt->gcNumber;
trc->count = 0;
#endif
}
@ -424,7 +432,7 @@ PostVerifierCollectStoreBufferEdges(JSTracer *jstrc, void **thingp, JSGCTraceKin
/* The store buffer may store extra, non-cross-generational edges. */
JSObject *dst = *reinterpret_cast<JSObject **>(thingp);
if (trc->runtime->gcNursery.isInside(thingp) || !trc->runtime->gcNursery.isInside(dst))
if (trc->runtime()->gcNursery.isInside(thingp) || !trc->runtime()->gcNursery.isInside(dst))
return;
/*
@ -432,7 +440,7 @@ PostVerifierCollectStoreBufferEdges(JSTracer *jstrc, void **thingp, JSGCTraceKin
* only things that enter this callback are marked by the store buffer. The
* store buffer ensures that the real tracing location is set correctly.
*/
void **loc = trc->realLocation != nullptr ? (void **)trc->realLocation : thingp;
void **loc = trc->tracingLocation(thingp);
trc->edges->put(loc);
}
@ -460,9 +468,9 @@ PostVerifierVisitEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind)
return;
/* Filter out non cross-generational edges. */
JS_ASSERT(!trc->runtime->gcNursery.isInside(thingp));
JS_ASSERT(!trc->runtime()->gcNursery.isInside(thingp));
JSObject *dst = *reinterpret_cast<JSObject **>(thingp);
if (!trc->runtime->gcNursery.isInside(dst))
if (!trc->runtime()->gcNursery.isInside(dst))
return;
/*
@ -471,7 +479,7 @@ PostVerifierVisitEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind)
* below. Since ObjectImpl::markChildren handles this, the real trace
* location will be set correctly in these cases.
*/
void **loc = trc->realLocation != nullptr ? (void **)trc->realLocation : thingp;
void **loc = trc->tracingLocation(thingp);
AssertStoreBufferContainsEdge(trc->edges, loc, dst);
}
@ -487,14 +495,14 @@ js::gc::EndVerifyPostBarriers(JSRuntime *rt)
VerifyPostTracer *trc = (VerifyPostTracer *)rt->gcVerifyPostData;
/* Visit every entry in the store buffer and put the edges in a hash set. */
JS_TracerInit(trc, rt, PostVerifierCollectStoreBufferEdges);
trc->setTraceCallback(PostVerifierCollectStoreBufferEdges);
if (!edges.init())
goto oom;
trc->edges = &edges;
rt->gcStoreBuffer.markAll(trc);
/* Walk the heap to find any edges not the the |edges| set. */
JS_TracerInit(trc, rt, PostVerifierVisitEdge);
trc->setTraceCallback(PostVerifierVisitEdge);
for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
for (size_t kind = 0; kind < FINALIZE_LIMIT; ++kind) {
for (CellIterUnderGC cells(zone, AllocKind(kind)); !cells.done(); cells.next()) {

Просмотреть файл

@ -325,7 +325,7 @@ BacktrackingAllocator::groupAndQueueRegisters()
for (size_t j = 0; j < block->numPhis(); j++) {
LPhi *phi = block->getPhi(j);
uint32_t output = phi->getDef(0)->virtualRegister();
for (size_t k = 0; k < phi->numOperands(); k++) {
for (size_t k = 0, kend = phi->numOperands(); k < kend; k++) {
uint32_t input = phi->getOperand(k)->toUse()->virtualRegister();
if (!tryGroupRegisters(input, output))
return false;

Просмотреть файл

@ -75,6 +75,10 @@ BaselineCompiler::compile()
IonSpew(IonSpew_Codegen, "# Emitting baseline code for script %s:%d",
script->filename(), script->lineno());
TraceLogger *logger = TraceLoggerForMainThread(cx->runtime());
AutoTraceLog logScript(logger, TraceLogCreateTextId(logger, script));
AutoTraceLog logCompile(logger, TraceLogger::BaselineCompilation);
if (!script->ensureHasTypes(cx))
return Method_Error;

Просмотреть файл

@ -21,7 +21,7 @@ bool
C1Spewer::init(const char *path)
{
spewout_ = fopen(path, "w");
return (spewout_ != nullptr);
return spewout_ != nullptr;
}
void

Просмотреть файл

@ -565,8 +565,8 @@ FinishAllOffThreadCompilations(JSCompartment *comp)
/* static */ void
JitRuntime::Mark(JSTracer *trc)
{
JS_ASSERT(!trc->runtime->isHeapMinorCollecting());
Zone *zone = trc->runtime->atomsCompartment()->zone();
JS_ASSERT(!trc->runtime()->isHeapMinorCollecting());
Zone *zone = trc->runtime()->atomsCompartment()->zone();
for (gc::CellIterUnderGC i(zone, gc::FINALIZE_JITCODE); !i.done(); i.next()) {
JitCode *code = i.get<JitCode>();
MarkJitCodeRoot(trc, &code, "wrapper");
@ -579,12 +579,12 @@ JitCompartment::mark(JSTracer *trc, JSCompartment *compartment)
// Cancel any active or pending off thread compilations. Note that the
// MIR graph does not hold any nursery pointers, so there's no need to
// do this for minor GCs.
JS_ASSERT(!trc->runtime->isHeapMinorCollecting());
JS_ASSERT(!trc->runtime()->isHeapMinorCollecting());
CancelOffThreadIonCompile(compartment, nullptr);
FinishAllOffThreadCompilations(compartment);
// Free temporary OSR buffer.
trc->runtime->jitRuntime()->freeOsrTempData();
trc->runtime()->jitRuntime()->freeOsrTempData();
// Mark scripts with parallel IonScripts if we should preserve them.
if (activeParallelEntryScripts_) {
@ -607,7 +607,7 @@ JitCompartment::mark(JSTracer *trc, JSCompartment *compartment)
// Subtlety: We depend on the tracing of the parallel IonScript's
// callTargetEntries to propagate the parallel age to the entire
// call graph.
if (ShouldPreserveParallelJITCode(trc->runtime, script, /* increase = */ true)) {
if (ShouldPreserveParallelJITCode(trc->runtime(), script, /* increase = */ true)) {
MarkScript(trc, const_cast<EncapsulatedPtrScript *>(&e.front()), "par-script");
MOZ_ASSERT(script == e.front());
}

Просмотреть файл

@ -175,7 +175,7 @@ IsIonInlinablePC(jsbytecode *pc) {
inline bool
TooManyArguments(unsigned nargs)
{
return (nargs >= SNAPSHOT_MAX_NARGS || nargs > js_JitOptions.maxStackArgs);
return nargs >= SNAPSHOT_MAX_NARGS || nargs > js_JitOptions.maxStackArgs;
}
void ForbidCompilation(JSContext *cx, JSScript *script);

Просмотреть файл

@ -921,7 +921,7 @@ UpdateIonJSFrameForMinorGC(JSTracer *trc, const IonFrameIterator &frame)
for (GeneralRegisterBackwardIterator iter(safepoint.allGprSpills()); iter.more(); iter++) {
--spill;
if (slotsRegs.has(*iter))
trc->runtime->gcNursery.forwardBufferPointer(reinterpret_cast<HeapSlot **>(spill));
trc->runtime()->gcNursery.forwardBufferPointer(reinterpret_cast<HeapSlot **>(spill));
}
// Skip to the right place in the safepoint
@ -935,7 +935,7 @@ UpdateIonJSFrameForMinorGC(JSTracer *trc, const IonFrameIterator &frame)
while (safepoint.getSlotsOrElementsSlot(&slot)) {
HeapSlot **slots = reinterpret_cast<HeapSlot **>(layout->slotRef(slot));
trc->runtime->gcNursery.forwardBufferPointer(slots);
trc->runtime()->gcNursery.forwardBufferPointer(slots);
}
}
#endif
@ -1195,7 +1195,7 @@ MarkJitActivations(JSRuntime *rt, JSTracer *trc)
void
UpdateJitActivationsForMinorGC(JSRuntime *rt, JSTracer *trc)
{
JS_ASSERT(trc->runtime->isHeapMinorCollecting());
JS_ASSERT(trc->runtime()->isHeapMinorCollecting());
for (JitActivationIterator activations(rt); !activations.done(); ++activations) {
for (IonFrameIterator frames(activations); !frames.done(); ++frames) {
if (frames.type() == JitFrame_IonJS)

Просмотреть файл

@ -5587,13 +5587,11 @@ class MPhi;
// corresponding to the predecessor taken in the control flow graph.
class LPhi MOZ_FINAL : public LInstruction
{
uint32_t numInputs_;
LAllocation *inputs_;
LDefinition def_;
bool init(MIRGenerator *gen);
LPhi(MPhi *mir);
LPhi()
{ }
public:
LIR_HEADER(Phi)
@ -5612,7 +5610,7 @@ class LPhi MOZ_FINAL : public LInstruction
def_ = def;
}
size_t numOperands() const {
return numInputs_;
return mir_->toPhi()->numOperands();
}
LAllocation *getOperand(size_t index) {
JS_ASSERT(index < numOperands());

Просмотреть файл

@ -197,24 +197,16 @@ LSnapshot::rewriteRecoveredInput(LUse input)
}
}
bool
LPhi::init(MIRGenerator *gen)
{
inputs_ = gen->allocate<LAllocation>(numInputs_);
return !!inputs_;
}
LPhi::LPhi(MPhi *mir)
: numInputs_(mir->numOperands())
{
}
LPhi *
LPhi::New(MIRGenerator *gen, MPhi *ins)
{
LPhi *phi = new(gen->alloc()) LPhi(ins);
if (!phi->init(gen))
LPhi *phi = new (gen->alloc()) LPhi();
LAllocation *inputs = gen->allocate<LAllocation>(ins->numOperands());
if (!inputs)
return nullptr;
phi->inputs_ = inputs;
phi->setMir(ins);
return phi;
}
@ -389,7 +381,7 @@ LInstruction::dump(FILE *fp)
}
fprintf(fp, ")");
}
fprintf(stderr, "\n");
fprintf(fp, "\n");
}
void

Просмотреть файл

@ -494,7 +494,7 @@ LIRGenerator::visitCall(MCall *call)
LCallNative *lir = new(alloc()) LCallNative(tempFixed(cxReg), tempFixed(numReg),
tempFixed(vpReg), tempFixed(tmpReg));
return (defineReturn(lir, call) && assignSafepoint(lir, call));
return defineReturn(lir, call) && assignSafepoint(lir, call);
}
LCallKnown *lir = new(alloc()) LCallKnown(useFixed(call->getFunction(), CallTempReg0),

Просмотреть файл

@ -95,16 +95,14 @@ EvaluateConstantOperands(TempAllocator &alloc, MBinaryInstruction *ins, bool *pt
ret = Int32Value(lhs.toInt32() ^ rhs.toInt32());
break;
case MDefinition::Op_Lsh:
ret = Int32Value(lhs.toInt32() << (rhs.toInt32() & 0x1F));
ret = Int32Value(uint32_t(lhs.toInt32()) << (rhs.toInt32() & 0x1F));
break;
case MDefinition::Op_Rsh:
ret = Int32Value(lhs.toInt32() >> (rhs.toInt32() & 0x1F));
break;
case MDefinition::Op_Ursh: {
uint32_t unsignedLhs = (uint32_t)lhs.toInt32();
ret.setNumber(uint32_t(unsignedLhs >> (rhs.toInt32() & 0x1F)));
case MDefinition::Op_Ursh:
ret.setNumber(uint32_t(lhs.toInt32()) >> (rhs.toInt32() & 0x1F));
break;
}
case MDefinition::Op_Add:
ret.setNumber(lhs.toNumber() + rhs.toNumber());
break;

Просмотреть файл

@ -29,7 +29,6 @@ using mozilla::NumberEqualsInt32;
using mozilla::ExponentComponent;
using mozilla::FloorLog2;
using mozilla::IsInfinite;
using mozilla::IsFinite;
using mozilla::IsNaN;
using mozilla::IsNegative;
using mozilla::NegativeInfinity;
@ -591,8 +590,7 @@ Range::setDouble(double l, double h)
static inline bool
MissingAnyInt32Bounds(const Range *lhs, const Range *rhs)
{
return !lhs->hasInt32LowerBound() || !lhs->hasInt32UpperBound() ||
!rhs->hasInt32LowerBound() || !rhs->hasInt32UpperBound();
return !lhs->hasInt32Bounds() || !rhs->hasInt32Bounds();
}
Range *
@ -920,7 +918,7 @@ Range::abs(TempAllocator &alloc, const Range *op)
return new(alloc) Range(Max(Max(int32_t(0), l), u == INT32_MIN ? INT32_MAX : -u),
true,
Max(Max(int32_t(0), u), l == INT32_MIN ? INT32_MAX : -l),
op->hasInt32LowerBound_ && op->hasInt32UpperBound_ && l != INT32_MIN,
op->hasInt32Bounds() && l != INT32_MIN,
op->canHaveFractionalPart_,
op->max_exponent_);
}

Просмотреть файл

@ -42,7 +42,7 @@ AllocationIntegrityState::record()
virtualRegisters[vreg] = phi->getDef(0);
if (!info.outputs.append(*phi->getDef(0)))
return false;
for (size_t k = 0; k < phi->numOperands(); k++) {
for (size_t k = 0, kend = phi->numOperands(); k < kend; k++) {
if (!info.inputs.append(*phi->getOperand(k)))
return false;
}
@ -232,7 +232,7 @@ AllocationIntegrityState::checkIntegrity(LBlock *block, LInstruction *ins,
const InstructionInfo &info = blocks[block->mir()->id()].phis[i];
LPhi *phi = block->getPhi(i);
if (info.outputs[0].virtualRegister() == vreg) {
for (size_t j = 0; j < phi->numOperands(); j++) {
for (size_t j = 0, jend = phi->numOperands(); j < jend; j++) {
uint32_t newvreg = info.inputs[j].toUse()->virtualRegister();
LBlock *predecessor = graph.getBlock(block->mir()->getPredecessor(j)->id());
if (!addPredecessor(predecessor, newvreg, alloc))
@ -244,7 +244,7 @@ AllocationIntegrityState::checkIntegrity(LBlock *block, LInstruction *ins,
// No phi which defined the vreg we are tracking, follow back through all
// predecessors with the existing vreg.
for (size_t i = 0; i < block->mir()->numPredecessors(); i++) {
for (size_t i = 0, iend = block->mir()->numPredecessors(); i < iend; i++) {
LBlock *predecessor = graph.getBlock(block->mir()->getPredecessor(i)->id());
if (!addPredecessor(predecessor, vreg, alloc))
return false;

Просмотреть файл

@ -363,7 +363,7 @@ InstMovWT::extractImm(Imm16 *imm)
bool
InstMovWT::checkImm(Imm16 imm)
{
return (imm.decode() == Imm16(*this).decode());
return imm.decode() == Imm16(*this).decode();
}
void
@ -374,7 +374,7 @@ InstMovWT::extractDest(Register *dest)
bool
InstMovWT::checkDest(Register dest)
{
return (dest == toRD(*this));
return dest == toRD(*this);
}
bool

Просмотреть файл

@ -365,7 +365,7 @@ MacroAssemblerARM::ma_alu(Register src1, Imm32 imm, Register dest,
// And try with its negative.
if (negOp != op_invalid &&
alu_dbl(src1, negImm, dest, negOp, sc, c))
alu_dbl(src1, negImm, negDest, negOp, sc, c))
return;
// Well, damn. We can use two 16 bit mov's, then do the op

Просмотреть файл

@ -304,7 +304,7 @@ class CodeGeneratorShared : public LInstructionVisitor
void emitPreBarrier(Address address, MIRType type);
inline bool isNextBlock(LBlock *block) {
return (current->mir()->id() + 1 == block->mir()->id());
return current->mir()->id() + 1 == block->mir()->id();
}
public:

Просмотреть файл

@ -82,18 +82,16 @@ MacroAssemblerX64::loadConstantFloat32(float f, const FloatRegister &dest)
void
MacroAssemblerX64::finish()
{
JS_STATIC_ASSERT(CodeAlignment >= sizeof(double));
if (!doubles_.empty() || !floats_.empty())
if (!doubles_.empty())
masm.align(sizeof(double));
for (size_t i = 0; i < doubles_.length(); i++) {
Double &dbl = doubles_[i];
bind(&dbl.uses);
masm.doubleConstant(dbl.value);
}
// No need to align on sizeof(float) as we are aligned on sizeof(double);
if (!floats_.empty())
masm.align(sizeof(float));
for (size_t i = 0; i < floats_.length(); i++) {
Float &flt = floats_[i];
bind(&flt.uses);

Просмотреть файл

@ -113,10 +113,8 @@ MacroAssemblerX86::addConstantFloat32(float f, const FloatRegister &dest)
void
MacroAssemblerX86::finish()
{
if (doubles_.empty() && floats_.empty())
return;
masm.align(sizeof(double));
if (!doubles_.empty())
masm.align(sizeof(double));
for (size_t i = 0; i < doubles_.length(); i++) {
CodeLabel cl(doubles_[i].uses);
writeDoubleConstant(doubles_[i].value, cl.src());
@ -124,6 +122,9 @@ MacroAssemblerX86::finish()
if (!enoughMemory_)
return;
}
if (!floats_.empty())
masm.align(sizeof(float));
for (size_t i = 0; i < floats_.length(); i++) {
CodeLabel cl(floats_[i].uses);
writeFloatConstant(floats_[i].value, cl.src());

Просмотреть файл

@ -32,7 +32,7 @@
#include "js/RootingAPI.h"
#include "js/SliceBudget.h"
#include "js/StructuredClone.h"
#include "js/Tracer.h"
#include "js/TracingAPI.h"
#include "js/TypeDecls.h"
#include "js/Utility.h"
#include "js/Value.h"

Просмотреть файл

@ -1645,7 +1645,13 @@ struct JSHeapDumpNode {
typedef HashSet<void *, PointerHasher<void *, 3>, SystemAllocPolicy> VisitedSet;
typedef struct JSDumpingTracer {
class DumpingTracer
{
public:
DumpingTracer(JSRuntime *rt, JSTraceCallback callback)
: base(rt, callback)
{}
JSTracer base;
VisitedSet visited;
bool ok;
@ -1655,14 +1661,14 @@ typedef struct JSDumpingTracer {
JSHeapDumpNode *parentNode;
JSHeapDumpNode **lastNodep;
char buffer[200];
} JSDumpingTracer;
};
static void
DumpNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind)
{
JS_ASSERT(trc->callback == DumpNotify);
JSDumpingTracer *dtrc = (JSDumpingTracer *)trc;
DumpingTracer *dtrc = (DumpingTracer *)trc;
void *thing = *thingp;
if (!dtrc->ok || thing == dtrc->thingToIgnore)
@ -1694,7 +1700,7 @@ DumpNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind)
}
}
const char *edgeName = JS_GetTraceEdgeName(&dtrc->base, dtrc->buffer, sizeof(dtrc->buffer));
const char *edgeName = dtrc->base.getTracingEdgeName(dtrc->buffer, sizeof(dtrc->buffer));
size_t edgeNameSize = strlen(edgeName) + 1;
size_t bytes = offsetof(JSHeapDumpNode, edgeName) + edgeNameSize;
JSHeapDumpNode *node = (JSHeapDumpNode *) js_malloc(bytes);
@ -1716,7 +1722,7 @@ DumpNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind)
/* Dump node and the chain that leads to thing it contains. */
static bool
DumpNode(JSDumpingTracer *dtrc, FILE* fp, JSHeapDumpNode *node)
DumpNode(DumpingTracer *dtrc, FILE* fp, JSHeapDumpNode *node)
{
JSHeapDumpNode *prev, *following;
size_t chainLimit;
@ -1786,10 +1792,9 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind,
if (maxDepth == 0)
return true;
JSDumpingTracer dtrc;
DumpingTracer dtrc(rt, DumpNotify);
if (!dtrc.visited.init())
return false;
JS_TracerInit(&dtrc.base, rt, DumpNotify);
dtrc.ok = true;
dtrc.startThing = startThing;
dtrc.thingToFind = thingToFind;
@ -4341,6 +4346,8 @@ JS::ReadOnlyCompileOptions::copyPODOptions(const ReadOnlyCompileOptions &rhs)
extraWarningsOption = rhs.extraWarningsOption;
werrorOption = rhs.werrorOption;
asmJSOption = rhs.asmJSOption;
forceAsync = rhs.forceAsync;
installedFile = rhs.installedFile;
sourcePolicy = rhs.sourcePolicy;
introductionType = rhs.introductionType;
introductionLineno = rhs.introductionLineno;

Просмотреть файл

@ -27,14 +27,13 @@
#include "js/Id.h"
#include "js/Principals.h"
#include "js/RootingAPI.h"
#include "js/TracingAPI.h"
#include "js/Utility.h"
#include "js/Value.h"
#include "js/Vector.h"
/************************************************************************/
struct JSTracer;
namespace JS {
class Latin1CharsZ;

Просмотреть файл

@ -189,7 +189,7 @@ JSRuntime::finishAtoms()
void
js::MarkAtoms(JSTracer *trc)
{
JSRuntime *rt = trc->runtime;
JSRuntime *rt = trc->runtime();
for (AtomSet::Enum e(rt->atoms()); !e.empty(); e.popFront()) {
const AtomStateEntry &entry = e.front();
if (!entry.isTagged())
@ -206,7 +206,7 @@ js::MarkAtoms(JSTracer *trc)
void
js::MarkPermanentAtoms(JSTracer *trc)
{
JSRuntime *rt = trc->runtime;
JSRuntime *rt = trc->runtime();
// Permanent atoms only need to be marked in the runtime which owns them.
if (rt->parentRuntime)

Просмотреть файл

@ -528,7 +528,7 @@ JSCompartment::trace(JSTracer *trc)
void
JSCompartment::markRoots(JSTracer *trc)
{
JS_ASSERT(!trc->runtime->isHeapMinorCollecting());
JS_ASSERT(!trc->runtime()->isHeapMinorCollecting());
#ifdef JS_ION
if (jitCompartment_)

Просмотреть файл

@ -660,7 +660,7 @@ digits(size_t *result, const jschar *s, size_t *i, size_t limit)
*result += (s[*i] - '0');
++(*i);
}
return (*i != init);
return *i != init;
}
/*
@ -683,7 +683,7 @@ fractional(double *result, const jschar *s, size_t *i, size_t limit)
factor *= 0.1;
++(*i);
}
return (*i != init);
return *i != init;
}
/*
@ -699,7 +699,7 @@ ndigits(size_t n, size_t *result, const jschar *s, size_t* i, size_t limit)
size_t init = *i;
if (digits(result, s, i, Min(limit, init+n)))
return ((*i - init) == n);
return (*i - init) == n;
*i = init;
return false;

Просмотреть файл

@ -720,12 +720,13 @@ js_DumpObject(JSObject *obj)
#endif
struct JSDumpHeapTracer : public JSTracer
struct DumpHeapTracer : public JSTracer
{
FILE *output;
JSDumpHeapTracer(FILE *fp)
: output(fp)
DumpHeapTracer(FILE *fp, JSRuntime *rt, JSTraceCallback callback,
WeakMapTraceKind weakTraceKind)
: JSTracer(rt, callback, weakTraceKind), output(fp)
{}
};
@ -742,7 +743,7 @@ MarkDescriptor(void *thing)
static void
DumpHeapVisitZone(JSRuntime *rt, void *data, Zone *zone)
{
JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(data);
DumpHeapTracer *dtrc = static_cast<DumpHeapTracer *>(data);
fprintf(dtrc->output, "# zone %p\n", (void *)zone);
}
@ -755,7 +756,7 @@ DumpHeapVisitCompartment(JSRuntime *rt, void *data, JSCompartment *comp)
else
strcpy(name, "<unknown>");
JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(data);
DumpHeapTracer *dtrc = static_cast<DumpHeapTracer *>(data);
fprintf(dtrc->output, "# compartment %s [in zone %p]\n", name, (void *)comp->zone());
}
@ -763,7 +764,7 @@ static void
DumpHeapVisitArena(JSRuntime *rt, void *data, gc::Arena *arena,
JSGCTraceKind traceKind, size_t thingSize)
{
JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(data);
DumpHeapTracer *dtrc = static_cast<DumpHeapTracer *>(data);
fprintf(dtrc->output, "# arena allockind=%u size=%u\n",
unsigned(arena->aheader.getAllocKind()), unsigned(thingSize));
}
@ -772,7 +773,7 @@ static void
DumpHeapVisitCell(JSRuntime *rt, void *data, void *thing,
JSGCTraceKind traceKind, size_t thingSize)
{
JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(data);
DumpHeapTracer *dtrc = static_cast<DumpHeapTracer *>(data);
char cellDesc[1024 * 32];
JS_GetTraceThingInfo(cellDesc, sizeof(cellDesc), dtrc, thing, traceKind, true);
fprintf(dtrc->output, "%p %c %s\n", thing, MarkDescriptor(thing), cellDesc);
@ -782,44 +783,41 @@ DumpHeapVisitCell(JSRuntime *rt, void *data, void *thing,
static void
DumpHeapVisitChild(JSTracer *trc, void **thingp, JSGCTraceKind kind)
{
if (gc::IsInsideNursery(trc->runtime, *thingp))
if (gc::IsInsideNursery(trc->runtime(), *thingp))
return;
JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(trc);
DumpHeapTracer *dtrc = static_cast<DumpHeapTracer *>(trc);
char buffer[1024];
fprintf(dtrc->output, "> %p %c %s\n", *thingp, MarkDescriptor(*thingp),
JS_GetTraceEdgeName(dtrc, buffer, sizeof(buffer)));
dtrc->getTracingEdgeName(buffer, sizeof(buffer)));
}
static void
DumpHeapVisitRoot(JSTracer *trc, void **thingp, JSGCTraceKind kind)
{
if (gc::IsInsideNursery(trc->runtime, *thingp))
if (gc::IsInsideNursery(trc->runtime(), *thingp))
return;
JSDumpHeapTracer *dtrc = static_cast<JSDumpHeapTracer *>(trc);
DumpHeapTracer *dtrc = static_cast<DumpHeapTracer *>(trc);
char buffer[1024];
fprintf(dtrc->output, "%p %c %s\n", *thingp, MarkDescriptor(*thingp),
JS_GetTraceEdgeName(dtrc, buffer, sizeof(buffer)));
dtrc->getTracingEdgeName(buffer, sizeof(buffer)));
}
void
js::DumpHeapComplete(JSRuntime *rt, FILE *fp, js::DumpHeapNurseryBehaviour nurseryBehaviour)
{
JSDumpHeapTracer dtrc(fp);
#ifdef JSGC_GENERATIONAL
if (nurseryBehaviour == js::CollectNurseryBeforeDump)
MinorGC(rt, JS::gcreason::API);
#endif
JS_TracerInit(&dtrc, rt, DumpHeapVisitRoot);
dtrc.eagerlyTraceWeakMaps = TraceWeakMapKeysValues;
DumpHeapTracer dtrc(fp, rt, DumpHeapVisitRoot, TraceWeakMapKeysValues);
TraceRuntime(&dtrc);
fprintf(dtrc.output, "==========\n");
JS_TracerInit(&dtrc, rt, DumpHeapVisitChild);
dtrc.setTraceCallback(DumpHeapVisitChild);
IterateZonesCompartmentsArenasCells(rt, &dtrc,
DumpHeapVisitZone,
DumpHeapVisitCompartment,
@ -918,7 +916,7 @@ JS::IsIncrementalGCEnabled(JSRuntime *rt)
JS_FRIEND_API(bool)
JS::IsIncrementalGCInProgress(JSRuntime *rt)
{
return (rt->gcIncrementalState != gc::NO_INCREMENTAL && !rt->gcVerifyPreData);
return rt->gcIncrementalState != gc::NO_INCREMENTAL && !rt->gcVerifyPreData;
}
JS_FRIEND_API(void)
@ -972,7 +970,7 @@ JS::IsGenerationalGCEnabled(JSRuntime *rt)
JS_FRIEND_API(bool)
JS::IsIncrementalBarrierNeeded(JSRuntime *rt)
{
return (rt->gcIncrementalState == gc::MARK && !rt->isHeapBusy());
return rt->gcIncrementalState == gc::MARK && !rt->isHeapBusy();
}
JS_FRIEND_API(bool)

Просмотреть файл

@ -1807,20 +1807,6 @@ js_GetGCThingTraceKind(void *thing)
return GetGCThingTraceKind(thing);
}
void
js::InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback)
{
trc->runtime = rt;
trc->callback = callback;
trc->debugPrinter = nullptr;
trc->debugPrintArg = nullptr;
trc->debugPrintIndex = size_t(-1);
trc->eagerlyTraceWeakMaps = TraceWeakMapValues;
#ifdef JS_GC_ZEAL
trc->realLocation = nullptr;
#endif
}
/* static */ int64_t
SliceBudget::TimeBudget(int64_t millis)
{
@ -1863,15 +1849,19 @@ SliceBudget::checkOverBudget()
return over;
}
/*
* DoNotTraceWeakMaps: the GC is recomputing the liveness of WeakMap entries,
* so we delay visting entries.
*/
GCMarker::GCMarker(JSRuntime *rt)
: stack(size_t(-1)),
: JSTracer(rt, nullptr, DoNotTraceWeakMaps),
stack(size_t(-1)),
color(BLACK),
started(false),
unmarkedArenaStackTop(nullptr),
markLaterArenas(0),
grayBufferState(GRAY_BUFFER_UNUSED)
{
InitTracer(this, rt, nullptr);
}
bool
@ -1890,11 +1880,6 @@ GCMarker::start()
JS_ASSERT(!unmarkedArenaStackTop);
JS_ASSERT(markLaterArenas == 0);
/*
* The GC is recomputing the liveness of WeakMap entries, so we delay
* visting entries.
*/
eagerlyTraceWeakMaps = DoNotTraceWeakMaps;
}
void
@ -2001,8 +1986,8 @@ bool
GCMarker::markDelayedChildren(SliceBudget &budget)
{
gcstats::MaybeAutoPhase ap;
if (runtime->gcIncrementalState == MARK)
ap.construct(runtime->gcStats, gcstats::PHASE_MARK_DELAYED);
if (runtime()->gcIncrementalState == MARK)
ap.construct(runtime()->gcStats, gcstats::PHASE_MARK_DELAYED);
JS_ASSERT(unmarkedArenaStackTop);
do {
@ -2049,7 +2034,7 @@ GCMarker::startBufferingGrayRoots()
{
JS_ASSERT(grayBufferState == GRAY_BUFFER_UNUSED);
grayBufferState = GRAY_BUFFER_OK;
for (GCZonesIter zone(runtime); !zone.done(); zone.next())
for (GCZonesIter zone(runtime()); !zone.done(); zone.next())
JS_ASSERT(zone->gcGrayRoots.empty());
JS_ASSERT(!callback);
@ -2070,7 +2055,7 @@ GCMarker::endBufferingGrayRoots()
void
GCMarker::resetBufferedGrayRoots()
{
for (GCZonesIter zone(runtime); !zone.done(); zone.next())
for (GCZonesIter zone(runtime()); !zone.done(); zone.next())
zone->gcGrayRoots.clearAndFree();
}
@ -2082,12 +2067,10 @@ GCMarker::markBufferedGrayRoots(JS::Zone *zone)
for (GrayRoot *elem = zone->gcGrayRoots.begin(); elem != zone->gcGrayRoots.end(); elem++) {
#ifdef DEBUG
debugPrinter = elem->debugPrinter;
debugPrintArg = elem->debugPrintArg;
debugPrintIndex = elem->debugPrintIndex;
setTracingDetails(elem->debugPrinter, elem->debugPrintArg, elem->debugPrintIndex);
#endif
void *tmp = elem->thing;
JS_SET_TRACING_LOCATION(this, (void *)&elem->thing);
setTracingLocation((void *)&elem->thing);
MarkKind(this, &tmp, elem->kind);
JS_ASSERT(tmp == elem->thing);
}
@ -2103,9 +2086,9 @@ GCMarker::appendGrayRoot(void *thing, JSGCTraceKind kind)
GrayRoot root(thing, kind);
#ifdef DEBUG
root.debugPrinter = debugPrinter;
root.debugPrintArg = debugPrintArg;
root.debugPrintIndex = debugPrintIndex;
root.debugPrinter = debugPrinter();
root.debugPrintArg = debugPrintArg();
root.debugPrintIndex = debugPrintIndex();
#endif
Zone *zone = static_cast<Cell *>(thing)->tenuredZone();
@ -2131,7 +2114,7 @@ size_t
GCMarker::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
size_t size = stack.sizeOfExcludingThis(mallocSizeOf);
for (ZonesIter zone(runtime, WithAtoms); !zone.done(); zone.next())
for (ZonesIter zone(runtime(), WithAtoms); !zone.done(); zone.next())
size += zone->gcGrayRoots.sizeOfExcludingThis(mallocSizeOf);
return size;
}
@ -2903,8 +2886,13 @@ ShouldPreserveJITCode(JSCompartment *comp, int64_t currentTime)
}
#ifdef DEBUG
struct CompartmentCheckTracer : public JSTracer
class CompartmentCheckTracer : public JSTracer
{
public:
CompartmentCheckTracer(JSRuntime *rt, JSTraceCallback callback)
: JSTracer(rt, callback)
{}
Cell *src;
JSGCTraceKind srcKind;
Zone *zone;
@ -2941,7 +2929,7 @@ CheckCompartment(CompartmentCheckTracer *trc, JSCompartment *thingCompartment,
Cell *thing, JSGCTraceKind kind)
{
JS_ASSERT(thingCompartment == trc->compartment ||
trc->runtime->isAtomsCompartment(thingCompartment) ||
trc->runtime()->isAtomsCompartment(thingCompartment) ||
(trc->srcKind == JSTRACE_OBJECT &&
InCrossCompartmentMap((JSObject *)trc->src, thing, kind)));
}
@ -2972,7 +2960,7 @@ CheckCompartmentCallback(JSTracer *trcArg, void **thingp, JSGCTraceKind kind)
CheckCompartment(trc, comp, thing, kind);
} else {
JS_ASSERT(thing->tenuredZone() == trc->zone ||
trc->runtime->isAtomsZone(thing->tenuredZone()));
trc->runtime()->isAtomsZone(thing->tenuredZone()));
}
}
@ -2982,9 +2970,7 @@ CheckForCompartmentMismatches(JSRuntime *rt)
if (rt->gcDisableStrictProxyCheckingCount)
return;
CompartmentCheckTracer trc;
JS_TracerInit(&trc, rt, CheckCompartmentCallback);
CompartmentCheckTracer trc(rt, CheckCompartmentCallback);
for (ZonesIter zone(rt, SkipAtoms); !zone.done(); zone.next()) {
trc.zone = zone;
for (size_t thingKind = 0; thingKind < FINALIZE_LAST; thingKind++) {

Просмотреть файл

@ -15,9 +15,9 @@
#include "jslock.h"
#include "jsobj.h"
#include "gc/Tracer.h"
#include "js/GCAPI.h"
#include "js/SliceBudget.h"
#include "js/Tracer.h"
#include "js/Vector.h"
class JSAtom;
@ -776,9 +776,6 @@ NotifyGCPreSwap(JSObject *a, JSObject *b);
extern void
NotifyGCPostSwap(JSObject *a, JSObject *b, unsigned preResult);
void
InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback);
/*
* Helper that implements sweeping and allocation for kinds that can be swept
* and allocated off the main thread.

Просмотреть файл

@ -3794,7 +3794,7 @@ class NewTypeObjectsSetRef : public BufferableRef
void mark(JSTracer *trc) {
JSObject *prior = proto;
JS_SET_TRACING_LOCATION(trc, (void*)&*prior);
trc->setTracingLocation(&*prior);
Mark(trc, &proto, "newTypeObjects set prototype");
if (prior == proto)
return;

Просмотреть файл

@ -68,7 +68,7 @@ class MathCache
return e.out;
e.in = x;
e.f = f;
return (e.out = f(x));
return e.out = f(x);
}
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);

Просмотреть файл

@ -5549,10 +5549,10 @@ js::ToObjectSlow(JSContext *cx, HandleValue val, bool reportScanStack)
void
js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
{
JS_ASSERT(trc->debugPrinter == js_GetObjectSlotName);
JS_ASSERT(trc->debugPrinter() == js_GetObjectSlotName);
JSObject *obj = (JSObject *)trc->debugPrintArg;
uint32_t slot = uint32_t(trc->debugPrintIndex);
JSObject *obj = (JSObject *)trc->debugPrintArg();
uint32_t slot = uint32_t(trc->debugPrintIndex());
Shape *shape;
if (obj->isNative()) {

Просмотреть файл

@ -1932,7 +1932,7 @@ js::CallResultEscapes(jsbytecode *pc)
if (*pc == JSOP_NOT)
pc += JSOP_NOT_LENGTH;
return (*pc != JSOP_IFEQ);
return *pc != JSOP_IFEQ;
}
extern bool

Просмотреть файл

@ -33,7 +33,7 @@ GetDefCount(JSScript *script, unsigned offset)
* would pop b, c, and d to rearrange the stack to |a c[0]
* d[1] b[2]|.
*/
return (pc[1] + 1);
return pc[1] + 1;
default:
return StackDefs(script, pc);
}
@ -45,7 +45,7 @@ GetUseCount(JSScript *script, unsigned offset)
jsbytecode *pc = script->offsetToPC(offset);
if (JSOp(*pc) == JSOP_PICK)
return (pc[1] + 1);
return pc[1] + 1;
if (js_CodeSpec[*pc].nuses == -1)
return StackUses(script, pc);
return js_CodeSpec[*pc].nuses;

Просмотреть файл

@ -3014,7 +3014,7 @@ ProxyObject::trace(JSTracer *trc, JSObject *obj)
ProxyObject *proxy = &obj->as<ProxyObject>();
#ifdef DEBUG
if (!trc->runtime->gcDisableStrictProxyCheckingCount && proxy->is<WrapperObject>()) {
if (!trc->runtime()->gcDisableStrictProxyCheckingCount && proxy->is<WrapperObject>()) {
JSObject *referent = &proxy->private_().toObject();
if (referent->compartment() != proxy->compartment()) {
/*

Просмотреть файл

@ -135,9 +135,9 @@ struct JSSecurityCallbacks;
struct JSStructuredCloneCallbacks;
struct JSStructuredCloneReader;
struct JSStructuredCloneWriter;
struct JSTracer;
class JS_PUBLIC_API(JSTracer);
class JSFlatString;
class JSFlatString;
#ifdef JS_THREADSAFE
typedef struct PRCallOnceType JSCallOnceType;

Просмотреть файл

@ -3298,7 +3298,7 @@ JSScript::markChildren(JSTracer *trc)
// JSScript::Create(), but not yet finished initializing it with
// fullyInitFromEmitter() or fullyInitTrivial().
JS_ASSERT_IF(trc->runtime->gcStrictCompartmentChecking, zone()->isCollecting());
JS_ASSERT_IF(trc->runtime()->gcStrictCompartmentChecking, zone()->isCollecting());
for (uint32_t i = 0; i < natoms(); ++i) {
if (atoms[i])
@ -3338,7 +3338,7 @@ JSScript::markChildren(JSTracer *trc)
compartment()->mark();
if (code())
MarkScriptData(trc->runtime, code());
MarkScriptData(trc->runtime(), code());
}
bindings.trace(trc);

Просмотреть файл

@ -1380,7 +1380,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
jssrcnote *notes() { return (jssrcnote *)(code() + length()); }
bool hasArray(ArrayKind kind) {
return (hasArrayBits & (1 << kind));
return hasArrayBits & (1 << kind);
}
void setHasArray(ArrayKind kind) { hasArrayBits |= (1 << kind); }
void cloneHasArray(JSScript *script) { hasArrayBits = script->hasArrayBits; }

Просмотреть файл

@ -3174,7 +3174,7 @@ class SplitMatchResult {
endIndex_ = SIZE_MAX;
}
bool isFailure() const {
return (endIndex_ == SIZE_MAX);
return endIndex_ == SIZE_MAX;
}
size_t endIndex() const {
JS_ASSERT(!isFailure());

Просмотреть файл

@ -48,7 +48,7 @@ class WeakMapBase {
// many keys as possible have been marked, and add ourselves to the list of
// known-live WeakMaps to be scanned in the iterative marking phase, by
// markAllIteratively.
JS_ASSERT(tracer->eagerlyTraceWeakMaps == DoNotTraceWeakMaps);
JS_ASSERT(tracer->eagerlyTraceWeakMaps() == DoNotTraceWeakMaps);
// Add ourselves to the list if we are not already in the list. We can already
// be in the list if the weak map is marked more than once due delayed marking.
@ -61,11 +61,11 @@ class WeakMapBase {
// nicely as needed by the true ephemeral marking algorithm --- custom tracers
// such as the cycle collector must use their own means for cycle detection.
// So here we do a conservative approximation: pretend all keys are live.
if (tracer->eagerlyTraceWeakMaps == DoNotTraceWeakMaps)
if (tracer->eagerlyTraceWeakMaps() == DoNotTraceWeakMaps)
return;
nonMarkingTraceValues(tracer);
if (tracer->eagerlyTraceWeakMaps == TraceWeakMapKeysValues)
if (tracer->eagerlyTraceWeakMaps() == TraceWeakMapKeysValues)
nonMarkingTraceKeys(tracer);
}
}

Просмотреть файл

@ -535,7 +535,7 @@ GlobalWorkerThreadState::canStartAsmJSCompile()
{
// Don't execute an AsmJS job if an earlier one failed.
JS_ASSERT(isLocked());
return (!asmJSWorklist().empty() && !numAsmJSFailedJobs);
return !asmJSWorklist().empty() && !numAsmJSFailedJobs;
}
bool

Просмотреть файл

@ -84,7 +84,7 @@ EXPORTS.js += [
'../public/RootingAPI.h',
'../public/SliceBudget.h',
'../public/StructuredClone.h',
'../public/Tracer.h',
'../public/TracingAPI.h',
'../public/TypeDecls.h',
'../public/Utility.h',
'../public/Value.h',

Просмотреть файл

@ -154,12 +154,12 @@ class HeapReverser : public JSTracer, public JS::CustomAutoRooter
/* Construct a HeapReverser for |context|'s heap. */
HeapReverser(JSContext *cx)
: JS::CustomAutoRooter(cx),
: JSTracer(cx->runtime(), traverseEdgeWithThis),
JS::CustomAutoRooter(cx),
noggc(JS_GetRuntime(cx)),
runtime(JS_GetRuntime(cx)),
parent(nullptr)
{
JS_TracerInit(this, runtime, traverseEdgeWithThis);
}
bool init() { return map.init(); }
@ -308,8 +308,8 @@ HeapReverser::reverseHeap()
char *
HeapReverser::getEdgeDescription()
{
if (!debugPrinter && debugPrintIndex == (size_t) -1) {
const char *arg = static_cast<const char *>(debugPrintArg);
if (!debugPrinter() && debugPrintIndex() == (size_t) -1) {
const char *arg = static_cast<const char *>(debugPrintArg());
char *name = js_pod_malloc<char>(strlen(arg) + 1);
if (!name)
return nullptr;
@ -322,11 +322,11 @@ HeapReverser::getEdgeDescription()
char *name = js_pod_malloc<char>(nameSize);
if (!name)
return nullptr;
if (debugPrinter)
debugPrinter(this, name, nameSize);
if (debugPrinter())
debugPrinter()(this, name, nameSize);
else
JS_snprintf(name, nameSize, "%s[%lu]",
static_cast<const char *>(debugPrintArg), debugPrintIndex);
static_cast<const char *>(debugPrintArg()), debugPrintIndex());
/* Shrink storage to fit. */
return static_cast<char *>(js_realloc(name, strlen(name) + 1));

Просмотреть файл

@ -795,7 +795,7 @@ ArrayBufferObject::finalize(FreeOp *fop, JSObject *obj)
/* static */ void
ArrayBufferObject::obj_trace(JSTracer *trc, JSObject *obj)
{
if (!IS_GC_MARKING_TRACER(trc) && !trc->runtime->isHeapMinorCollecting())
if (!IS_GC_MARKING_TRACER(trc) && !trc->runtime()->isHeapMinorCollecting())
return;
// ArrayBufferObjects need to maintain a list of possibly-weak pointers to
@ -815,7 +815,7 @@ ArrayBufferObject::obj_trace(JSTracer *trc, JSObject *obj)
if (!viewsHead)
return;
buffer.setViewList(UpdateObjectIfRelocated(trc->runtime, &viewsHead));
buffer.setViewList(UpdateObjectIfRelocated(trc->runtime(), &viewsHead));
if (viewsHead->nextView() == nullptr) {
// Single view: mark it, but only if we're actually doing a GC pass

Просмотреть файл

@ -1428,17 +1428,17 @@ Debugger::slowPathOnNewGlobalObject(JSContext *cx, Handle<GlobalObject *> global
/*** Debugger JSObjects **************************************************************************/
void
Debugger::markKeysInCompartment(JSTracer *tracer)
Debugger::markKeysInCompartment(JSTracer *trc)
{
/*
* WeakMap::Range is deliberately private, to discourage C++ code from
* enumerating WeakMap keys. However in this case we need access, so we
* make a base-class reference. Range is public in HashMap.
*/
objects.markKeys(tracer);
environments.markKeys(tracer);
scripts.markKeys(tracer);
sources.markKeys(tracer);
objects.markKeys(trc);
environments.markKeys(trc);
scripts.markKeys(trc);
sources.markKeys(trc);
}
/*
@ -1464,9 +1464,9 @@ Debugger::markKeysInCompartment(JSTracer *tracer)
* all the edges being reported here are strong references.
*/
void
Debugger::markCrossCompartmentDebuggerObjectReferents(JSTracer *tracer)
Debugger::markCrossCompartmentDebuggerObjectReferents(JSTracer *trc)
{
JSRuntime *rt = tracer->runtime;
JSRuntime *rt = trc->runtime();
/*
* Mark all objects in comp that are referents of Debugger.Objects in other
@ -1474,7 +1474,7 @@ Debugger::markCrossCompartmentDebuggerObjectReferents(JSTracer *tracer)
*/
for (Debugger *dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
if (!dbg->object->zone()->isCollecting())
dbg->markKeysInCompartment(tracer);
dbg->markKeysInCompartment(trc);
}
}
@ -1497,7 +1497,7 @@ Debugger::markAllIteratively(GCMarker *trc)
* Find all Debugger objects in danger of GC. This code is a little
* convoluted since the easiest way to find them is via their debuggees.
*/
JSRuntime *rt = trc->runtime;
JSRuntime *rt = trc->runtime();
for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
GlobalObjectSet &debuggees = c->getDebuggees();
for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) {
@ -1566,7 +1566,7 @@ Debugger::markAllIteratively(GCMarker *trc)
void
Debugger::markAll(JSTracer *trc)
{
JSRuntime *rt = trc->runtime;
JSRuntime *rt = trc->runtime();
for (Debugger *dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
GlobalObjectSet &debuggees = dbg->debuggees;
for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) {

Просмотреть файл

@ -213,7 +213,7 @@ regexp_trace(JSTracer *trc, JSObject *obj)
* 1. During TraceRuntime, isHeapBusy() is true
* 2. When a write barrier executes, IS_GC_MARKING_TRACER is true.
*/
if (trc->runtime->isHeapBusy() && IS_GC_MARKING_TRACER(trc))
if (trc->runtime()->isHeapBusy() && IS_GC_MARKING_TRACER(trc))
obj->setPrivate(nullptr);
}

Просмотреть файл

@ -370,7 +370,7 @@ class NewObjectCache
Entry *entry = &entries[*pentry];
/* N.B. Lookups with the same clasp/key but different kinds map to different entries. */
return (entry->clasp == clasp && entry->key == key);
return entry->clasp == clasp && entry->key == key;
}
void fill(EntryIndex entry_, const Class *clasp, gc::Cell *key, gc::AllocKind kind, JSObject *obj) {

Просмотреть файл

@ -1602,7 +1602,7 @@ class DebugScopes::MissingScopesRef : public gc::BufferableRef
MissingScopeMap::Ptr p = map->lookup(key);
if (!p)
return;
JS_SET_TRACING_LOCATION(trc, &const_cast<ScopeIterKey &>(p->key()).enclosingScope());
trc->setTracingLocation(&const_cast<ScopeIterKey &>(p->key()).enclosingScope());
Mark(trc, &key.enclosingScope(), "MissingScopesRef");
map->rekeyIfMoved(prior, key);
}

Просмотреть файл

@ -1172,7 +1172,7 @@ class Shape : public gc::BarrieredCell<Shape>
}
uint32_t numFixedSlots() const {
return (slotInfo >> FIXED_SLOTS_SHIFT);
return slotInfo >> FIXED_SLOTS_SHIFT;
}
void setNumFixedSlots(uint32_t nfixed) {

Просмотреть файл

@ -644,9 +644,9 @@ StaticStrings::isStatic(JSAtom *atom)
const jschar *chars = atom->chars();
switch (atom->length()) {
case 1:
return (chars[0] < UNIT_STATIC_LIMIT);
return chars[0] < UNIT_STATIC_LIMIT;
case 2:
return (fitsInSmallChar(chars[0]) && fitsInSmallChar(chars[1]));
return fitsInSmallChar(chars[0]) && fitsInSmallChar(chars[1]);
case 3:
if ('1' <= chars[0] && chars[0] <= '9' &&
'0' <= chars[1] && chars[1] <= '9' &&
@ -655,7 +655,7 @@ StaticStrings::isStatic(JSAtom *atom)
(chars[1] - '0') * 10 +
(chars[2] - '0');
return (unsigned(i) < INT_STATIC_LIMIT);
return unsigned(i) < INT_STATIC_LIMIT;
}
return false;
default:

Просмотреть файл

@ -381,7 +381,7 @@ class JSString : public js::gc::BarrieredCell<JSString>
MOZ_ALWAYS_INLINE
bool isAtom() const {
return (d.lengthAndFlags & ATOM_BIT);
return d.lengthAndFlags & ATOM_BIT;
}
MOZ_ALWAYS_INLINE
@ -399,7 +399,7 @@ class JSString : public js::gc::BarrieredCell<JSString>
inline bool hasBase() const {
JS_STATIC_ASSERT((DEPENDENT_FLAGS | JS_BIT(1)) == UNDEPENDED_FLAGS);
return (d.lengthAndFlags & HAS_BASE_BIT);
return d.lengthAndFlags & HAS_BASE_BIT;
}
inline JSLinearString *base() const;
@ -740,7 +740,7 @@ class JSAtom : public JSFlatString
MOZ_ALWAYS_INLINE
bool isPermanent() const {
return (d.lengthAndFlags & PERMANENT_BIT);
return d.lengthAndFlags & PERMANENT_BIT;
}
// Transform this atom into a permanent atom. This is only done during

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше