This commit is contained in:
Ryan VanderMeulen 2013-04-16 09:20:52 -04:00
Родитель eab1b226e3 818ceb20c7
Коммит 3d693f09bc
373 изменённых файлов: 7388 добавлений и 1431 удалений

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

@ -3745,6 +3745,7 @@ var XULBrowserWindow = {
aMaxTotalProgress);
},
// This function fires only for the currently selected tab.
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
const nsIWebProgressListener = Ci.nsIWebProgressListener;
const nsIChannel = Ci.nsIChannel;
@ -3752,8 +3753,13 @@ var XULBrowserWindow = {
if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
if (aRequest && aWebProgress.DOMWindow == content)
this.startDocumentLoad(aRequest);
if (aRequest && aWebProgress.DOMWindow == content) {
// clear out feed data
gBrowser.selectedBrowser.feeds = null;
// clear out search-engine data
gBrowser.selectedBrowser.engines = null;
}
this.isBusy = true;
@ -3770,11 +3776,6 @@ var XULBrowserWindow = {
}
}
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK &&
aWebProgress.DOMWindow == content &&
aRequest)
this.endDocumentLoad(aRequest, aStatus);
// This (thanks to the filter) is a network stop or the last
// request stop outside of loading the document, stop throbbers
// and progress bars and such
@ -4073,30 +4074,6 @@ var XULBrowserWindow = {
if (loadingDone)
return;
this.onStatusChange(gBrowser.webProgress, null, 0, aMessage);
},
startDocumentLoad: function XWB_startDocumentLoad(aRequest) {
// clear out feed data
gBrowser.selectedBrowser.feeds = null;
// clear out search-engine data
gBrowser.selectedBrowser.engines = null;
var uri = aRequest.QueryInterface(Ci.nsIChannel).URI;
try {
Services.obs.notifyObservers(content, "StartDocumentLoad", uri.spec);
} catch (e) {
}
},
endDocumentLoad: function XWB_endDocumentLoad(aRequest, aStatus) {
var urlStr = aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec;
var notification = Components.isSuccessCode(aStatus) ? "EndDocumentLoad" : "FailDocumentLoad";
try {
Services.obs.notifyObservers(content, notification, urlStr);
} catch (e) {
}
}
};

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

@ -254,7 +254,7 @@ if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
fi
STLPORT_SOURCES="$android_ndk/sources/cxx-stl/stlport"
STLPORT_CPPFLAGS="-I$_objdir/build/stlport -I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LIBS="-lstlport_static"
STLPORT_LIBS="-lstlport_static -static-libstdc++"
elif test "$target" != "arm-android-eabi"; then
dnl fail if we're not building with NDKr4
AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])

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

@ -24,4 +24,8 @@
#undef _STLP_NATIVE_CPP_RUNTIME_HEADER
#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../../system/include/header>
// Use operator new instead of stlport own node allocator
#undef _STLP_USE_NEWALLOC
#define _STLP_USE_NEWALLOC 1
#endif /* mozilla_stl_config__android_h */

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

@ -631,13 +631,6 @@ class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
return NS_OK;
}
NS_IMETHOD GetExplicitNonHeap(int64_t *aResult)
{
// All of this reporter's memory is on the heap.
*aResult = 0;
return NS_OK;
}
NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *aCallback,
nsISupports *aClosure)
{

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

@ -45,6 +45,7 @@ GK_ATOM(mozgeneratedcontentbefore, "_moz_generated_content_before")
GK_ATOM(mozgeneratedcontentafter, "_moz_generated_content_after")
GK_ATOM(mozgeneratedcontentimage, "_moz_generated_content_image")
GK_ATOM(mozquote, "_moz_quote")
GK_ATOM(mozsignature, "moz-signature")
GK_ATOM(_moz_is_glyph, "-moz-is-glyph")
GK_ATOM(_moz_original_size, "_moz_original_size")
GK_ATOM(_moz_target, "_moz_target")

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

@ -26,14 +26,6 @@ WebGLMemoryMultiReporter::GetName(nsACString &aName)
return NS_OK;
}
NS_IMETHODIMP
WebGLMemoryMultiReporter::GetExplicitNonHeap(int64_t *aAmount)
{
// WebGLMemoryMultiReporterWrapper has no KIND_NONHEAP measurements.
*aAmount = 0;
return NS_OK;
}
NS_IMETHODIMP
WebGLMemoryMultiReporter::CollectReports(nsIMemoryMultiReporterCallback* aCb,
nsISupports* aClosure)

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

@ -247,5 +247,19 @@ AudioContext::Resume()
}
}
JSContext*
AudioContext::GetJSContext() const
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIScriptGlobalObject> scriptGlobal =
do_QueryInterface(GetParentObject());
nsIScriptContext* scriptContext = scriptGlobal->GetContext();
if (!scriptContext) {
return nullptr;
}
return scriptContext->GetNativeContext();
}
}
}

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

@ -141,6 +141,8 @@ public:
void UnregisterPannerNode(PannerNode* aNode);
void UpdatePannerSource();
JSContext* GetJSContext() const;
private:
void RemoveFromDecodeQueue(WebAudioDecodeJob* aDecodeJob);

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

@ -97,7 +97,7 @@ private:
// GetReentrantMonitor correctly.
ReentrantMonitor mReentrantMonitor;
nsCOMPtr<nsIThread> mDecodeThread;
nsAutoPtr<MediaResource> mResource;
nsRefPtr<MediaResource> mResource;
};
NS_IMPL_THREADSAFE_ISUPPORTS0(BufferDecoder)
@ -389,7 +389,7 @@ MediaDecodeTask::CreateReader()
{
MOZ_ASSERT(NS_IsMainThread());
BufferMediaResource* resource =
nsRefPtr<BufferMediaResource> resource =
new BufferMediaResource(static_cast<uint8_t*> (mBuffer),
mLength, mPrincipal, mContentType);
@ -418,10 +418,10 @@ MediaDecodeTask::Decode()
{
MOZ_ASSERT(!NS_IsMainThread());
mDecoderReader->OnDecodeThreadStart();
mBufferDecoder->BeginDecoding(NS_GetCurrentThread());
mDecoderReader->OnDecodeThreadStart();
VideoInfo videoInfo;
nsAutoPtr<MetadataTags> tags;
nsresult rv = mDecoderReader->ReadMetadata(&videoInfo, getter_Transfers(tags));
@ -591,7 +591,7 @@ WebAudioDecodeJob::FinalizeBufferData()
MOZ_ASSERT(mOutput);
MOZ_ASSERT(mChannels == mChannelBuffers.Length());
AutoPushJSContext cx(GetJSContext());
AutoPushJSContext cx(mContext->GetJSContext());
if (!cx) {
return false;
}
@ -603,20 +603,6 @@ WebAudioDecodeJob::FinalizeBufferData()
return true;
}
JSContext*
WebAudioDecodeJob::GetJSContext() const
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIScriptGlobalObject> scriptGlobal =
do_QueryInterface(mContext->GetParentObject());
nsIScriptContext* scriptContext = scriptGlobal->GetContext();
if (!scriptContext) {
return nullptr;
}
return scriptContext->GetNativeContext();
}
bool
WebAudioDecodeJob::AllocateBuffer()
{
@ -624,7 +610,7 @@ WebAudioDecodeJob::AllocateBuffer()
MOZ_ASSERT(NS_IsMainThread());
// First, get a JSContext
AutoPushJSContext cx(GetJSContext());
AutoPushJSContext cx(mContext->GetJSContext());
if (!cx) {
return false;
}

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

@ -50,7 +50,6 @@ struct WebAudioDecodeJob
void OnFailure(ErrorCode aErrorCode);
bool AllocateBuffer();
JSContext* GetJSContext() const;
bool FinalizeBufferData();
nsCString mContentType;

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

@ -101,7 +101,8 @@ nsXBLJSClass::nsXBLJSClass(const nsAFlatCString& aClassName,
JSCLASS_NEW_RESOLVE |
// Our one reserved slot holds the relevant nsXBLPrototypeBinding
JSCLASS_HAS_RESERVED_SLOTS(1);
addProperty = delProperty = getProperty = ::JS_PropertyStub;
addProperty = getProperty = ::JS_PropertyStub;
delProperty = ::JS_DeletePropertyStub;
setProperty = ::JS_StrictPropertyStub;
enumerate = XBLEnumerate;
resolve = JS_ResolveStub;

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

@ -173,7 +173,7 @@ JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
"nsXBLPrototypeScript compilation scope",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0),
JS_PropertyStub, JS_PropertyStub,
JS_PropertyStub, JS_DeletePropertyStub,
nsXBLDocGlobalObject_getProperty, nsXBLDocGlobalObject_setProperty,
JS_EnumerateStub, nsXBLDocGlobalObject_resolve,
JS_ConvertStub, nsXBLDocGlobalObject_finalize,

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

@ -114,7 +114,7 @@ JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
"nsXULPrototypeScript compilation scope",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, nsXULPDGlobalObject_resolve, JS_ConvertStub,
nsXULPDGlobalObject_finalize, nullptr, nullptr, nullptr, nullptr,
nullptr

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

@ -1386,7 +1386,7 @@ NS_INTERFACE_MAP_END
static JSClass sDOMConstructorProtoClass = {
"DOM Constructor.prototype", 0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr
};
@ -2681,8 +2681,7 @@ nsDOMClassInfo::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
NS_IMETHODIMP
nsDOMClassInfo::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, jsval *vp,
bool *_retval)
JSObject *obj, jsid id, bool *_retval)
{
NS_WARNING("nsDOMClassInfo::DelProperty Don't call me!");
@ -3176,7 +3175,7 @@ static JSClass sGlobalScopePolluterClass = {
"Global Scope Polluter",
JSCLASS_NEW_RESOLVE,
JS_PropertyStub,
JS_PropertyStub,
JS_DeletePropertyStub,
nsWindowSH::GlobalScopePolluterGetProperty,
JS_StrictPropertyStub,
JS_EnumerateStub,
@ -6316,7 +6315,7 @@ static JSClass sHTMLDocumentAllClass = {
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_NEW_RESOLVE |
JSCLASS_EMULATES_UNDEFINED | JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
nsHTMLDocumentSH::DocumentAllGetProperty, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -6332,7 +6331,7 @@ static JSClass sHTMLDocumentAllHelperClass = {
"HTML document.all helper class",
JSCLASS_NEW_RESOLVE,
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
nsHTMLDocumentSH::DocumentAllHelperGetProperty, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -6345,7 +6344,7 @@ static JSClass sHTMLDocumentAllTagsClass = {
"HTML document.all.tags class",
JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -7429,7 +7428,7 @@ nsStorage2SH::SetProperty(nsIXPConnectWrappedNative *wrapper,
NS_IMETHODIMP
nsStorage2SH::DelProperty(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj, jsid id,
jsval *vp, bool *_retval)
bool *_retval)
{
nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
@ -7441,11 +7440,12 @@ nsStorage2SH::DelProperty(nsIXPConnectWrappedNative *wrapper,
NS_ENSURE_TRUE(keyStr.init(cx, key), NS_ERROR_UNEXPECTED);
nsresult rv = storage->RemoveItem(keyStr);
if (NS_SUCCEEDED(rv)) {
rv = NS_SUCCESS_I_DID_SOMETHING;
if (NS_FAILED(rv)) {
return rv;
}
return rv;
*_retval = true;
return NS_SUCCESS_I_DID_SOMETHING;
}

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

@ -1041,7 +1041,7 @@ protected:
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, jsval *vp, bool *_retval);
NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, jsval *vp, bool *_retval);
JSObject *obj, jsid id, bool *_retval);
NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, uint32_t enum_op, jsval *statep,
jsid *idp, bool *_retval);

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

@ -410,14 +410,6 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryMultiReporterCallback* aCb,
return NS_OK;
}
NS_IMETHODIMP
nsWindowMemoryReporter::GetExplicitNonHeap(int64_t* aAmount)
{
// This reporter only measures heap memory, so we don't need to report any
// bytes for it. However, the JS multi-reporter needs to be invoked.
return xpc::JSMemoryMultiReporter::GetExplicitNonHeap(aAmount);
}
uint32_t
nsWindowMemoryReporter::GetGhostTimeout()
{
@ -668,14 +660,6 @@ GhostURLsReporter::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
nsWindowMemoryReporter::
GhostURLsReporter::GetExplicitNonHeap(int64_t* aOut)
{
*aOut = 0;
return NS_OK;
}
struct ReportGhostWindowsEnumeratorData
{
nsIMemoryMultiReporterCallback* callback;

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

@ -174,7 +174,7 @@ DOMJSClass Class = {
{ "%s",
%s,
%s, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -223,7 +223,7 @@ class CGPrototypeJSClass(CGThing):
"%sPrototype",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(2),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -277,7 +277,7 @@ static DOMIfaceAndProtoJSClass InterfaceObjectClass = {
"Function",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE + %i),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -570,7 +570,7 @@ class ThreadLocalJSRuntime
JSClass ThreadLocalJSRuntime::sGlobalClass = {
"IndexedDBTransactionThreadGlobal",
JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
@ -835,7 +835,7 @@ public:
JSClass IDBObjectStore::sDummyPropJSClass = {
"dummy", 0,
JS_PropertyStub, JS_PropertyStub,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub,
JS_ConvertStub

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

@ -115,7 +115,7 @@ static JSBool
NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
static JSBool
NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
static JSBool
NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
@ -188,7 +188,7 @@ NPObjectMember_Trace(JSTracer *trc, JSObject *obj);
static JSClass sNPObjectMemberClass =
{
"NPObject Ambiguous Member class", JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_PropertyStub,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub,
JS_ResolveStub, NPObjectMember_Convert,
NPObjectMember_Finalize, nullptr, NPObjectMember_Call,
@ -1197,7 +1197,7 @@ NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMut
}
static JSBool
NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded)
{
NPObject *npobj = GetNPObject(cx, obj);
@ -1217,12 +1217,14 @@ NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMut
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
if (!hasProperty)
if (!hasProperty) {
*succeeded = true;
return JS_TRUE;
}
}
if (!npobj->_class->removeProperty(npobj, identifier))
vp.set(JSVAL_FALSE);
*succeeded = false;
return ReportExceptionIfPending(cx);
}

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

@ -331,7 +331,7 @@ private:
JSClass _varname = { \
_name, \
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize \
};
@ -586,7 +586,7 @@ private:
JSClass _varname = { \
_name, \
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize \
};
@ -772,7 +772,7 @@ private:
JSClass _varname = { \
_name, \
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize \
};
@ -951,7 +951,7 @@ private:
JSClass ProgressEvent::sClass = {
"ProgressEvent",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
};

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

@ -157,7 +157,7 @@ private:
JSClass DOMException::sClass = {
"DOMException",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
};

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

@ -203,7 +203,7 @@ private:
JSClass Blob::sClass = {
"Blob",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
};
@ -370,7 +370,7 @@ private:
JSClass File::sClass = {
"File",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
};

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

@ -135,7 +135,7 @@ private:
JSClass ImageData::sClass = {
"ImageData",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
};

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

@ -149,7 +149,7 @@ private:
JSClass Location::sClass = {
"WorkerLocation",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
};

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

@ -138,7 +138,7 @@ private:
JSClass Navigator::sClass = {
"WorkerNavigator",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
};

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

@ -301,7 +301,7 @@ DOMJSClass Worker::sClass = {
"Worker",
JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(3) |
JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
NULL, NULL, NULL, NULL, Trace
},
@ -321,7 +321,7 @@ DOMIfaceAndProtoJSClass Worker::sProtoClass = {
"Worker",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(2),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -464,7 +464,7 @@ DOMJSClass ChromeWorker::sClass = {
{ "ChromeWorker",
JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(3) |
JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
NULL, NULL, NULL, NULL, Trace,
},
@ -484,7 +484,7 @@ DOMIfaceAndProtoJSClass ChromeWorker::sProtoClass = {
"ChromeWorker",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(2),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -1774,8 +1774,7 @@ public:
MutexAutoLock lock(mMutex);
if (!mWorkerPrivate ||
!mWorkerPrivate->BlockAndCollectRuntimeStats(/* aIsQuick = */ false,
&rtStats)) {
!mWorkerPrivate->BlockAndCollectRuntimeStats(&rtStats)) {
// Returning NS_OK here will effectively report 0 memory.
return NS_OK;
}
@ -1785,24 +1784,6 @@ public:
aCallback, aClosure);
}
NS_IMETHOD
GetExplicitNonHeap(int64_t* aAmount)
{
AssertIsOnMainThread();
{
MutexAutoLock lock(mMutex);
if (!mWorkerPrivate ||
!mWorkerPrivate->BlockAndCollectRuntimeStats(/* aIsQuick = */ true,
aAmount)) {
*aAmount = 0;
}
}
return NS_OK;
}
private:
~MemoryReporter()
{ }
@ -2940,11 +2921,11 @@ WorkerPrivate::ScheduleDeletion(bool aWasPending)
}
bool
WorkerPrivate::BlockAndCollectRuntimeStats(bool aIsQuick, void* aData)
WorkerPrivate::BlockAndCollectRuntimeStats(JS::RuntimeStats* aRtStats)
{
AssertIsOnMainThread();
mMutex.AssertCurrentThreadOwns();
NS_ASSERTION(aData, "Null data!");
NS_ASSERTION(aRtStats, "Null RuntimeStats!");
NS_ASSERTION(!mMemoryReporterRunning, "How can we get reentered here?!");
@ -2973,16 +2954,7 @@ WorkerPrivate::BlockAndCollectRuntimeStats(bool aIsQuick, void* aData)
if (mMemoryReporter) {
// Don't hold the lock while doing the actual report.
MutexAutoUnlock unlock(mMutex);
if (aIsQuick) {
*static_cast<int64_t*>(aData) =
JS::GetExplicitNonHeapForRuntime(rt, JsWorkerMallocSizeOf);
succeeded = true;
} else {
succeeded =
JS::CollectRuntimeStats(rt, static_cast<JS::RuntimeStats*>(aData),
nullptr);
}
succeeded = JS::CollectRuntimeStats(rt, aRtStats, nullptr);
}
NS_ASSERTION(mMemoryReporterRunning, "This isn't possible!");

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

@ -41,6 +41,7 @@ class nsIURI;
class nsPIDOMWindow;
class nsITimer;
class nsIXPCScriptNotify;
namespace JS { class RuntimeStats; }
BEGIN_WORKERS_NAMESPACE
@ -821,7 +822,7 @@ public:
ScheduleDeletion(bool aWasPending);
bool
BlockAndCollectRuntimeStats(bool aIsQuick, void* aData);
BlockAndCollectRuntimeStats(JS::RuntimeStats* aRtStats);
bool
XHRParamsAllowed() const

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

@ -612,7 +612,7 @@ private:
JSClass WorkerGlobalScope::sClass = {
"WorkerGlobalScope",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
@ -878,7 +878,7 @@ DOMJSClass DedicatedWorkerGlobalScope::sClass = {
"DedicatedWorkerGlobalScope",
JSCLASS_DOM_GLOBAL | JSCLASS_IS_DOMJSCLASS | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(3) | JSCLASS_NEW_RESOLVE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, reinterpret_cast<JSResolveOp>(Resolve), JS_ConvertStub,
Finalize, NULL, NULL, NULL, NULL, Trace
},
@ -898,7 +898,7 @@ DOMIfaceAndProtoJSClass DedicatedWorkerGlobalScope::sProtoClass = {
"DedicatedWorkerGlobalScope",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(2),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -3,11 +3,9 @@
* 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 "nsCaseTreatment.h"
#include "nsComposeTxtSrvFilter.h"
#include "nsError.h" // for NS_OK
#include "nsIContent.h" // for nsIContent
#include "nsID.h"
#include "nsIDOMNode.h" // for nsIDOMNode
#include "nsINameSpaceManager.h" // for kNameSpaceID_None
#include "nsLiteralString.h" // for NS_LITERAL_STRING
@ -16,20 +14,6 @@
nsComposeTxtSrvFilter::nsComposeTxtSrvFilter() :
mIsForMail(false)
{
mBlockQuoteAtom = do_GetAtom("blockquote");
mSpanAtom = do_GetAtom("span");
mTableAtom = do_GetAtom("table");
mMozQuoteAtom = do_GetAtom("_moz_quote");
mClassAtom = do_GetAtom("class");
mTypeAtom = do_GetAtom("type");
mScriptAtom = do_GetAtom("script");
mTextAreaAtom = do_GetAtom("textarea");
mSelectAreaAtom = do_GetAtom("select");
mMapAtom = do_GetAtom("map");
mCiteAtom = do_GetAtom("cite");
mTrueAtom = do_GetAtom("true");
mMozSignatureAtom= do_GetAtom("moz-signature");
}
NS_IMPL_ISUPPORTS1(nsComposeTxtSrvFilter, nsITextServicesFilter)
@ -45,29 +29,29 @@ nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
if (content) {
nsIAtom *tag = content->Tag();
if (tag == mBlockQuoteAtom) {
if (tag == nsGkAtoms::blockquote) {
if (mIsForMail) {
*_retval = content->AttrValueIs(kNameSpaceID_None, mTypeAtom,
mCiteAtom, eIgnoreCase);
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::cite, eIgnoreCase);
}
} else if (tag == mSpanAtom) {
} else if (tag == nsGkAtoms::span) {
if (mIsForMail) {
*_retval = content->AttrValueIs(kNameSpaceID_None, mMozQuoteAtom,
mTrueAtom, eIgnoreCase);
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozquote,
nsGkAtoms::_true, eIgnoreCase);
if (!*_retval) {
*_retval = content->AttrValueIs(kNameSpaceID_None, mClassAtom,
mMozSignatureAtom, eCaseMatters);
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
nsGkAtoms::mozsignature, eCaseMatters);
}
}
} else if (tag == mScriptAtom ||
tag == mTextAreaAtom ||
tag == mSelectAreaAtom ||
tag == mMapAtom) {
} else if (tag == nsGkAtoms::script ||
tag == nsGkAtoms::textarea ||
tag == nsGkAtoms::select ||
tag == nsGkAtoms::map) {
*_retval = true;
} else if (tag == mTableAtom) {
} else if (tag == nsGkAtoms::table) {
if (mIsForMail) {
*_retval =
content->AttrValueIs(kNameSpaceID_None, mClassAtom,
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
NS_LITERAL_STRING("moz-email-headers-table"),
eCaseMatters);
}

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

@ -6,8 +6,6 @@
#ifndef nsComposeTxtSrvFilter_h__
#define nsComposeTxtSrvFilter_h__
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsIAtom.h" // for nsIAtom
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS
#include "nsITextServicesFilter.h"
@ -18,11 +16,10 @@
* This filter is used to skip over various form control nodes and
* mail's cite nodes
*/
class nsComposeTxtSrvFilter : public nsITextServicesFilter
class nsComposeTxtSrvFilter MOZ_FINAL : public nsITextServicesFilter
{
public:
nsComposeTxtSrvFilter();
virtual ~nsComposeTxtSrvFilter() {}
// nsISupports interface...
NS_DECL_ISUPPORTS
@ -33,21 +30,8 @@ public:
// Helper - Intializer
void Init(bool aIsForMail) { mIsForMail = aIsForMail; }
protected:
private:
bool mIsForMail;
nsCOMPtr<nsIAtom> mBlockQuoteAtom;
nsCOMPtr<nsIAtom> mSpanAtom; // mail plain text quotes are wrapped in span tags
nsCOMPtr<nsIAtom> mMozQuoteAtom; // _moz_quote_
nsCOMPtr<nsIAtom> mTableAtom;
nsCOMPtr<nsIAtom> mClassAtom;
nsCOMPtr<nsIAtom> mTypeAtom;
nsCOMPtr<nsIAtom> mScriptAtom;
nsCOMPtr<nsIAtom> mTextAreaAtom;
nsCOMPtr<nsIAtom> mSelectAreaAtom;
nsCOMPtr<nsIAtom> mMapAtom;
nsCOMPtr<nsIAtom> mCiteAtom;
nsCOMPtr<nsIAtom> mTrueAtom;
nsCOMPtr<nsIAtom> mMozSignatureAtom;
};
#define NS_COMPOSERTXTSRVFILTER_CID \

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

@ -162,7 +162,6 @@ nsHTMLEditor::HideAnonymousEditingUIs()
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTypeInState)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mStyleSheets)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTextServices)
tmp->HideAnonymousEditingUIs();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -170,7 +169,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTypeInState)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleSheets)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTextServices)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTopLeftHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTopHandle)

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

@ -14,7 +14,6 @@
#include "nsITableEditor.h"
#include "nsIEditorMailSupport.h"
#include "nsIEditorStyleSheets.h"
#include "nsITextServicesDocument.h"
#include "nsEditor.h"
#include "nsIDOMElement.h"
@ -766,9 +765,6 @@ protected:
// an array for holding default style settings
nsTArray<PropItem*> mDefaultStyles;
// for real-time spelling
nsCOMPtr<nsITextServicesDocument> mTextServices;
protected:
/* ANONYMOUS UTILS */

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

@ -481,9 +481,8 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(mozInlineSpellChecker)
NS_IMPL_CYCLE_COLLECTING_RELEASE(mozInlineSpellChecker)
NS_IMPL_CYCLE_COLLECTION_4(mozInlineSpellChecker,
NS_IMPL_CYCLE_COLLECTION_3(mozInlineSpellChecker,
mSpellCheck,
mTextServicesDocument,
mTreeWalker,
mCurrentSelectionAnchorNode)
@ -675,16 +674,6 @@ mozInlineSpellChecker::SetEnableRealTimeSpell(bool aEnabled)
res = spellchecker->InitSpellChecker(editor, false);
NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsITextServicesDocument> tsDoc = do_CreateInstance("@mozilla.org/textservices/textservicesdocument;1", &res);
NS_ENSURE_SUCCESS(res, res);
res = tsDoc->SetFilter(filter);
NS_ENSURE_SUCCESS(res, res);
res = tsDoc->InitWithEditor(editor);
NS_ENSURE_SUCCESS(res, res);
mTextServicesDocument = tsDoc;
mSpellCheck = spellchecker;
// spell checking is enabled, register our event listeners to track navigation

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

@ -11,7 +11,6 @@
#include "nsIEditorSpellCheck.h"
#include "nsIEditActionListener.h"
#include "nsIInlineSpellChecker.h"
#include "nsITextServicesDocument.h"
#include "nsIDOMTreeWalker.h"
#include "nsWeakReference.h"
#include "nsEditor.h"
@ -130,7 +129,6 @@ private:
nsWeakPtr mEditor;
nsCOMPtr<nsIEditorSpellCheck> mSpellCheck;
nsCOMPtr<nsITextServicesDocument> mTextServicesDocument;
nsCOMPtr<nsIDOMTreeWalker> mTreeWalker;
nsCOMPtr<mozISpellI18NUtil> mConverter;

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

@ -104,7 +104,6 @@ class BasicShadowableCanvasLayer : public BasicCanvasLayer,
public:
BasicShadowableCanvasLayer(BasicShadowLayerManager* aManager) :
BasicCanvasLayer(aManager),
mBufferIsOpaque(false),
mCanvasClient(nullptr)
{
MOZ_COUNT_CTOR(BasicShadowableCanvasLayer);
@ -154,7 +153,6 @@ private:
return BUFFER_IMAGE_SINGLE;
}
bool mBufferIsOpaque;
RefPtr<CanvasClient> mCanvasClient;
};

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

@ -278,11 +278,8 @@ BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
void* aCallbackData)
{
ContentClientRemote* contentClientRemote = static_cast<ContentClientRemote*>(mContentClient.get());
if (HasShadow() && !mContentClient->GetIPDLActor()) {
mContentClient->Connect();
BasicManager()->Attach(mContentClient, this);
}
MOZ_ASSERT(contentClientRemote->GetIPDLActor() || !HasShadow());
// NB: this just throws away the entire valid region if there are
// too many rects.
mValidRegion.SimplifyInward(8);

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

@ -634,12 +634,6 @@ public:
return NS_OK;
}
NS_IMETHOD GetExplicitNonHeap(int64_t *n)
{
*n = 0; // this reporter makes neither "explicit" non NONHEAP reports
return NS_OK;
}
};
NS_IMPL_ISUPPORTS1(SurfaceMemoryReporter, nsIMemoryMultiReporter)

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

@ -1137,14 +1137,6 @@ gfxFontCache::MemoryReporter::CollectReports
return NS_OK;
}
NS_IMETHODIMP
gfxFontCache::MemoryReporter::GetExplicitNonHeap(int64_t* aAmount)
{
// This reporter only measures heap memory.
*aAmount = 0;
return NS_OK;
}
// Observer for the memory-pressure notification, to trigger
// flushing of the shaped-word caches
class MemoryPressureObserver MOZ_FINAL : public nsIObserver,

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

@ -120,14 +120,6 @@ gfxPlatformFontList::MemoryReporter::CollectReports
return NS_OK;
}
NS_IMETHODIMP
gfxPlatformFontList::MemoryReporter::GetExplicitNonHeap(int64_t* aAmount)
{
// This reporter only measures heap memory.
*aAmount = 0;
return NS_OK;
}
gfxPlatformFontList::gfxPlatformFontList(bool aNeedFullnamePostscriptNames)
: mNeedFullnamePostscriptNames(aNeedFullnamePostscriptNames),
mStartIndex(0), mIncrement(kNumFontsPerSlice), mNumFamilies(0)

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

@ -323,15 +323,6 @@ public:
return NS_OK;
}
// nsIMemoryMultiReporter abstract method implementation
NS_IMETHOD
GetExplicitNonHeap(int64_t *aExplicitNonHeap)
{
// This reporter doesn't do any non-heap measurements.
*aExplicitNonHeap = 0;
return NS_OK;
}
};
NS_IMPL_ISUPPORTS1(GPUAdapterMultiReporter, nsIMemoryMultiReporter)
#endif // ENABLE_GPU_MEM_REPORTER

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

@ -2674,9 +2674,6 @@ RasterImage::WriteToDecoder(const char *aBuffer, uint32_t aCount)
mDecoder->Write(aBuffer, aCount);
mInDecoder = false;
if (!mDecoder)
return NS_ERROR_FAILURE;
CONTAINER_ENSURE_SUCCESS(mDecoder->GetDecoderError());
// Keep track of the total number of bytes written over the lifetime of the
@ -3278,7 +3275,6 @@ RasterImage::IsDecodeFinished()
// Precondition
mDecodingMutex.AssertCurrentThreadOwns();
NS_ABORT_IF_FALSE(mDecoder, "Can't call IsDecodeFinished() without decoder!");
MOZ_ASSERT(mDecodeRequest);
// The decode is complete if we got what we wanted.
if (mDecoder->IsSizeDecode()) {
@ -3292,7 +3288,8 @@ RasterImage::IsDecodeFinished()
// If the decoder returned because it needed a new frame and we haven't
// written to it since then, the decoder may be storing data that it hasn't
// decoded yet.
if (mDecoder->NeedsNewFrame() || mDecodeRequest->mAllocatedNewFrame) {
if (mDecoder->NeedsNewFrame() ||
(mDecodeRequest && mDecodeRequest->mAllocatedNewFrame)) {
return false;
}

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

@ -150,17 +150,6 @@ public:
return NS_OK;
}
NS_IMETHOD GetExplicitNonHeap(int64_t *n)
{
size_t n2 = 0;
for (uint32_t i = 0; i < mKnownLoaders.Length(); i++) {
mKnownLoaders[i]->mChromeCache.EnumerateRead(EntryExplicitNonHeapSize, &n2);
mKnownLoaders[i]->mCache.EnumerateRead(EntryExplicitNonHeapSize, &n2);
}
*n = n2;
return NS_OK;
}
static int64_t GetImagesContentUsedUncompressed()
{
size_t n = 0;
@ -222,20 +211,6 @@ private:
return PL_DHASH_NEXT;
}
static PLDHashOperator EntryExplicitNonHeapSize(const nsACString&,
imgCacheEntry *entry,
void *userArg)
{
size_t *n = static_cast<size_t*>(userArg);
nsRefPtr<imgRequest> req = entry->GetRequest();
Image *image = static_cast<Image*>(req->mImage.get());
if (image) {
*n += image->NonHeapSizeOfDecoded();
}
return PL_DHASH_NEXT;
}
static PLDHashOperator EntryUsedUncompressedSize(const nsACString&,
imgCacheEntry *entry,
void *userArg)

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

@ -400,7 +400,7 @@ static const JSClass sCPOW_NewEnumerateState_JSClass = {
"CPOW NewEnumerate State",
JSCLASS_HAS_PRIVATE |
JSCLASS_HAS_RESERVED_SLOTS(sNumNewEnumerateStateSlots),
JS_PropertyStub, JS_PropertyStub,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub,
JS_ConvertStub, CPOW_NewEnumerateState_Finalize

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

@ -274,6 +274,43 @@ ObjectWrapperParent::jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
}
}
/*static*/ bool
ObjectWrapperParent::boolean_from_JSVariant(JSContext* cx, const JSVariant& from,
JSBool* to)
{
switch (from.type()) {
case JSVariant::Tvoid_t:
*to = false;
return true;
case JSVariant::TPObjectWrapperParent: {
JS::Rooted<JS::Value> v(cx);
if (!jsval_from_PObjectWrapperParent(cx, from.get_PObjectWrapperParent(), v.address()))
return false;
*to = JS::ToBoolean(v);
return true;
}
case JSVariant::TnsString:
{
JSString* str = JS_NewUCStringCopyZ(cx, from.get_nsString().BeginReading());
if (!str)
return false;
*to = JS::ToBoolean(JS::StringValue(str));
return true;
}
case JSVariant::Tint:
*to = from.get_int() != 0;
return true;
case JSVariant::Tdouble:
*to = JS::ToBoolean(JS::DoubleValue(from.get_double()));
return true;
case JSVariant::Tbool:
*to = from.get_bool();
return true;
default:
return false;
}
}
/*static*/ bool
ObjectWrapperParent::
JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from, PObjectWrapperParent** to)
@ -432,7 +469,7 @@ ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandl
/*static*/ JSBool
ObjectWrapperParent::CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id,
JSMutableHandleValue vp)
JSBool *succeeded)
{
CPOW_LOG(("Calling CPOW_DelProperty (%s)...",
JSVAL_TO_CSTR(cx, id)));
@ -454,7 +491,7 @@ ObjectWrapperParent::CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandl
self->CallDelProperty(in_id,
aco.StatusPtr(), &out_v) &&
aco.Ok() &&
jsval_from_JSVariant(cx, out_v, vp.address()));
boolean_from_JSVariant(cx, out_v, succeeded));
}
JSBool

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

@ -63,7 +63,7 @@ private:
CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
static JSBool
CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
static JSBool
CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
@ -100,6 +100,8 @@ private:
static bool jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to);
static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
jsval* to);
static bool boolean_from_JSVariant(JSContext* cx, const JSVariant& from,
JSBool* to);
static bool
JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from, PObjectWrapperParent** to);
static bool

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

@ -52,7 +52,7 @@ CreateJSDGlobal(JSContext *cx, JSClass *clasp);
static JSClass global_class = {
"JSDGlobal", JSCLASS_GLOBAL_FLAGS |
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, global_finalize
};

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

@ -444,9 +444,6 @@ class ObjectPrivateVisitor
extern JS_PUBLIC_API(bool)
CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisitor *opv);
extern JS_PUBLIC_API(int64_t)
GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf);
extern JS_PUBLIC_API(size_t)
SystemCompartmentCount(JSRuntime *rt);

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

@ -254,7 +254,7 @@ if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
fi
STLPORT_SOURCES="$android_ndk/sources/cxx-stl/stlport"
STLPORT_CPPFLAGS="-I$_objdir/build/stlport -I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LIBS="-lstlport_static"
STLPORT_LIBS="-lstlport_static -static-libstdc++"
elif test "$target" != "arm-android-eabi"; then
dnl fail if we're not building with NDKr4
AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])

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

@ -582,7 +582,7 @@ static Class CollatorClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(COLLATOR_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1060,7 +1060,7 @@ static Class NumberFormatClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(NUMBER_FORMAT_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1509,7 +1509,7 @@ static Class DateTimeFormatClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(DATE_TIME_FORMAT_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1985,7 +1985,7 @@ Class js::IntlClass = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Intl),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -873,7 +873,7 @@ Class js::MapIteratorClass = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(MapIteratorObject::SlotCount),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1013,7 +1013,7 @@ Class MapObject::class_ = {
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Map),
JS_PropertyStub, // addProperty
JS_PropertyStub, // delProperty
JS_DeletePropertyStub, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub,
@ -1446,7 +1446,7 @@ Class js::SetIteratorClass = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(SetIteratorObject::SlotCount),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1556,7 +1556,7 @@ Class SetObject::class_ = {
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Set),
JS_PropertyStub, // addProperty
JS_PropertyStub, // delProperty
JS_DeletePropertyStub, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub,

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

@ -7,7 +7,7 @@ Class js::ModuleClass = {
"Module",
JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -53,7 +53,7 @@ Class ParallelArrayObject::protoClass = {
"ParallelArray",
JSCLASS_HAS_CACHED_PROTO(JSProto_ParallelArray),
JS_PropertyStub, // addProperty
JS_PropertyStub, // delProperty
JS_DeletePropertyStub, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub,
@ -65,7 +65,7 @@ Class ParallelArrayObject::class_ = {
"ParallelArray",
JSCLASS_HAS_CACHED_PROTO(JSProto_ParallelArray),
JS_PropertyStub, // addProperty
JS_PropertyStub, // delProperty
JS_DeletePropertyStub, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub,

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

@ -750,7 +750,7 @@ finalize_counter_finalize(JSFreeOp *fop, JSObject *obj)
static JSClass FinalizeCounterClass = {
"FinalizeCounter", JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -444,14 +444,14 @@ namespace UInt64 {
static JSClass sCTypesGlobalClass = {
"ctypes",
JSCLASS_HAS_RESERVED_SLOTS(CTYPESGLOBAL_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sCABIClass = {
"CABI",
JSCLASS_HAS_RESERVED_SLOTS(CABI_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
@ -461,7 +461,7 @@ static JSClass sCABIClass = {
static JSClass sCTypeProtoClass = {
"CType",
JSCLASS_HAS_RESERVED_SLOTS(CTYPEPROTO_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::FinalizeProtoClass,
NULL, ConstructAbstract, NULL, ConstructAbstract
};
@ -471,14 +471,14 @@ static JSClass sCTypeProtoClass = {
static JSClass sCDataProtoClass = {
"CData",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sCTypeClass = {
"CType",
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::Finalize,
NULL, CType::ConstructData, CType::HasInstance, CType::ConstructData,
CType::Trace
@ -487,7 +487,7 @@ static JSClass sCTypeClass = {
static JSClass sCDataClass = {
"CData",
JSCLASS_HAS_RESERVED_SLOTS(CDATA_SLOTS),
JS_PropertyStub, JS_PropertyStub, ArrayType::Getter, ArrayType::Setter,
JS_PropertyStub, JS_DeletePropertyStub, ArrayType::Getter, ArrayType::Setter,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CData::Finalize,
NULL, FunctionType::Call, NULL, FunctionType::Call
};
@ -495,7 +495,7 @@ static JSClass sCDataClass = {
static JSClass sCClosureClass = {
"CClosure",
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CClosure::Finalize,
NULL, NULL, NULL, NULL, CClosure::Trace
};
@ -506,7 +506,7 @@ static JSClass sCClosureClass = {
static JSClass sCDataFinalizerProtoClass = {
"CDataFinalizer",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
@ -519,7 +519,7 @@ static JSClass sCDataFinalizerProtoClass = {
static JSClass sCDataFinalizerClass = {
"CDataFinalizer",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(CDATAFINALIZER_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CDataFinalizer::Finalize,
};
@ -679,28 +679,28 @@ static JSFunctionSpec sFunctionInstanceFunctions[] = {
static JSClass sInt64ProtoClass = {
"Int64",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sUInt64ProtoClass = {
"UInt64",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sInt64Class = {
"Int64",
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize
};
static JSClass sUInt64Class = {
"UInt64",
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize
};

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

@ -33,7 +33,7 @@ typedef Rooted<JSFlatString*> RootedFlatString;
static JSClass sLibraryClass = {
"Library",
JSCLASS_HAS_RESERVED_SLOTS(LIBRARY_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub,JS_ResolveStub, JS_ConvertStub, Library::Finalize
};

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

@ -13,7 +13,7 @@ using namespace JS;
/* The class of the global object. */
JSClass global_class = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};

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

@ -2286,7 +2286,7 @@ static Class AsmJSModuleClass = {
JSCLASS_IS_ANONYMOUS | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(ASM_CODE_NUM_RESERVED_SLOTS),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -203,8 +203,7 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
RootedScript inlineScript(cx, target->nonLazyScript());
ExecutionMode executionMode = info().executionMode();
if (!CanIonCompile(inlineScript, executionMode)) {
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline due to disable Ion compilation",
inlineScript->filename(), inlineScript->lineno);
IonSpew(IonSpew_Inlining, "Cannot inline due to disable Ion compilation");
return false;
}
@ -213,8 +212,7 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
ion::IsBaselineEnabled(cx) &&
!inlineScript->hasBaselineScript())
{
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline target with no baseline jitcode",
inlineScript->filename(), inlineScript->lineno);
IonSpew(IonSpew_Inlining, "Cannot inline target with no baseline jitcode");
return false;
}
@ -222,8 +220,7 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
IonBuilder *builder = callerBuilder_;
while (builder) {
if (builder->script() == inlineScript) {
IonSpew(IonSpew_Inlining, "%s:%d Not inlining recursive call",
inlineScript->filename(), inlineScript->lineno);
IonSpew(IonSpew_Inlining, "Not inlining recursive call");
return false;
}
builder = builder->callerBuilder_;
@ -232,15 +229,12 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
RootedScript callerScript(cx, script());
if (!oracle->canEnterInlinedFunction(target)) {
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline due to oracle veto %d",
inlineScript->filename(), inlineScript->lineno,
script()->lineno);
IonSpew(IonSpew_Inlining, "Cannot inline due to oracle veto %d", script()->lineno);
return false;
}
if (!oracle->callReturnTypeSetMatches(callerScript, pc, target)) {
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline due to return typeset mismatch",
inlineScript->filename(), inlineScript->lineno);
IonSpew(IonSpew_Inlining, "Cannot inline due to return typeset mismatch");
return false;
}
@ -249,8 +243,7 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
// For constructing calls the typeset of caller should intersect the callee's typeset.
// Except for the |this| type, because that is created during execution depending on target.
if (!oracle->callArgsTypeSetIntersects(NULL, callInfo.argvType(), target)) {
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline due to arguments typeset mismatch",
inlineScript->filename(), inlineScript->lineno);
IonSpew(IonSpew_Inlining, "Cannot inline due to arguments typeset mismatch");
return false;
}
} else if (JSOp(*pc) == JSOP_FUNAPPLY) {
@ -259,25 +252,18 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
// of fun.apply. Seeing a new type will only be noticed in the inlined call and
// result in missed types in TI.
if (!oracle->callArgsTypeSetMatches(callInfo.thisType(), callInfo.argvType(), target)) {
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline due to arguments typeset mismatch",
inlineScript->filename(), inlineScript->lineno);
IonSpew(IonSpew_Inlining, "Cannot inline due to arguments typeset mismatch");
return false;
}
} else {
// For normal calls the typeset of caller should intersect the callee's typeset.
if (!oracle->callArgsTypeSetIntersects(callInfo.thisType(), callInfo.argvType(), target)) {
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline due to arguments typeset mismatch",
inlineScript->filename(), inlineScript->lineno);
IonSpew(IonSpew_Inlining, "Cannot inline due to arguments typeset mismatch");
return false;
}
}
if (inlineScript->hasIonScript() && inlineScript->ionScript()->bailoutExpected()) {
IonSpew(IonSpew_Inlining, "%s:%d Cannot inline due to known bailing script",
inlineScript->filename(), inlineScript->lineno);
return false;
}
IonSpew(IonSpew_Inlining, "Inlining good to go!");
return true;
}
@ -3060,12 +3046,6 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
// Accumulate return values.
MIRGraphExits &exits = *inlineBuilder.graph().exitAccumulator();
if (exits.length() == 0) {
// Inlining of functions that have no exit is not supported.
calleeScript->analysis()->setIonUninlineable();
abortReason_ = AbortReason_Inlining;
return false;
}
MDefinition *retvalDefn = patchInlinedReturns(thisCall, exits, returnBlock);
if (!retvalDefn)
return false;
@ -3246,17 +3226,24 @@ IonBuilder::makeInliningDecision(JSFunction *target, CallInfo &callInfo)
// Heuristics!
IonBuilder *baseBuilder = this;
while (baseBuilder->callerBuilder_)
baseBuilder = baseBuilder->callerBuilder_;
// When caller is excessively large only inline small functions.
if (script()->length > js_IonOptions.inlineMaxTotalBytecodeLength &&
!IsSmallFunction(targetScript)) {
IonSpew(IonSpew_Inlining, "%s:%d - Vetoed: caller excessively large.",
// Cap the inlining depth.
if (IsSmallFunction(targetScript)) {
if (inliningDepth_ >= js_IonOptions.smallFunctionMaxInlineDepth) {
IonSpew(IonSpew_Inlining, "%s:%d - Vetoed: exceeding allowed inline depth",
targetScript->filename(), targetScript->lineno);
return false;
}
} else {
if (inliningDepth_ >= js_IonOptions.maxInlineDepth) {
IonSpew(IonSpew_Inlining, "%s:%d - Vetoed: exceeding allowed inline depth",
targetScript->filename(), targetScript->lineno);
return false;
}
}
// Always inline the empty script up to the inlining depth.
if (targetScript->length == 1)
return true;
// Callee must not be excessively large.
// This heuristic also applies to the callsite as a whole.
@ -3281,36 +3268,6 @@ IonBuilder::makeInliningDecision(JSFunction *target, CallInfo &callInfo)
return false;
}
// Cap the inlining depth.
uint32_t scriptMaxInlineDepth = targetScript->maxInlineDepth();
uint32_t globalMaxInlineDepth = js_IonOptions.maxInlineDepth;
if (IsSmallFunction(targetScript))
globalMaxInlineDepth = js_IonOptions.smallFunctionMaxInlineDepth;
// Cap the global inline depth.
if (inliningDepth_ >= globalMaxInlineDepth) {
IonSpew(IonSpew_Inlining, "%s:%d - Vetoed: exceeding global inline depth",
targetScript->filename(), targetScript->lineno);
baseBuilder->script()->disableInlineDepthCheck();
return false;
}
// Cap on scripts inline depth.
if (inliningDepth_ >= scriptMaxInlineDepth)
{
IonSpew(IonSpew_Inlining, "%s:%d - Vetoed: exceeding script inline depth.",
targetScript->filename(), targetScript->lineno);
return false;
}
// Update scripts max inline depth
// I.e. make sure that all known scripts that get inlined by this script still get inlined.
if (!baseBuilder->script()->isInlineDepthCheckDisabled()) {
uint32_t updatedInlineDepth = globalMaxInlineDepth - inliningDepth_ - 1;
if (updatedInlineDepth < baseBuilder->script()->maxInlineDepth())
baseBuilder->script()->setMaxInlineDepth(updatedInlineDepth);
}
return true;
}

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

@ -703,6 +703,12 @@ TypeInferenceOracle::canEnterInlinedFunction(RawFunction target)
{
RootedScript targetScript(cx, target->nonLazyScript());
// Make sure empty script has type information, to allow inlining in more cases.
if (targetScript->length == 1) {
if (!targetScript->ensureRanInference(cx))
return false;
}
if (!targetScript->hasAnalysis() ||
!targetScript->analysis()->ranInference() ||
!targetScript->analysis()->ranSSA())

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

@ -510,8 +510,17 @@ class Assembler : public AssemblerX86Shared
}
void mov(ImmWord word, const Register &dest) {
// If the word value is in [0,UINT32_MAX], we can use the more compact
// movl instruction, which has a 32-bit immediate field which it
// zero-extends into the 64-bit register.
if (word.value <= UINT32_MAX) {
uint32_t value32 = static_cast<uint32_t>(word.value);
Imm32 imm32(static_cast<int32_t>(value32));
movl(imm32, dest);
} else {
movq(word, dest);
}
}
void mov(const Imm32 &imm32, const Register &dest) {
movl(imm32, dest);
}

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

@ -79,7 +79,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
// X64 helpers.
/////////////////////////////////////////////////////////////////
void call(ImmWord target) {
movq(target, rax);
mov(target, rax);
call(rax);
}
@ -166,7 +166,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
JS_ASSERT(dest.valueReg() != ScratchReg);
if (payload != dest.valueReg())
movq(payload, dest.valueReg());
movq(ImmShiftedTag(type), ScratchReg);
mov(ImmShiftedTag(type), ScratchReg);
orq(Operand(ScratchReg), dest.valueReg());
}
void pushValue(ValueOperand val) {
@ -207,7 +207,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
JS_ASSERT(src != dest);
JSValueShiftedTag tag = (JSValueShiftedTag)JSVAL_TYPE_TO_SHIFTED_TAG(type);
movq(ImmShiftedTag(tag), dest);
mov(ImmShiftedTag(tag), dest);
#ifdef DEBUG
if (type == JSVAL_TYPE_INT32 || type == JSVAL_TYPE_BOOLEAN) {
Label upper32BitsZeroed;
@ -344,7 +344,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
void cmpPtr(const Register &lhs, const ImmWord rhs) {
JS_ASSERT(lhs != ScratchReg);
movq(rhs, ScratchReg);
mov(rhs, ScratchReg);
cmpq(lhs, ScratchReg);
}
void cmpPtr(const Register &lhs, const ImmGCPtr rhs) {
@ -357,7 +357,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
cmpq(lhs, ScratchReg);
}
void cmpPtr(const Operand &lhs, const ImmWord rhs) {
movq(rhs, ScratchReg);
mov(rhs, ScratchReg);
cmpq(lhs, ScratchReg);
}
void cmpPtr(const Address &lhs, const ImmGCPtr rhs) {
@ -413,7 +413,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
}
void addPtr(ImmWord imm, const Register &dest) {
JS_ASSERT(dest != ScratchReg);
movq(imm, ScratchReg);
mov(imm, ScratchReg);
addq(ScratchReg, dest);
}
void addPtr(const Address &src, const Register &dest) {
@ -430,14 +430,14 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
}
void branch32(Condition cond, const AbsoluteAddress &lhs, Imm32 rhs, Label *label) {
movq(ImmWord(lhs.addr), ScratchReg);
mov(ImmWord(lhs.addr), ScratchReg);
branch32(cond, Address(ScratchReg, 0), rhs, label);
}
// Specialization for AbsoluteAddress.
void branchPtr(Condition cond, const AbsoluteAddress &addr, const Register &ptr, Label *label) {
JS_ASSERT(ptr != ScratchReg);
movq(ImmWord(addr.addr), ScratchReg);
mov(ImmWord(addr.addr), ScratchReg);
branchPtr(cond, Operand(ScratchReg, 0x0), ptr, label);
}
@ -493,13 +493,13 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
movq(src, dest);
}
void movePtr(ImmWord imm, Register dest) {
movq(imm, dest);
mov(imm, dest);
}
void movePtr(ImmGCPtr imm, Register dest) {
movq(imm, dest);
}
void loadPtr(const AbsoluteAddress &address, Register dest) {
movq(ImmWord(address.addr), ScratchReg);
mov(ImmWord(address.addr), ScratchReg);
movq(Operand(ScratchReg, 0x0), dest);
}
void loadPtr(const Address &address, Register dest) {
@ -516,7 +516,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
shlq(Imm32(1), dest);
}
void storePtr(ImmWord imm, const Address &address) {
movq(imm, ScratchReg);
mov(imm, ScratchReg);
movq(ScratchReg, Operand(address));
}
void storePtr(ImmGCPtr imm, const Address &address) {
@ -530,7 +530,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
movq(src, dest);
}
void storePtr(const Register &src, const AbsoluteAddress &address) {
movq(ImmWord(address.addr), ScratchReg);
mov(ImmWord(address.addr), ScratchReg);
movq(src, Operand(ScratchReg, 0x0));
}
void rshiftPtr(Imm32 imm, Register dest) {
@ -871,7 +871,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
} pun;
pun.d = d;
if (!maybeInlineDouble(pun.u, dest)) {
movq(ImmWord(pun.u), ScratchReg);
mov(ImmWord(pun.u), ScratchReg);
movqsd(ScratchReg, dest);
}
}

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

@ -646,7 +646,7 @@ IonRuntime::generatePreBarrier(JSContext *cx, MIRType type)
masm.PushRegsInMask(regs);
JS_ASSERT(PreBarrierReg == rdx);
masm.movq(ImmWord(cx->runtime), rcx);
masm.mov(ImmWord(cx->runtime), rcx);
masm.setupUnalignedABICall(2, rax);
masm.passABIArg(rcx);

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

@ -6,4 +6,4 @@ assertThrowsInstanceOf(function() {"use strict"; delete m.p;}, TypeError);
x = new Proxy(m, {})
assertEq(x.p, 3);
assertEq((function fun() {"use strict"; return delete x.p; })(), false);
assertThrowsInstanceOf(function fun() {"use strict"; return delete x.p; }, TypeError);

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

@ -1,5 +1,4 @@
var a = [0,1,2,3,4,5,6,7,8,9,10];
for (var i = 0; i < 10; i++)
delete a.length;
assertEq(delete a.length, false);
assertEq(delete a.length, false);

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

@ -77,7 +77,7 @@ ScriptAnalysis::addJump(JSContext *cx, unsigned offset,
if (offset < *currentOffset) {
/* Scripts containing loops are never inlined. */
isJaegerInlineable = false;
isJaegerInlineable = isIonInlineable = false;
hasLoops_ = true;
if (code->analyzed) {

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

@ -24,7 +24,7 @@ JSClass addPropertyClass = {
"AddPropertyTester",
0,
addProperty,
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -10,7 +10,7 @@ static JSClass CustomClass = {
"CustomClass",
JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,

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

@ -12,7 +12,7 @@ JSClass global_class = {
"global",
JSCLASS_IS_GLOBAL | JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,

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

@ -27,7 +27,7 @@ static JSClass ptestClass = {
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, // add
JS_PropertyStub, // delete
JS_DeletePropertyStub, // delete
test_prop_get, // get
JS_StrictPropertyStub, // set
JS_EnumerateStub,

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

@ -32,7 +32,7 @@ js::Class HasCustomIterClass = {
"HasCustomIter",
0,
JS_PropertyStub,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,

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

@ -41,7 +41,7 @@ static JSClass DocumentAllClass = {
"DocumentAll",
JSCLASS_EMULATES_UNDEFINED,
JS_PropertyStub,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
@ -78,7 +78,7 @@ document_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flag
static JSClass document_class = {
"document", JSCLASS_NEW_RESOLVE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, (JSResolveOp) document_resolve, JS_ConvertStub
};

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

@ -95,7 +95,7 @@ BEGIN_TEST(testNewObject_1)
static JSClass cls = {
"testNewObject_1",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
NULL, NULL, NULL, constructHook
};

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

@ -8,7 +8,7 @@ static JSClass ObjectEmulatingUndefinedClass = {
"ObjectEmulatingUndefined",
JSCLASS_EMULATES_UNDEFINED,
JS_PropertyStub,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,

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

@ -23,7 +23,7 @@ my_convert(JSContext* context, JS::HandleObject obj, JSType type, JS::MutableHan
static JSClass myClass = {
"MyClass",
0,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, my_convert
};

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

@ -27,7 +27,7 @@ reset(JSContext *cx)
}
static JSClass ptestClass = {
"Prof", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
"Prof", 0, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub,
JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};

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

@ -20,7 +20,7 @@ CounterAdd(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHand
static JSClass CounterClass = {
"Counter", /* name */
0, /* flags */
CounterAdd, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
CounterAdd, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};

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

@ -20,7 +20,7 @@ BEGIN_TEST(testResolveRecursion)
JSCLASS_NEW_RESOLVE | JSCLASS_HAS_PRIVATE,
JS_PropertyStub, // add
JS_PropertyStub, // delete
JS_DeletePropertyStub, // delete
JS_PropertyStub, // get
JS_StrictPropertyStub, // set
JS_EnumerateStub,

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

@ -230,7 +230,7 @@ class JSAPITest
static JSClass * basicGlobalClass() {
static JSClass c = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
return &c;

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

@ -880,7 +880,6 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
data(NULL),
gcLock(NULL),
gcHelperThread(thisFromCtor()),
sizeOfNonHeapAsmJSArrays_(0),
#ifdef JS_THREADSAFE
#ifdef JS_ION
workerThreadState(NULL),
@ -3197,6 +3196,13 @@ JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool s
return JS_TRUE;
}
JS_PUBLIC_API(JSBool)
JS_DeletePropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded)
{
*succeeded = true;
return true;
}
JS_PUBLIC_API(JSBool)
JS_EnumerateStub(JSContext *cx, JSHandleObject obj)
{
@ -4432,16 +4438,17 @@ JS_DeletePropertyById2(JSContext *cx, JSObject *objArg, jsid id, jsval *rval)
RootedValue value(cx);
JSBool succeeded;
if (JSID_IS_SPECIAL(id)) {
Rooted<SpecialId> sid(cx, JSID_TO_SPECIALID(id));
if (!JSObject::deleteSpecial(cx, obj, sid, &value, false))
if (!JSObject::deleteSpecial(cx, obj, sid, &succeeded))
return false;
} else {
if (!JSObject::deleteByValue(cx, obj, IdToValue(id), &value, false))
if (!JSObject::deleteByValue(cx, obj, IdToValue(id), &succeeded))
return false;
}
*rval = value;
*rval = BooleanValue(succeeded);
return true;
}
@ -4454,11 +4461,11 @@ JS_DeleteElement2(JSContext *cx, JSObject *objArg, uint32_t index, jsval *rval)
assertSameCompartment(cx, obj);
JSAutoResolveFlags rf(cx, 0);
RootedValue value(cx);
if (!JSObject::deleteElement(cx, obj, index, &value, false))
JSBool succeeded;
if (!JSObject::deleteElement(cx, obj, index, &succeeded))
return false;
*rval = value;
*rval = BooleanValue(succeeded);
return true;
}
@ -4474,11 +4481,11 @@ JS_DeleteProperty2(JSContext *cx, JSObject *objArg, const char *name, jsval *rva
if (!atom)
return false;
RootedValue value(cx);
if (!JSObject::deleteByValue(cx, obj, StringValue(atom), &value, false))
JSBool succeeded;
if (!JSObject::deleteByValue(cx, obj, StringValue(atom), &succeeded))
return false;
*rval = value;
*rval = BooleanValue(succeeded);
return true;
}
@ -4494,11 +4501,11 @@ JS_DeleteUCProperty2(JSContext *cx, JSObject *objArg, const jschar *name, size_t
if (!atom)
return false;
RootedValue value(cx);
if (!JSObject::deleteByValue(cx, obj, StringValue(atom), &value, false))
JSBool succeeded;
if (!JSObject::deleteByValue(cx, obj, StringValue(atom), &succeeded))
return false;
*rval = value;
*rval = BooleanValue(succeeded);
return true;
}
@ -4650,7 +4657,7 @@ static Class prop_iter_class = {
"PropertyIterator",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -820,11 +820,9 @@ typedef js::RawValue JSRawValue;
/* JSClass operation signatures. */
/*
* Add, delete, or get a property named by id in obj. Note the jsid id
* type -- id may be a string (Unicode property identifier) or an int (element
* index). The *vp out parameter, on success, is the new property value after
* an add or get. After a successful delete, *vp is JSVAL_FALSE iff
* obj[id] can't be deleted (because it's permanent).
* Add or get a property named by id in obj. Note the jsid id type -- id may
* be a string (Unicode property identifier) or an int (element index). The
* *vp out parameter, on success, is the new property value after the action.
*/
typedef JSBool
(* JSPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
@ -839,6 +837,24 @@ typedef JSBool
typedef JSBool
(* JSStrictPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
/*
* Delete a property named by id in obj.
*
* If an error occurred, return false as per normal JSAPI error practice.
*
* If no error occurred, but the deletion attempt wasn't allowed (perhaps
* because the property was non-configurable), set *succeeded to false and
* return true. This will cause |delete obj[id]| to evaluate to false in
* non-strict mode code, and to throw a TypeError in strict mode code.
*
* If no error occurred and the deletion wasn't disallowed (this is *not* the
* same as saying that a deletion actually occurred -- deleting a non-existent
* property, or an inherited property, is allowed -- it's just pointless),
* set *succeeded to true and return true.
*/
typedef JSBool
(* JSDeletePropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
/*
* This function type is used for callbacks that enumerate the properties of
* a JSObject. The behavior depends on the value of enum_op:
@ -2810,7 +2826,7 @@ struct JSClass {
/* Mandatory non-null function pointer members. */
JSPropertyOp addProperty;
JSPropertyOp delProperty;
JSDeletePropertyOp delProperty;
JSPropertyOp getProperty;
JSStrictPropertyOp setProperty;
JSEnumerateOp enumerate;
@ -2999,6 +3015,9 @@ JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandl
extern JS_PUBLIC_API(JSBool)
JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
extern JS_PUBLIC_API(JSBool)
JS_DeletePropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
extern JS_PUBLIC_API(JSBool)
JS_EnumerateStub(JSContext *cx, JSHandleObject obj);

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

@ -325,20 +325,19 @@ SetArrayElement(JSContext *cx, HandleObject obj, double index, HandleValue v)
}
/*
* Delete the element |index| from |obj|. If |strict|, do a strict
* deletion: throw if the property is not configurable.
* Attempt to delete the element |index| from |obj| as if by
* |obj.[[Delete]](index)|.
*
* - Return 1 if the deletion succeeds (that is, ES5's [[Delete]] would
* return true)
* If an error occurs while attempting to delete the element (that is, the call
* to [[Delete]] threw), return false.
*
* - Return 0 if the deletion fails because the property is not
* configurable (that is, [[Delete]] would return false). Note that if
* |strict| is true we will throw, not return zero.
*
* - Return -1 if an exception occurs (that is, [[Delete]] would throw).
* Otherwise set *succeeded to indicate whether the deletion attempt succeeded
* (that is, whether the call to [[Delete]] returned true or false). (Deletes
* generally fail only when the property is non-configurable, but proxies may
* implement different semantics.)
*/
static int
DeleteArrayElement(JSContext *cx, HandleObject obj, double index, bool strict)
static bool
DeleteArrayElement(JSContext *cx, HandleObject obj, double index, JSBool *succeeded)
{
JS_ASSERT(index >= 0);
JS_ASSERT(floor(index) == index);
@ -350,37 +349,34 @@ DeleteArrayElement(JSContext *cx, HandleObject obj, double index, bool strict)
obj->markDenseElementsNotPacked(cx);
obj->setDenseElement(idx, MagicValue(JS_ELEMENTS_HOLE));
if (!js_SuppressDeletedElement(cx, obj, idx))
return -1;
return false;
}
}
return 1;
}
RootedValue v(cx);
if (index <= UINT32_MAX) {
if (!JSObject::deleteElement(cx, obj, uint32_t(index), &v, strict))
return -1;
} else {
if (!JSObject::deleteByValue(cx, obj, DoubleValue(index), &v, strict))
return -1;
*succeeded = true;
return true;
}
return v.isTrue() ? 1 : 0;
if (index <= UINT32_MAX)
return JSObject::deleteElement(cx, obj, uint32_t(index), succeeded);
return JSObject::deleteByValue(cx, obj, DoubleValue(index), succeeded);
}
/*
* When hole is true, delete the property at the given index. Otherwise set
* its value to v assuming v is rooted.
*/
static JSBool
SetOrDeleteArrayElement(JSContext *cx, HandleObject obj, double index,
JSBool hole, HandleValue v)
/* ES6 20130308 draft 9.3.5 */
static bool
DeletePropertyOrThrow(JSContext *cx, HandleObject obj, double index)
{
if (hole) {
JS_ASSERT(v.isUndefined());
return DeleteArrayElement(cx, obj, index, true) >= 0;
}
return SetArrayElement(cx, obj, index, v);
JSBool succeeded;
if (!DeleteArrayElement(cx, obj, index, &succeeded))
return false;
if (succeeded)
return true;
RootedId id(cx);
if (!ValueToId<CanGC>(cx, NumberValue(index), &id))
return false;
return obj->reportNotConfigurable(cx, id, JSREPORT_ERROR);
}
JSBool
@ -475,10 +471,20 @@ array_length_setter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict,
JSObject::setArrayLength(cx, obj, oldlen + 1);
return false;
}
int deletion = DeleteArrayElement(cx, obj, oldlen, strict);
if (deletion <= 0) {
JSBool succeeded;
if (!DeleteArrayElement(cx, obj, oldlen, &succeeded))
return false;
if (!succeeded) {
JSObject::setArrayLength(cx, obj, oldlen + 1);
return deletion >= 0;
if (!strict)
return true;
RootedId id(cx);
if (!IndexToId(cx, oldlen, &id))
return false;
obj->reportNotConfigurable(cx, id);
return false;
}
} while (oldlen != newlen);
} else {
@ -500,10 +506,18 @@ array_length_setter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict,
return false;
if (JSID_IS_VOID(nid))
break;
// XXX Bug! We should fail fast on the highest non-configurable
// property we find, as we do in the simple-loop case above.
// But since we're iterating in unknown order here, we don't
// know if we're hitting the highest non-configurable property
// when we hit a failure. For now just drop unsuccessful
// deletion on the floor, as the previous code here did.
uint32_t index;
RootedValue junk(cx);
JSBool succeeded;
if (js_IdIsIndex(nid, &index) && index - newlen < gap &&
!JSObject::deleteElement(cx, obj, index, &junk, false)) {
!JSObject::deleteElement(cx, obj, index, &succeeded))
{
return false;
}
}
@ -567,7 +581,7 @@ Class js::ArrayClass = {
"Array",
JSCLASS_HAS_CACHED_PROTO(JSProto_Array),
array_addProperty,
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1044,11 +1058,29 @@ array_reverse(JSContext *cx, unsigned argc, Value *vp)
JSBool hole, hole2;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, i, &hole, &lowval) ||
!GetElement(cx, obj, len - i - 1, &hole2, &hival) ||
!SetOrDeleteArrayElement(cx, obj, len - i - 1, hole, lowval) ||
!SetOrDeleteArrayElement(cx, obj, i, hole2, hival)) {
!GetElement(cx, obj, len - i - 1, &hole2, &hival))
{
return false;
}
if (!hole && !hole2) {
if (!SetArrayElement(cx, obj, i, hival))
return false;
if (!SetArrayElement(cx, obj, len - i - 1, lowval))
return false;
} else if (hole && !hole2) {
if (!SetArrayElement(cx, obj, i, hival))
return false;
if (!DeletePropertyOrThrow(cx, obj, len - i - 1))
return false;
} else if (!hole && hole2) {
if (!DeletePropertyOrThrow(cx, obj, i))
return false;
if (!SetArrayElement(cx, obj, len - i - 1, lowval))
return false;
} else {
// No action required.
}
}
args.rval().setObject(*obj);
return true;
@ -1657,7 +1689,7 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
/* Re-create any holes that sorted to the end of the array. */
while (len > n) {
if (!JS_CHECK_OPERATION_LIMIT(cx) || DeleteArrayElement(cx, obj, --len, true) < 0)
if (!JS_CHECK_OPERATION_LIMIT(cx) || !DeletePropertyOrThrow(cx, obj, --len))
return false;
}
args.rval().setObject(*obj);
@ -1760,7 +1792,7 @@ array_pop_slowly(JSContext *cx, HandleObject obj, CallArgs &args)
if (!GetElement(cx, obj, index, &hole, &elt))
return false;
if (!hole && DeleteArrayElement(cx, obj, index, true) < 0)
if (!hole && !DeletePropertyOrThrow(cx, obj, index))
return false;
args.rval().set(elt);
@ -1783,7 +1815,7 @@ array_pop_dense(JSContext *cx, HandleObject obj, CallArgs &args)
if (!GetElement(cx, obj, index, &hole, &elt))
return false;
if (!hole && DeleteArrayElement(cx, obj, index, true) < 0)
if (!hole && !DeletePropertyOrThrow(cx, obj, index))
return false;
args.rval().set(elt);
@ -1871,15 +1903,21 @@ js::array_shift(JSContext *cx, unsigned argc, Value *vp)
/* Slide down the array above the first element. */
RootedValue value(cx);
for (uint32_t i = 0; i < length; i++) {
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, i + 1, &hole, &value) ||
!SetOrDeleteArrayElement(cx, obj, i, hole, value)) {
return JS_FALSE;
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
if (!GetElement(cx, obj, i + 1, &hole, &value))
return false;
if (hole) {
if (!DeletePropertyOrThrow(cx, obj, i))
return false;
} else {
if (!SetArrayElement(cx, obj, i, value))
return false;
}
}
/* Delete the only or last element when it exists. */
if (!hole && DeleteArrayElement(cx, obj, length, true) < 0)
if (!hole && !DeletePropertyOrThrow(cx, obj, length))
return JS_FALSE;
}
return SetLengthProperty(cx, obj, length);
@ -1927,10 +1965,16 @@ array_unshift(JSContext *cx, unsigned argc, Value *vp)
do {
--last, --upperIndex;
JSBool hole;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, last, &hole, &value) ||
!SetOrDeleteArrayElement(cx, obj, upperIndex, hole, value)) {
return JS_FALSE;
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
if (!GetElement(cx, obj, last, &hole, &value))
return false;
if (hole) {
if (!DeletePropertyOrThrow(cx, obj, upperIndex))
return false;
} else {
if (!SetArrayElement(cx, obj, upperIndex, value))
return false;
}
} while (last != 0);
}
@ -2115,18 +2159,24 @@ array_splice(JSContext *cx, unsigned argc, Value *vp)
/* Steps 12(a)-(b). */
RootedValue fromValue(cx);
for (uint32_t from = sourceIndex, to = targetIndex; from < len; from++, to++) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
JSBool hole;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, from, &hole, &fromValue) ||
!SetOrDeleteArrayElement(cx, obj, to, hole, fromValue))
{
if (!GetElement(cx, obj, from, &hole, &fromValue))
return false;
if (hole) {
if (!DeletePropertyOrThrow(cx, obj, to))
return false;
} else {
if (!SetArrayElement(cx, obj, to, fromValue))
return false;
}
}
/* Steps 12(c)-(d). */
for (uint32_t k = len; k > finalLength; k--) {
if (DeleteArrayElement(cx, obj, k - 1, true) < 0)
if (!DeletePropertyOrThrow(cx, obj, k - 1))
return false;
}
}
@ -2155,14 +2205,21 @@ array_splice(JSContext *cx, unsigned argc, Value *vp)
} else {
RootedValue fromValue(cx);
for (double k = len - actualDeleteCount; k > actualStart; k--) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
double from = k + actualDeleteCount - 1;
double to = k + itemCount - 1;
JSBool hole;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, from, &hole, &fromValue) ||
!SetOrDeleteArrayElement(cx, obj, to, hole, fromValue))
{
if (!GetElement(cx, obj, from, &hole, &fromValue))
return false;
if (hole) {
if (!DeletePropertyOrThrow(cx, obj, to))
return false;
} else {
if (!SetArrayElement(cx, obj, to, fromValue))
return false;
}
}

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

@ -38,8 +38,9 @@ using namespace js::types;
Class js::BooleanClass = {
"Boolean",
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Boolean), JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Boolean),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -180,11 +180,11 @@ typedef JSBool
typedef JSBool
(* SpecialAttributesOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, unsigned *attrsp);
typedef JSBool
(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict);
(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, JSBool *succeeded);
typedef JSBool
(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict);
(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, JSBool *succeeded);
typedef JSBool
(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict);
(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, JSBool *succeeded);
typedef JSObject *
@ -198,7 +198,7 @@ typedef void
\
/* Mandatory non-null function pointer members. */ \
JSPropertyOp addProperty; \
JSPropertyOp delProperty; \
JSDeletePropertyOp delProperty; \
JSPropertyOp getProperty; \
JSStrictPropertyOp setProperty; \
JSEnumerateOp enumerate; \

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

@ -143,24 +143,6 @@ JSRuntime::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, JS::RuntimeSizes
rtSizes->scriptData += mallocSizeOf(r.front());
}
size_t
JSRuntime::sizeOfExplicitNonHeap()
{
size_t n = stackSpace.sizeOf();
if (execAlloc_) {
JS::CodeSizes sizes;
execAlloc_->sizeOfCode(&sizes);
n += sizes.jaeger + sizes.ion + sizes.baseline + sizes.asmJS +
sizes.regexp + sizes.other + sizes.unused;
}
if (bumpAlloc_)
n += bumpAlloc_->sizeOfNonHeapData();
return n;
}
void
JSRuntime::triggerOperationCallback()
{

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

@ -1204,8 +1204,6 @@ struct JSRuntime : private JS::shadow::Runtime,
js::AsmJSMachExceptionHandler asmJSMachExceptionHandler;
#endif
size_t sizeOfNonHeapAsmJSArrays_;
#ifdef JS_THREADSAFE
# ifdef JS_ION
js::WorkerThreadState *workerThreadState;
@ -1405,7 +1403,6 @@ struct JSRuntime : private JS::shadow::Runtime,
}
void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, JS::RuntimeSizes *runtime);
size_t sizeOfExplicitNonHeap();
private:

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

@ -422,6 +422,16 @@ CallJSPropertyOpSetter(JSContext *cx, StrictPropertyOp op, HandleObject obj, Han
return op(cx, obj, id, strict, vp);
}
static inline bool
CallJSDeletePropertyOp(JSContext *cx, JSDeletePropertyOp op, HandleObject receiver, HandleId id,
JSBool *succeeded)
{
JS_CHECK_RECURSION(cx, return false);
assertSameCompartment(cx, receiver, id);
return op(cx, receiver, id, succeeded);
}
inline bool
CallSetter(JSContext *cx, HandleObject obj, HandleId id, StrictPropertyOp op, unsigned attrs,
unsigned shortid, JSBool strict, MutableHandleValue vp)

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

@ -511,7 +511,7 @@ Class js::DateClass = {
JSCLASS_HAS_RESERVED_SLOTS(JSObject::DATE_CLASS_RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Date),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -68,7 +68,7 @@ Class js::ErrorClass = {
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_NEW_RESOLVE |
JSCLASS_HAS_CACHED_PROTO(JSProto_Error),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -548,7 +548,7 @@ JS_FRIEND_DATA(Class) js::FunctionClass = {
JSCLASS_NEW_RESOLVE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Function),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
fun_enumerate,

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

@ -177,7 +177,7 @@ const uint32_t JSSLOT_SAVED_ID = 1;
Class js_NoSuchMethodClass = {
"NoSuchMethod",
JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
};
@ -2129,9 +2129,15 @@ BEGIN_CASE(JSOP_DELPROP)
RootedObject &obj = rootObject0;
FETCH_OBJECT(cx, -1, obj);
MutableHandleValue res = MutableHandleValue::fromMarkedLocation(&regs.sp[-1]);
if (!JSObject::deleteProperty(cx, obj, name, res, script->strict))
JSBool succeeded;
if (!JSObject::deleteProperty(cx, obj, name, &succeeded))
goto error;
if (!succeeded && script->strict) {
obj->reportNotConfigurable(cx, NameToId(name));
goto error;
}
MutableHandleValue res = MutableHandleValue::fromMarkedLocation(&regs.sp[-1]);
res.setBoolean(succeeded);
}
END_CASE(JSOP_DELPROP)
@ -2144,10 +2150,22 @@ BEGIN_CASE(JSOP_DELELEM)
RootedValue &propval = rootValue0;
propval = regs.sp[-1];
MutableHandleValue res = MutableHandleValue::fromMarkedLocation(&regs.sp[-2]);
if (!JSObject::deleteByValue(cx, obj, propval, res, script->strict))
JSBool succeeded;
if (!JSObject::deleteByValue(cx, obj, propval, &succeeded))
goto error;
if (!succeeded && script->strict) {
// XXX This observably calls ToString(propval). We should convert to
// PropertyKey and use that to delete, and to report an error if
// necessary!
RootedId id(cx);
if (!ValueToId<CanGC>(cx, propval, &id))
goto error;
obj->reportNotConfigurable(cx, id);
goto error;
}
MutableHandleValue res = MutableHandleValue::fromMarkedLocation(&regs.sp[-2]);
res.setBoolean(succeeded);
regs.sp--;
}
END_CASE(JSOP_DELELEM)
@ -3613,22 +3631,17 @@ template <bool strict>
bool
js::DeleteProperty(JSContext *cx, HandleValue v, HandlePropertyName name, JSBool *bp)
{
// default op result is false (failure)
*bp = true;
// convert value to JSObject pointer
RootedObject obj(cx, ToObjectFromStack(cx, v));
if (!obj)
return false;
// Call deleteProperty on obj
RootedValue result(cx, NullValue());
bool delprop_ok = JSObject::deleteProperty(cx, obj, name, &result, strict);
if (!delprop_ok)
if (!JSObject::deleteProperty(cx, obj, name, bp))
return false;
// convert result into *bp and return
*bp = result.toBoolean();
if (strict && !*bp) {
obj->reportNotConfigurable(cx, NameToId(name));
return false;
}
return true;
}
@ -3643,16 +3656,23 @@ js::DeleteElement(JSContext *cx, HandleValue val, HandleValue index, JSBool *bp)
if (!obj)
return false;
RootedValue result(cx);
if (!JSObject::deleteByValue(cx, obj, index, &result, strict))
if (!JSObject::deleteByValue(cx, obj, index, bp))
return false;
*bp = result.toBoolean();
if (strict && !*bp) {
// XXX This observably calls ToString(propval). We should convert to
// PropertyKey and use that to delete, and to report an error if
// necessary!
RootedId id(cx);
if (!ValueToId<CanGC>(cx, index, &id))
return false;
obj->reportNotConfigurable(cx, id);
return false;
}
return true;
}
template bool js::DeleteElement<true> (JSContext *, HandleValue, HandleValue, JSBool *);
template bool js::DeleteElement<false>(JSContext *, HandleValue, HandleValue, JSBool *);
template bool js::DeleteElement<true> (JSContext *, HandleValue, HandleValue, JSBool *succeeded);
template bool js::DeleteElement<false>(JSContext *, HandleValue, HandleValue, JSBool *succeeded);
bool
js::GetElement(JSContext *cx, MutableHandleValue lref, HandleValue rref, MutableHandleValue vp)
@ -3755,10 +3775,16 @@ js::DeleteNameOperation(JSContext *cx, HandlePropertyName name, HandleObject sco
if (!LookupName(cx, name, scopeObj, &scope, &pobj, &shape))
return false;
/* ECMA says to return true if name is undefined or inherited. */
if (!scope) {
// Return true for non-existent names.
res.setBoolean(true);
if (shape)
return JSObject::deleteProperty(cx, scope, name, res, false);
return true;
}
JSBool succeeded;
if (!JSObject::deleteProperty(cx, scope, name, &succeeded))
return false;
res.setBoolean(succeeded);
return true;
}

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

@ -837,7 +837,7 @@ Class PropertyIteratorObject::class_ = {
JSCLASS_HAS_PRIVATE |
JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -940,7 +940,7 @@ Class js::ElementIteratorClass = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(ElementIteratorObject::NumSlots),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1298,7 +1298,7 @@ Class js::StopIterationClass = {
JSCLASS_HAS_CACHED_PROTO(JSProto_StopIteration) |
JSCLASS_FREEZE_PROTO,
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -1395,7 +1395,7 @@ Class js::GeneratorClass = {
"Generator",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -86,7 +86,7 @@ Class js::MathClass = {
js_Math_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Math),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -375,29 +375,6 @@ JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisit
return true;
}
JS_PUBLIC_API(int64_t)
JS::GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf)
{
// explicit/*/gc-heap/*
size_t n = size_t(JS_GetGCParameter(rt, JSGC_TOTAL_CHUNKS)) * gc::ChunkSize;
// Subtract decommitted arenas, which aren't included in "explicit".
size_t decommittedArenas = 0;
IterateChunks(rt, &decommittedArenas, DecommittedArenasChunkCallback);
n -= decommittedArenas;
// explicit/*/objects-extra/elements/asm.js (64-bit platforms only)
n += rt->sizeOfNonHeapAsmJSArrays_;
// explicit/runtime/mjit-code
// explicit/runtime/regexp-code
// explicit/runtime/stack-committed
// explicit/runtime/unused-code-memory
n += rt->sizeOfExplicitNonHeap();
return int64_t(n);
}
JS_PUBLIC_API(size_t)
JS::SystemCompartmentCount(JSRuntime *rt)
{

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

@ -409,7 +409,7 @@ Class js::NumberClass = {
js_Number_str,
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Number),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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

@ -82,7 +82,7 @@ Class js::ObjectClass = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -908,8 +908,8 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD
* redefining it or we had invoked its setter to change its value).
*/
if (callDelProperty) {
RootedValue dummy(cx, UndefinedValue());
if (!CallJSPropertyOp(cx, obj2->getClass()->delProperty, obj2, id, &dummy))
JSBool succeeded;
if (!CallJSDeletePropertyOp(cx, obj2->getClass()->delProperty, obj2, id, &succeeded))
return false;
}
@ -1617,27 +1617,26 @@ JSObject::nonNativeSetElement(JSContext *cx, HandleObject obj,
}
/* static */ bool
JSObject::deleteByValue(JSContext *cx, HandleObject obj,
const Value &property, MutableHandleValue rval, bool strict)
JSObject::deleteByValue(JSContext *cx, HandleObject obj, const Value &property, JSBool *succeeded)
{
uint32_t index;
if (IsDefinitelyIndex(property, &index))
return deleteElement(cx, obj, index, rval, strict);
return deleteElement(cx, obj, index, succeeded);
RootedValue propval(cx, property);
Rooted<SpecialId> sid(cx);
if (ValueIsSpecial(obj, &propval, &sid, cx))
return deleteSpecial(cx, obj, sid, rval, strict);
return deleteSpecial(cx, obj, sid, succeeded);
JSAtom *name = ToAtom<CanGC>(cx, propval);
if (!name)
return false;
if (name->isIndex(&index))
return deleteElement(cx, obj, index, rval, strict);
return deleteElement(cx, obj, index, succeeded);
Rooted<PropertyName*> propname(cx, name->asPropertyName());
return deleteProperty(cx, obj, propname, rval, strict);
return deleteProperty(cx, obj, propname, succeeded);
}
JS_FRIEND_API(bool)
@ -2225,8 +2224,8 @@ js::DefineConstructorAndPrototype(JSContext *cx, HandleObject obj, JSProtoKey ke
bad:
if (named) {
RootedValue rval(cx);
JSObject::deleteByValue(cx, obj, StringValue(atom), &rval, false);
JSBool succeeded;
JSObject::deleteByValue(cx, obj, StringValue(atom), &succeeded);
}
if (cached)
ClearClassObject(obj, key);
@ -4367,10 +4366,8 @@ baseops::SetElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, u
}
JSBool
baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue rval, JSBool strict)
baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, JSBool *succeeded)
{
rval.setBoolean(true);
RootedObject proto(cx);
RootedShape shape(cx);
if (!baseops::LookupProperty<CanGC>(cx, obj, id, &proto, &shape))
@ -4378,17 +4375,17 @@ baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHand
if (!shape || proto != obj) {
/*
* If no property, or the property comes from a prototype, call the
* class's delProperty hook, passing rval as the result parameter.
* class's delProperty hook, passing succeeded as the result parameter.
*/
return CallJSPropertyOp(cx, obj->getClass()->delProperty, obj, id, rval);
return CallJSDeletePropertyOp(cx, obj->getClass()->delProperty, obj, id, succeeded);
}
GCPoke(cx->runtime);
if (IsImplicitDenseElement(shape)) {
if (!CallJSPropertyOp(cx, obj->getClass()->delProperty, obj, id, rval))
if (!CallJSDeletePropertyOp(cx, obj->getClass()->delProperty, obj, id, succeeded))
return false;
if (rval.isFalse())
if (!succeeded)
return true;
JSObject::setDenseElementHole(cx, obj, JSID_TO_INT(id));
@ -4396,9 +4393,7 @@ baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHand
}
if (!shape->configurable()) {
if (strict)
return obj->reportNotConfigurable(cx, id);
rval.setBoolean(false);
*succeeded = false;
return true;
}
@ -4406,9 +4401,9 @@ baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHand
if (!shape->getUserId(cx, &userid))
return false;
if (!CallJSPropertyOp(cx, obj->getClass()->delProperty, obj, userid, rval))
if (!CallJSDeletePropertyOp(cx, obj->getClass()->delProperty, obj, userid, succeeded))
return false;
if (rval.isFalse())
if (!succeeded)
return true;
return obj->removeProperty(cx, id) && js_SuppressDeletedProperty(cx, obj, id);
@ -4416,28 +4411,26 @@ baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHand
JSBool
baseops::DeleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleValue rval, JSBool strict)
JSBool *succeeded)
{
Rooted<jsid> id(cx, NameToId(name));
return baseops::DeleteGeneric(cx, obj, id, rval, strict);
return baseops::DeleteGeneric(cx, obj, id, succeeded);
}
JSBool
baseops::DeleteElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue rval, JSBool strict)
baseops::DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, JSBool *succeeded)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return baseops::DeleteGeneric(cx, obj, id, rval, strict);
return baseops::DeleteGeneric(cx, obj, id, succeeded);
}
JSBool
baseops::DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue rval, JSBool strict)
baseops::DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, JSBool *succeeded)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return baseops::DeleteGeneric(cx, obj, id, rval, strict);
return baseops::DeleteGeneric(cx, obj, id, succeeded);
}
bool

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

@ -192,16 +192,16 @@ extern JSBool
SetElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp);
extern JSBool
DeleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue rval, JSBool strict);
DeleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, JSBool *succeeded);
extern JSBool
DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue rval, JSBool strict);
DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, JSBool *succeeded);
extern JSBool
DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue rval, JSBool strict);
DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, JSBool *succeeded);
extern JSBool
DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue rval, JSBool strict);
DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, JSBool *succeeded);
} /* namespace js::baseops */
@ -892,15 +892,13 @@ class JSObject : public js::ObjectImpl
static inline bool deleteProperty(JSContext *cx, js::HandleObject obj,
js::HandlePropertyName name,
js::MutableHandleValue rval, bool strict);
JSBool *succeeded);
static inline bool deleteElement(JSContext *cx, js::HandleObject obj,
uint32_t index,
js::MutableHandleValue rval, bool strict);
uint32_t index, JSBool *succeeded);
static inline bool deleteSpecial(JSContext *cx, js::HandleObject obj,
js::HandleSpecialId sid,
js::MutableHandleValue rval, bool strict);
js::HandleSpecialId sid, JSBool *succeeded);
static bool deleteByValue(JSContext *cx, js::HandleObject obj,
const js::Value &property, js::MutableHandleValue rval, bool strict);
const js::Value &property, JSBool *succeeded);
static inline bool enumerate(JSContext *cx, JS::HandleObject obj, JSIterateOp iterop,
JS::MutableHandleValue statep, JS::MutableHandleId idp);

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

@ -194,19 +194,18 @@ JSObject::getPropertyNoGC(JSContext *cx, JSObject *obj, JSObject *receiver,
}
/* static */ inline bool
JSObject::deleteProperty(JSContext *cx, js::HandleObject obj,
js::HandlePropertyName name, js::MutableHandleValue rval, bool strict)
JSObject::deleteProperty(JSContext *cx, js::HandleObject obj, js::HandlePropertyName name,
JSBool *succeeded)
{
JS::RootedId id(cx, js::NameToId(name));
js::types::AddTypePropertyId(cx, obj, id, js::types::Type::UndefinedType());
js::types::MarkTypePropertyConfigured(cx, obj, id);
js::DeletePropertyOp op = obj->getOps()->deleteProperty;
return (op ? op : js::baseops::DeleteProperty)(cx, obj, name, rval, strict);
return (op ? op : js::baseops::DeleteProperty)(cx, obj, name, succeeded);
}
/* static */ inline bool
JSObject::deleteElement(JSContext *cx, js::HandleObject obj,
uint32_t index, js::MutableHandleValue rval, bool strict)
JSObject::deleteElement(JSContext *cx, js::HandleObject obj, uint32_t index, JSBool *succeeded)
{
JS::RootedId id(cx);
if (!js::IndexToId(cx, index, &id))
@ -214,18 +213,18 @@ JSObject::deleteElement(JSContext *cx, js::HandleObject obj,
js::types::AddTypePropertyId(cx, obj, id, js::types::Type::UndefinedType());
js::types::MarkTypePropertyConfigured(cx, obj, id);
js::DeleteElementOp op = obj->getOps()->deleteElement;
return (op ? op : js::baseops::DeleteElement)(cx, obj, index, rval, strict);
return (op ? op : js::baseops::DeleteElement)(cx, obj, index, succeeded);
}
/* static */ inline bool
JSObject::deleteSpecial(JSContext *cx, js::HandleObject obj,
js::HandleSpecialId sid, js::MutableHandleValue rval, bool strict)
JSObject::deleteSpecial(JSContext *cx, js::HandleObject obj, js::HandleSpecialId sid,
JSBool *succeeded)
{
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
js::types::AddTypePropertyId(cx, obj, id, js::types::Type::UndefinedType());
js::types::MarkTypePropertyConfigured(cx, obj, id);
js::DeleteSpecialOp op = obj->getOps()->deleteSpecial;
return (op ? op : js::baseops::DeleteSpecial)(cx, obj, sid, rval, strict);
return (op ? op : js::baseops::DeleteSpecial)(cx, obj, sid, succeeded);
}
inline void

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

@ -45,7 +45,7 @@ Class js::JSONClass = {
js_JSON_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_JSON),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -776,7 +776,8 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
if (newElement.isUndefined()) {
/* Step 2a(iii)(2). */
if (!JSObject::deleteByValue(cx, obj, IdToValue(id), &newElement, false))
JSBool succeeded;
if (!JSObject::deleteByValue(cx, obj, IdToValue(id), &succeeded))
return false;
} else {
/* Step 2a(iii)(3). */
@ -804,7 +805,8 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
if (newElement.isUndefined()) {
/* Step 2b(ii)(2). */
if (!JSObject::deleteByValue(cx, obj, IdToValue(id), &newElement, false))
JSBool succeeded;
if (!JSObject::deleteByValue(cx, obj, IdToValue(id), &succeeded))
return false;
} else {
/* Step 2b(ii)(3). */

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

@ -2948,41 +2948,36 @@ proxy_SetSpecialAttributes(JSContext *cx, HandleObject obj, HandleSpecialId sid,
}
static JSBool
proxy_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue rval, JSBool strict)
proxy_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, JSBool *succeeded)
{
// TODO: throwing away strict
bool deleted;
if (!Proxy::delete_(cx, obj, id, &deleted) || !js_SuppressDeletedProperty(cx, obj, id))
if (!Proxy::delete_(cx, obj, id, &deleted))
return false;
rval.setBoolean(deleted);
return true;
*succeeded = deleted;
return js_SuppressDeletedProperty(cx, obj, id);
}
static JSBool
proxy_DeleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleValue rval, JSBool strict)
proxy_DeleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, JSBool *succeeded)
{
Rooted<jsid> id(cx, NameToId(name));
return proxy_DeleteGeneric(cx, obj, id, rval, strict);
return proxy_DeleteGeneric(cx, obj, id, succeeded);
}
static JSBool
proxy_DeleteElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue rval, JSBool strict)
proxy_DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, JSBool *succeeded)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return proxy_DeleteGeneric(cx, obj, id, rval, strict);
return proxy_DeleteGeneric(cx, obj, id, succeeded);
}
static JSBool
proxy_DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue rval, JSBool strict)
proxy_DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, JSBool *succeeded)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return proxy_DeleteGeneric(cx, obj, id, rval, strict);
return proxy_DeleteGeneric(cx, obj, id, succeeded);
}
static void
@ -3070,7 +3065,7 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
"Proxy",
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -3121,7 +3116,7 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
"Proxy",
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -3196,7 +3191,7 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
"Proxy",
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(6),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
@ -3368,7 +3363,7 @@ Class js::ProxyClass = {
"Proxy",
JSCLASS_HAS_CACHED_PROTO(JSProto_Proxy),
JS_PropertyStub, /* addProperty */
JS_PropertyStub, /* delProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,

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