author | Phil Ringnalda <philringnalda@gmail.com> |
Sat, 25 Jun 2016 16:23:43 -0700 | |
changeset 302646 | c2da34d96746288b5fee27bf6542a12c9f410988 |
parent 302589 | 59bc5cd1caa619e2be168d5fa67803f9e96c4309 (current diff) |
parent 302645 | 0009a43ad49a316c86cdb52bcb44006b32011170 (diff) |
child 302648 | 076e176ce22e2602f63781027b0b18c1977cddd0 |
child 302659 | d9d294e3a5fd58b16d85f81665d880da46841377 |
push id | 30367 |
push user | philringnalda@gmail.com |
push date | Sat, 25 Jun 2016 23:24:01 +0000 |
treeherder | mozilla-central@c2da34d96746 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | merge |
milestone | 50.0a1 |
first release with | nightly linux32
c2da34d96746
/
50.0a1
/
20160626030213
/
files
nightly linux64
c2da34d96746
/
50.0a1
/
20160626030213
/
files
nightly mac
c2da34d96746
/
50.0a1
/
20160626030213
/
files
nightly win32
c2da34d96746
/
50.0a1
/
20160626030213
/
files
nightly win64
c2da34d96746
/
50.0a1
/
20160626030213
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
50.0a1
/
20160626030213
/
pushlog to previous
nightly linux64
50.0a1
/
20160626030213
/
pushlog to previous
nightly mac
50.0a1
/
20160626030213
/
pushlog to previous
nightly win32
50.0a1
/
20160626030213
/
pushlog to previous
nightly win64
50.0a1
/
20160626030213
/
pushlog to previous
|
--- a/dom/base/ScriptSettings.cpp +++ b/dom/base/ScriptSettings.cpp @@ -4,17 +4,16 @@ * 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 "mozilla/dom/ScriptSettings.h" #include "mozilla/ThreadLocal.h" #include "mozilla/Assertions.h" #include "jsapi.h" -#include "xpcprivate.h" // For AutoCxPusher guts #include "xpcpublic.h" #include "nsIGlobalObject.h" #include "nsIDocShell.h" #include "nsIScriptGlobalObject.h" #include "nsIScriptContext.h" #include "nsContentUtils.h" #include "nsGlobalWindow.h" #include "nsPIDOMWindow.h" @@ -33,57 +32,76 @@ class ScriptSettingsStack { public: static ScriptSettingsStackEntry* Top() { return sScriptSettingsTLS.get(); } static void Push(ScriptSettingsStackEntry *aEntry) { MOZ_ASSERT(!aEntry->mOlder); // Whenever JSAPI use is disabled, the next stack entry pushed must - // always be a candidate entry point. - MOZ_ASSERT_IF(!Top() || Top()->NoJSAPI(), aEntry->mIsCandidateEntryPoint); + // not be an AutoIncumbentScript. + MOZ_ASSERT_IF(!Top() || Top()->NoJSAPI(), + !aEntry->IsIncumbentScript()); + // Whenever the top entry is not an incumbent canidate, the next stack entry + // pushed must not be an AutoIncumbentScript. + MOZ_ASSERT_IF(Top() && !Top()->IsIncumbentCandidate(), + !aEntry->IsIncumbentScript()); aEntry->mOlder = Top(); sScriptSettingsTLS.set(aEntry); } static void Pop(ScriptSettingsStackEntry *aEntry) { MOZ_ASSERT(aEntry == Top()); sScriptSettingsTLS.set(aEntry->mOlder); } static nsIGlobalObject* IncumbentGlobal() { ScriptSettingsStackEntry *entry = Top(); - if (!entry) { - return nullptr; + while (entry) { + if (entry->IsIncumbentCandidate()) { + return entry->mGlobalObject; + } + entry = entry->mOlder; } - return entry->mGlobalObject; + return nullptr; } static ScriptSettingsStackEntry* EntryPoint() { ScriptSettingsStackEntry *entry = Top(); - if (!entry) { - return nullptr; - } while (entry) { - if (entry->mIsCandidateEntryPoint) + if (entry->IsEntryCandidate()) { return entry; + } entry = entry->mOlder; } - MOZ_CRASH("Non-empty stack should always have an entry point"); + return nullptr; } static nsIGlobalObject* EntryGlobal() { ScriptSettingsStackEntry *entry = EntryPoint(); if (!entry) { return nullptr; } return entry->mGlobalObject; } +#ifdef DEBUG + static ScriptSettingsStackEntry* TopNonIncumbentScript() { + ScriptSettingsStackEntry *entry = Top(); + while (entry) { + if (!entry->IsIncumbentScript()) { + return entry; + } + entry = entry->mOlder; + } + return nullptr; + } +#endif // DEBUG + }; static unsigned long gRunToCompletionListeners = 0; void UseEntryScriptProfiling() { MOZ_ASSERT(NS_IsMainThread()); @@ -118,45 +136,33 @@ DestroyScriptSettings() bool ScriptSettingsInitialized() { return sScriptSettingsTLSInitialized; } ScriptSettingsStackEntry::ScriptSettingsStackEntry(nsIGlobalObject *aGlobal, - bool aCandidate) + Type aType) : mGlobalObject(aGlobal) - , mIsCandidateEntryPoint(aCandidate) + , mType(aType) , mOlder(nullptr) { - MOZ_ASSERT(mGlobalObject); - MOZ_ASSERT(mGlobalObject->GetGlobalJSObject(), + MOZ_ASSERT_IF(IsIncumbentCandidate() && !NoJSAPI(), mGlobalObject); + MOZ_ASSERT(!mGlobalObject || mGlobalObject->GetGlobalJSObject(), "Must have an actual JS global for the duration on the stack"); - MOZ_ASSERT(JS_IsGlobalObject(mGlobalObject->GetGlobalJSObject()), + MOZ_ASSERT(!mGlobalObject || + JS_IsGlobalObject(mGlobalObject->GetGlobalJSObject()), "No outer windows allowed"); - - ScriptSettingsStack::Push(this); -} - -// This constructor is only for use by AutoNoJSAPI. -ScriptSettingsStackEntry::ScriptSettingsStackEntry() - : mGlobalObject(nullptr) - , mIsCandidateEntryPoint(true) - , mOlder(nullptr) -{ - ScriptSettingsStack::Push(this); } ScriptSettingsStackEntry::~ScriptSettingsStackEntry() { // We must have an actual JS global for the entire time this is on the stack. MOZ_ASSERT_IF(mGlobalObject, mGlobalObject->GetGlobalJSObject()); - - ScriptSettingsStack::Pop(this); } // If the entry or incumbent global ends up being something that the subject // principal doesn't subsume, we don't want to use it. This never happens on // the web, but can happen with asymmetric privilege relationships (i.e. // nsExpandedPrincipal and System Principal). // // The most correct thing to use instead would be the topmost global on the @@ -266,36 +272,53 @@ GetWebIDLCallerPrincipal() if (!entry || entry->NoJSAPI()) { return nullptr; } AutoEntryScript* aes = static_cast<AutoEntryScript*>(entry); return aes->mWebIDLCallerPrincipal; } +bool +IsJSAPIActive() +{ + ScriptSettingsStackEntry* topEntry = ScriptSettingsStack::Top(); + return topEntry && !topEntry->NoJSAPI(); +} + AutoJSAPI::AutoJSAPI() - : mCx(nullptr) + : ScriptSettingsStackEntry(nullptr, eJSAPI) + , mCx(nullptr) , mIsMainThread(false) // For lack of anything better { } AutoJSAPI::~AutoJSAPI() { if (!mCx) { // No need to do anything here: we never managed to Init, so can't have an // exception on our (nonexistent) JSContext. We also don't need to restore - // any state on it. + // any state on it. Finally, we never made it to pushing outselves onto the + // ScriptSettingsStack, so shouldn't pop. + MOZ_ASSERT(ScriptSettingsStack::Top() != this); return; } ReportException(); if (mOldWarningReporter.isSome()) { JS::SetWarningReporter(JS_GetRuntime(cx()), mOldWarningReporter.value()); } + + // Leave the request before popping. + if (mIsMainThread) { + mAutoRequest.reset(); + } + + ScriptSettingsStack::Pop(this); } void WarningOnlyErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aRep); void AutoJSAPI::InitInternal(nsIGlobalObject* aGlobalObject, JSObject* aGlobal, @@ -308,26 +331,24 @@ AutoJSAPI::InitInternal(nsIGlobalObject* #ifdef DEBUG bool haveException = JS_IsExceptionPending(aCx); #endif // DEBUG mCx = aCx; mIsMainThread = aIsMainThread; mGlobalObject = aGlobalObject; if (aIsMainThread) { - // This Rooted<> is necessary only as long as AutoCxPusher::AutoCxPusher - // can GC, which is only possible because XPCJSContextStack::Push calls - // nsIPrincipal.Equals. Once that is removed, the Rooted<> will no longer - // be necessary. - JS::Rooted<JSObject*> global(JS_GetRuntime(aCx), aGlobal); - mCxPusher.emplace(mCx); - mAutoNullableCompartment.emplace(mCx, global); - } else { - mAutoNullableCompartment.emplace(mCx, aGlobal); + // We _could_ just unconditionally emplace mAutoRequest here. It's just not + // needed on worker threads, and we're hoping to kill it on the main thread + // too. + mAutoRequest.emplace(mCx); } + mAutoNullableCompartment.emplace(mCx, aGlobal); + + ScriptSettingsStack::Push(this); JSRuntime* rt = JS_GetRuntime(aCx); mOldWarningReporter.emplace(JS::GetWarningReporter(rt)); JS::SetWarningReporter(rt, WarningOnlyErrorReporter); #ifdef DEBUG if (haveException) { @@ -393,18 +414,20 @@ AutoJSAPI::InitInternal(nsIGlobalObject* } MOZ_ASSERT(false, "We had an exception; we should not have"); } #endif // DEBUG } AutoJSAPI::AutoJSAPI(nsIGlobalObject* aGlobalObject, bool aIsMainThread, - JSContext* aCx) - : mIsMainThread(aIsMainThread) + JSContext* aCx, + Type aType) + : ScriptSettingsStackEntry(aGlobalObject, aType) + , mIsMainThread(aIsMainThread) { MOZ_ASSERT(aGlobalObject); MOZ_ASSERT(aGlobalObject->GetGlobalJSObject(), "Must have a JS global"); MOZ_ASSERT(aCx); MOZ_ASSERT(aIsMainThread == NS_IsMainThread()); InitInternal(aGlobalObject, aGlobalObject->GetGlobalJSObject(), aCx, aIsMainThread); @@ -578,17 +601,17 @@ AutoJSAPI::ReportException() NS_WARNING("OOMed while acquiring uncaught exception from JSAPI"); ClearException(); } } bool AutoJSAPI::PeekException(JS::MutableHandle<JS::Value> aVal) { - MOZ_ASSERT_IF(mIsMainThread, CxPusherIsStackTop()); + MOZ_ASSERT_IF(mIsMainThread, IsStackTop()); MOZ_ASSERT(HasException()); MOZ_ASSERT(js::GetContextCompartment(cx())); if (!JS_GetPendingException(cx(), aVal)) { return false; } return true; } @@ -597,23 +620,31 @@ AutoJSAPI::StealException(JS::MutableHan { if (!PeekException(aVal)) { return false; } JS_ClearPendingException(cx()); return true; } +#ifdef DEBUG +bool +AutoJSAPI::IsStackTop() const +{ + return ScriptSettingsStack::TopNonIncumbentScript() == this; +} +#endif // DEBUG + AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject, const char *aReason, bool aIsMainThread, JSContext* aCx) : AutoJSAPI(aGlobalObject, aIsMainThread, - aCx ? aCx : nsContentUtils::GetSafeJSContext()) - , ScriptSettingsStackEntry(aGlobalObject, /* aCandidate = */ true) + aCx ? aCx : nsContentUtils::GetSafeJSContext(), + eEntryScript) , mWebIDLCallerPrincipal(nullptr) { MOZ_ASSERT(aGlobalObject); MOZ_ASSERT_IF(!aCx, aIsMainThread); // cx is mandatory off-main-thread. MOZ_ASSERT_IF(aCx && aIsMainThread, aCx == nsContentUtils::GetSafeJSContext()); if (aIsMainThread && gRunToCompletionListeners > 0) { mDocShellEntryMonitor.emplace(cx(), aReason); @@ -707,90 +738,52 @@ AutoEntryScript::DocshellEntryMonitor::E // Not really worth checking GetRecordProfileTimelineMarkers here. if (window && window->GetDocShell()) { nsCOMPtr<nsIDocShell> docShellForJSRunToCompletion = window->GetDocShell(); docShellForJSRunToCompletion->NotifyJSRunToCompletionStop(); } } AutoIncumbentScript::AutoIncumbentScript(nsIGlobalObject* aGlobalObject) - : ScriptSettingsStackEntry(aGlobalObject, /* aCandidate = */ false) + : ScriptSettingsStackEntry(aGlobalObject, eIncumbentScript) , mCallerOverride(nsContentUtils::GetCurrentJSContextForThread()) { + ScriptSettingsStack::Push(this); } -AutoNoJSAPI::AutoNoJSAPI(bool aIsMainThread) - : ScriptSettingsStackEntry() +AutoIncumbentScript::~AutoIncumbentScript() { - if (aIsMainThread) { - mCxPusher.emplace(static_cast<JSContext*>(nullptr), - /* aAllowNull = */ true); - } + ScriptSettingsStack::Pop(this); } -danger::AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull) +AutoNoJSAPI::AutoNoJSAPI() + : ScriptSettingsStackEntry(nullptr, eNoJSAPI) { - MOZ_ASSERT_IF(!allowNull, cx); - - XPCJSContextStack *stack = XPCJSRuntime::Get()->GetJSContextStack(); - stack->Push(cx); - -#ifdef DEBUG - mStackDepthAfterPush = stack->Count(); - mPushedContext = cx; - mCompartmentDepthOnEntry = cx ? js::GetEnterCompartmentDepth(cx) : 0; -#endif - - // Enter a request and a compartment for the duration that the cx is on the - // stack if non-null. - if (cx) { - mAutoRequest.emplace(cx); - } + ScriptSettingsStack::Push(this); } -danger::AutoCxPusher::~AutoCxPusher() +AutoNoJSAPI::~AutoNoJSAPI() { - // Leave the request before popping. - mAutoRequest.reset(); - - // When we push a context, we may save the frame chain and pretend like we - // haven't entered any compartment. This gets restored on Pop(), but we can - // run into trouble if a Push/Pop are interleaved with a - // JSAutoEnterCompartment. Make sure the compartment depth right before we - // pop is the same as it was right after we pushed. - MOZ_ASSERT_IF(mPushedContext, mCompartmentDepthOnEntry == - js::GetEnterCompartmentDepth(mPushedContext)); - MOZ_ASSERT(mPushedContext == nsXPConnect::XPConnect()->GetCurrentJSContext()); - XPCJSRuntime::Get()->GetJSContextStack()->Pop(); + ScriptSettingsStack::Pop(this); } -#ifdef DEBUG -bool -danger::AutoCxPusher::IsStackTop() const -{ - uint32_t currentDepth = XPCJSRuntime::Get()->GetJSContextStack()->Count(); - MOZ_ASSERT(currentDepth >= mStackDepthAfterPush); - return currentDepth == mStackDepthAfterPush; -} -#endif - } // namespace dom AutoJSContext::AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL) : mCx(nullptr) { JS::AutoSuppressGCAnalysis nogc; MOZ_ASSERT(!mCx, "mCx should not be initialized!"); + MOZ_ASSERT(NS_IsMainThread()); MOZ_GUARD_OBJECT_NOTIFIER_INIT; - nsXPConnect *xpc = nsXPConnect::XPConnect(); - mCx = xpc->GetCurrentJSContext(); - - if (!mCx) { + if (IsJSAPIActive()) { + mCx = nsContentUtils::GetSafeJSContext(); + } else { mJSAPI.Init(); mCx = mJSAPI.cx(); } } AutoJSContext::operator JSContext*() const { return mCx;
--- a/dom/base/ScriptSettings.h +++ b/dom/base/ScriptSettings.h @@ -22,44 +22,16 @@ class nsPIDOMWindowInner; class nsGlobalWindow; class nsIScriptContext; class nsIDocument; class nsIDocShell; namespace mozilla { namespace dom { -// For internal use only - use AutoJSAPI instead. -namespace danger { - -/** - * Fundamental cx pushing class. All other cx pushing classes are implemented - * in terms of this class. - */ -class MOZ_STACK_CLASS AutoCxPusher -{ -public: - explicit AutoCxPusher(JSContext *aCx, bool aAllowNull = false); - ~AutoCxPusher(); - - // Returns true if this AutoCxPusher performed the push that is currently at - // the top of the cx stack. - bool IsStackTop() const; - -private: - mozilla::Maybe<JSAutoRequest> mAutoRequest; -#ifdef DEBUG - uint32_t mStackDepthAfterPush; - JSContext* mPushedContext; - unsigned mCompartmentDepthOnEntry; -#endif -}; - -} /* namespace danger */ - /* * System-wide setup/teardown routines. Init and Destroy should be invoked * once each, at startup and shutdown (respectively). */ void InitScriptSettings(); void DestroyScriptSettings(); bool ScriptSettingsInitialized(); @@ -145,74 +117,84 @@ nsIPrincipal* GetWebIDLCallerPrincipal() // This may be used by callers that know that their incumbent global is non- // null (i.e. they know there have been no System Caller pushes since the // inner-most script execution). inline JSObject& IncumbentJSGlobal() { return *GetIncumbentGlobal()->GetGlobalJSObject(); } +// Returns whether JSAPI is active right now. If it is not, working with a +// JSContext you grab from somewhere random is not OK and you should be doing +// AutoJSAPI or AutoEntryScript to get yourself a properly set up JSContext. +bool IsJSAPIActive(); + class ScriptSettingsStack; class ScriptSettingsStackEntry { friend class ScriptSettingsStack; public: ~ScriptSettingsStackEntry(); - bool NoJSAPI() { return !mGlobalObject; } + bool NoJSAPI() const { return mType == eNoJSAPI; } + bool IsEntryCandidate() const { + return mType == eEntryScript || mType == eNoJSAPI; + } + bool IsIncumbentCandidate() { return mType != eJSAPI; } + bool IsIncumbentScript() { return mType == eIncumbentScript; } protected: - ScriptSettingsStackEntry(nsIGlobalObject *aGlobal, bool aCandidate); + enum Type { + eEntryScript, + eIncumbentScript, + eJSAPI, + eNoJSAPI + }; + + ScriptSettingsStackEntry(nsIGlobalObject *aGlobal, + Type aEntryType); nsCOMPtr<nsIGlobalObject> mGlobalObject; - bool mIsCandidateEntryPoint; + Type mType; private: - // This constructor is only for use by AutoNoJSAPI. - friend class AutoNoJSAPI; - ScriptSettingsStackEntry(); - ScriptSettingsStackEntry *mOlder; }; /* * For any interaction with JSAPI, an AutoJSAPI (or one of its subclasses) * must be on the stack. * * This base class should be instantiated as-is when the caller wants to use * JSAPI but doesn't expect to run script. The caller must then call one of its * Init functions before being able to access the JSContext through cx(). * Its current duties are as-follows (see individual Init comments for details): * * * Grabbing an appropriate JSContext, and, on the main thread, pushing it onto * the JSContext stack. * * Entering an initial (possibly null) compartment, to ensure that the * previously entered compartment for that JSContext is not used by mistake. + * * Reporting any exceptions left on the JSRuntime, unless the caller steals + * or silences them. + * * On main thread, entering a JSAutoRequest. * * Additionally, the following duties are planned, but not yet implemented: * - * * De-poisoning the JSRuntime to allow manipulation of JSAPI. We can't - * actually implement this poisoning until all the JSContext pushing in the - * system goes through AutoJSAPI (see bug 951991). For now, this de-poisoning + * * De-poisoning the JSRuntime to allow manipulation of JSAPI. This requires + * implementing the poisoning first. For now, this de-poisoning * effectively corresponds to having a non-null cx on the stack. - * * Reporting any exceptions left on the JSRuntime, unless the caller steals - * or silences them. - * * Entering a JSAutoRequest. At present, this is handled by the cx pushing - * on the main thread, and by other code on workers. Depending on the order - * in which various cleanup lands, this may never be necessary, because - * JSAutoRequests may go away. * * In situations where the consumer expects to run script, AutoEntryScript * should be used, which does additional manipulation of the script settings * stack. In bug 991758, we'll add hard invariants to SpiderMonkey, such that * any attempt to run script without an AutoEntryScript on the stack will * fail. This prevents system code from accidentally triggering script * execution at inopportune moments via surreptitious getters and proxies. */ -class MOZ_STACK_CLASS AutoJSAPI { +class MOZ_STACK_CLASS AutoJSAPI : protected ScriptSettingsStackEntry { public: // Trivial constructor. One of the Init functions must be called before // accessing the JSContext through cx(). AutoJSAPI(); ~AutoJSAPI(); // This uses the SafeJSContext (or worker equivalent), and enters a null @@ -253,29 +235,29 @@ public: bool Init(nsPIDOMWindowInner* aWindow); bool Init(nsPIDOMWindowInner* aWindow, JSContext* aCx); bool Init(nsGlobalWindow* aWindow); bool Init(nsGlobalWindow* aWindow, JSContext* aCx); JSContext* cx() const { MOZ_ASSERT(mCx, "Must call Init before using an AutoJSAPI"); - MOZ_ASSERT_IF(mIsMainThread, CxPusherIsStackTop()); + MOZ_ASSERT(IsStackTop()); return mCx; } #ifdef DEBUG - bool CxPusherIsStackTop() const { return mCxPusher->IsStackTop(); } + bool IsStackTop() const; #endif // If HasException, report it. Otherwise, a no-op. void ReportException(); bool HasException() const { - MOZ_ASSERT_IF(NS_IsMainThread(), CxPusherIsStackTop()); + MOZ_ASSERT(IsStackTop()); return JS_IsExceptionPending(cx()); }; // Transfers ownership of the current exception from the JS engine to the // caller. Callers must ensure that HasException() is true, and that cx() // is in a non-null compartment. // // Note that this fails if and only if we OOM while wrapping the exception @@ -286,35 +268,31 @@ public: // Callers must ensure that HasException() is true, and that cx() is in a // non-null compartment. // // Note that this fails if and only if we OOM while wrapping the exception // into the current compartment. bool PeekException(JS::MutableHandle<JS::Value> aVal); void ClearException() { - MOZ_ASSERT_IF(NS_IsMainThread(), CxPusherIsStackTop()); + MOZ_ASSERT(IsStackTop()); JS_ClearPendingException(cx()); } protected: // Protected constructor, allowing subclasses to specify a particular cx to // be used. This constructor initialises the AutoJSAPI, so Init must NOT be // called on subclasses that use this. // If aGlobalObject, its associated JS global or aCx are null this will cause // an assertion, as will setting aIsMainThread incorrectly. - AutoJSAPI(nsIGlobalObject* aGlobalObject, bool aIsMainThread, JSContext* aCx); + AutoJSAPI(nsIGlobalObject* aGlobalObject, bool aIsMainThread, JSContext* aCx, + Type aType); private: - // We need to hold a strong ref to our global object, so it won't go away - // while we're being used. This _could_ become a JS::Rooted<JSObject*> if we - // grabbed our JSContext in our constructor instead of waiting for Init(), so - // we could construct this at that point. It might be worth it do to that. - RefPtr<nsIGlobalObject> mGlobalObject; - mozilla::Maybe<danger::AutoCxPusher> mCxPusher; + mozilla::Maybe<JSAutoRequest> mAutoRequest; mozilla::Maybe<JSAutoNullableCompartment> mAutoNullableCompartment; JSContext *mCx; // Whether we're mainthread or not; set when we're initialized. bool mIsMainThread; Maybe<JS::WarningReporter> mOldWarningReporter; void InitInternal(nsIGlobalObject* aGlobalObject, JSObject* aGlobal, @@ -326,18 +304,17 @@ private: /* * A class that represents a new script entry point. * * |aReason| should be a statically-allocated C string naming the reason we're * invoking JavaScript code: "setTimeout", "event", and so on. The devtools use * these strings to label JS execution in timeline and profiling displays. */ -class MOZ_STACK_CLASS AutoEntryScript : public AutoJSAPI, - protected ScriptSettingsStackEntry { +class MOZ_STACK_CLASS AutoEntryScript : public AutoJSAPI { public: AutoEntryScript(nsIGlobalObject* aGlobalObject, const char *aReason, bool aIsMainThread = NS_IsMainThread(), // Note: aCx is mandatory off-main-thread. JSContext* aCx = nullptr); AutoEntryScript(JSObject* aObject, // Any object from the relevant global @@ -402,33 +379,34 @@ private: }; /* * A class that can be used to force a particular incumbent script on the stack. */ class AutoIncumbentScript : protected ScriptSettingsStackEntry { public: explicit AutoIncumbentScript(nsIGlobalObject* aGlobalObject); + ~AutoIncumbentScript(); + private: JS::AutoHideScriptedCaller mCallerOverride; }; /* * A class to put the JS engine in an unusable state. The subject principal * will become System, the information on the script settings stack is * rendered inaccessible, and JSAPI may not be manipulated until the class is * either popped or an AutoJSAPI instance is subsequently pushed. * * This class may not be instantiated if an exception is pending. */ class AutoNoJSAPI : protected ScriptSettingsStackEntry { public: - explicit AutoNoJSAPI(bool aIsMainThread = NS_IsMainThread()); -private: - mozilla::Maybe<danger::AutoCxPusher> mCxPusher; + explicit AutoNoJSAPI(); + ~AutoNoJSAPI(); }; } // namespace dom /** * Use AutoJSContext when you need a JS context on the stack but don't have one * passed as a parameter. AutoJSContext will take care of finding the most * appropriate JS context and release it when leaving the stack.
--- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -5464,17 +5464,20 @@ nsContentUtils::GetContextForEventHandle } /* static */ JSContext * nsContentUtils::GetCurrentJSContext() { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(IsInitialized()); - return sXPConnect->GetCurrentJSContext(); + if (!IsJSAPIActive()) { + return nullptr; + } + return GetSafeJSContext(); } /* static */ JSContext * nsContentUtils::GetSafeJSContext() { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(IsInitialized());
--- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -1333,17 +1333,16 @@ GK_ATOM(xulcontentsgenerated, "xulconten GK_ATOM(yes, "yes") GK_ATOM(z_index, "z-index") GK_ATOM(zeroDigit, "zero-digit") GK_ATOM(percentage, "%") GK_ATOM(A, "A") GK_ATOM(alignment_baseline, "alignment-baseline") -GK_ATOM(allowReorder, "allowReorder") GK_ATOM(amplitude, "amplitude") GK_ATOM(animate, "animate") GK_ATOM(animateColor, "animateColor") GK_ATOM(animateMotion, "animateMotion") GK_ATOM(animateTransform, "animateTransform") GK_ATOM(arithmetic, "arithmetic") GK_ATOM(atop, "atop") GK_ATOM(azimuth, "azimuth")
--- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1986,16 +1986,23 @@ ContentParent::RecvDeallocateLayerTreeId // You can't deallocate layer tree ids that you didn't allocate KillHard("DeallocateLayerTreeId"); } return true; } namespace { +void +DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess) +{ + RefPtr<DeleteTask<GeckoChildProcessHost>> task = new DeleteTask<GeckoChildProcessHost>(aSubprocess); + XRE_GetIOMessageLoop()->PostTask(task.forget()); +} + // This runnable only exists to delegate ownership of the // ContentParent to this runnable, until it's deleted by the event // system. struct DelayedDeleteContentParentTask : public Runnable { explicit DelayedDeleteContentParentTask(ContentParent* aObj) : mObj(aObj) { } // No-op @@ -2117,20 +2124,19 @@ ContentParent::ActorDestroy(ActorDestroy MOZ_ASSERT(idleService); RefPtr<ParentIdleListener> listener; for (int32_t i = mIdleListeners.Length() - 1; i >= 0; --i) { listener = static_cast<ParentIdleListener*>(mIdleListeners[i].get()); idleService->RemoveIdleObserver(listener, listener->mTime); } mIdleListeners.Clear(); - if (mSubprocess) { - mSubprocess->DissociateActor(); - mSubprocess = nullptr; - } + MessageLoop::current()-> + PostTask(NewRunnableFunction(DelayedDeleteSubprocess, mSubprocess)); + mSubprocess = nullptr; // IPDL rules require actors to live on past ActorDestroy, but it // may be that the kungFuDeathGrip above is the last reference to // |this|. If so, when we go out of scope here, we're deleted and // all hell breaks loose. // // This runnable ensures that a reference to |this| lives on at // least until after the current task finishes running. @@ -3316,31 +3322,31 @@ ContentParent::DeallocPAPZParent(PAPZPar return true; } PCompositorBridgeParent* ContentParent::AllocPCompositorBridgeParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { return GPUProcessManager::Get()->CreateTabCompositorBridge( - aTransport, aOtherProcess, mSubprocess); + aTransport, aOtherProcess); } gfx::PVRManagerParent* ContentParent::AllocPVRManagerParent(Transport* aTransport, ProcessId aOtherProcess) { return gfx::VRManagerParent::CreateCrossProcess(aTransport, aOtherProcess); } PImageBridgeParent* ContentParent::AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { - return ImageBridgeParent::Create(aTransport, aOtherProcess, mSubprocess); + return ImageBridgeParent::Create(aTransport, aOtherProcess); } PBackgroundParent* ContentParent::AllocPBackgroundParent(Transport* aTransport, ProcessId aOtherProcess) { return BackgroundParent::Alloc(this, aTransport, aOtherProcess); }
--- a/dom/media/gmp/GMPProcessParent.h +++ b/dom/media/gmp/GMPProcessParent.h @@ -6,17 +6,16 @@ #ifndef GMPProcessParent_h #define GMPProcessParent_h 1 #include "mozilla/Attributes.h" #include "base/basictypes.h" #include "base/file_path.h" #include "base/thread.h" -#include "base/waitable_event.h" #include "chrome/common/child_process_host.h" #include "mozilla/ipc/GeckoChildProcessHost.h" class nsIRunnable; namespace mozilla { namespace gmp { @@ -30,17 +29,16 @@ public: // after timeoutMs, this method will return false. bool Launch(int32_t aTimeoutMs); void Delete(nsCOMPtr<nsIRunnable> aCallback = nullptr); bool CanShutdown() override { return true; } const std::string& GetPluginFilePath() { return mGMPPath; } - using mozilla::ipc::GeckoChildProcessHost::GetShutDownEvent; using mozilla::ipc::GeckoChildProcessHost::GetChannel; using mozilla::ipc::GeckoChildProcessHost::GetChildProcessHandle; private: void DoDelete(); std::string mGMPPath; nsCOMPtr<nsIRunnable> mDeletedCallback;
--- a/dom/media/webaudio/test/browser_bug1181073.js +++ b/dom/media/webaudio/test/browser_bug1181073.js @@ -18,16 +18,26 @@ add_task(function*() { content.window.clearInterval(id); resolve(end - start); }, 0); }); }); ok(time > 2000, "Interval is throttled with no webaudio (" + time + " ms)"); + // Set up a listener for the oscillator's demise + let oscillatorDemisePromise = ContentTask.spawn(browser, null, function() { + return new Promise(resolve => { + let observer = () => resolve(); + // Record the observer on the content object so we can throw it out later + content.__bug1181073_observer = observer; + Services.obs.addObserver(observer, "webaudio-node-demise", false); + }); + }); + time = yield ContentTask.spawn(browser, null, function () { return new Promise(resolve => { // Start playing audio, save it on the window so it doesn't get GCed let audioCtx = content.window.audioCtx = new content.window.AudioContext(); let oscillator = audioCtx.createOscillator(); oscillator.type = 'square'; oscillator.frequency.value = 3000; oscillator.start(); @@ -41,16 +51,17 @@ add_task(function*() { }, 0); }); }); ok(time < 1000, "Interval is not throttled with audio playing (" + time + " ms)"); // Destroy the oscillator, but not the audio context yield new Promise(resolve => SpecialPowers.exactGC(browser.contentWindow, resolve)); + yield oscillatorDemisePromise; time = yield ContentTask.spawn(browser, null, function () { return new Promise(resolve => { let start = content.performance.now(); let id = content.window.setInterval(function() { let end = content.performance.now(); content.window.clearInterval(id); resolve(end - start);
--- a/dom/plugins/ipc/PluginProcessParent.h +++ b/dom/plugins/ipc/PluginProcessParent.h @@ -8,17 +8,16 @@ #define dom_plugins_PluginProcessParent_h 1 #include "mozilla/Attributes.h" #include "base/basictypes.h" #include "base/file_path.h" #include "base/task.h" #include "base/thread.h" -#include "base/waitable_event.h" #include "chrome/common/child_process_host.h" #include "mozilla/ipc/GeckoChildProcessHost.h" #include "mozilla/ipc/TaskFactory.h" #include "mozilla/UniquePtr.h" #include "nsCOMPtr.h" #include "nsIRunnable.h" @@ -61,17 +60,16 @@ public: virtual bool CanShutdown() override { return true; } const std::string& GetPluginFilePath() { return mPluginFilePath; } - using mozilla::ipc::GeckoChildProcessHost::GetShutDownEvent; using mozilla::ipc::GeckoChildProcessHost::GetChannel; void SetCallRunnableImmediately(bool aCallImmediately); virtual bool WaitUntilConnected(int32_t aTimeoutMs = 0) override; virtual void OnChannelConnected(int32_t peer_pid) override; virtual void OnChannelError() override;
--- a/dom/svg/SVGSwitchElement.cpp +++ b/dom/svg/SVGSwitchElement.cpp @@ -122,24 +122,20 @@ SVGSwitchElement::IsAttributeMapped(cons } //---------------------------------------------------------------------- // Implementation Helpers: nsIContent * SVGSwitchElement::FindActiveChild() const { - bool allowReorder = AttrValueIs(kNameSpaceID_None, - nsGkAtoms::allowReorder, - nsGkAtoms::yes, eCaseMatters); - const nsAdoptingString& acceptLangs = Preferences::GetLocalizedString("intl.accept_languages"); - if (allowReorder && !acceptLangs.IsEmpty()) { + if (!acceptLangs.IsEmpty()) { int32_t bestLanguagePreferenceRank = -1; nsIContent *bestChild = nullptr; nsIContent *defaultChild = nullptr; for (nsIContent* child = nsINode::GetFirstChild(); child; child = child->GetNextSibling()) { if (!child->IsElement()) {
--- a/dom/svg/test/test_switch.xhtml +++ b/dom/svg/test/test_switch.xhtml @@ -53,31 +53,17 @@ function run1() { try { var doc = $("svg").contentDocument; var s = doc.getElementById("s"); var first = doc.getElementById("first"); var second = doc.getElementById("second"); var third = doc.getElementById("third"); - /* test for an exact match */ - second.setAttribute("systemLanguage", "en-gb"); - checkBounds(s, 75, 100, 50, 50); - - /* test for a close match i.e. the same language prefix */ - second.setAttribute("systemLanguage", "en-us"); - checkWidth(s, 50); - - /* test that we pick the first match */ - first.setAttribute("systemLanguage", "it"); - checkWidth(s, 70); - - /* this time with reordering */ first.setAttribute("systemLanguage", "fr"); - s.setAttribute("allowReorder", "yes"); /* test for an exact match */ second.setAttribute("systemLanguage", "en-gb"); checkWidth(s, 50); /* test for a close match i.e. the same language prefix */ second.setAttribute("systemLanguage", "en-us"); checkWidth(s, 50);
--- a/editor/libeditor/PlaceholderTxn.cpp +++ b/editor/libeditor/PlaceholderTxn.cpp @@ -27,23 +27,27 @@ PlaceholderTxn::PlaceholderTxn() : Edit PlaceholderTxn::~PlaceholderTxn() { } NS_IMPL_CYCLE_COLLECTION_CLASS(PlaceholderTxn) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PlaceholderTxn, EditAggregateTxn) - ImplCycleCollectionUnlink(*tmp->mStartSel); + if (tmp->mStartSel) { + ImplCycleCollectionUnlink(*tmp->mStartSel); + } NS_IMPL_CYCLE_COLLECTION_UNLINK(mEndSel); NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PlaceholderTxn, EditAggregateTxn) - ImplCycleCollectionTraverse(cb, *tmp->mStartSel, "mStartSel", 0); + if (tmp->mStartSel) { + ImplCycleCollectionTraverse(cb, *tmp->mStartSel, "mStartSel", 0); + } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEndSel); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PlaceholderTxn) NS_INTERFACE_MAP_ENTRY(nsIAbsorbingTransaction) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END_INHERITING(EditAggregateTxn)
--- a/gfx/ipc/GPUProcessHost.cpp +++ b/gfx/ipc/GPUProcessHost.cpp @@ -187,23 +187,31 @@ GPUProcessHost::KillHard(const char* aRe NS_WARNING("failed to kill subprocess!"); } SetAlreadyDead(); XRE_GetIOMessageLoop()->PostTask( NewRunnableFunction(&ProcessWatcher::EnsureProcessTerminated, handle, /*force=*/true)); } +static void +DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess) +{ + XRE_GetIOMessageLoop()-> + PostTask(mozilla::MakeAndAddRef<DeleteTask<GeckoChildProcessHost>>(aSubprocess)); +} + void GPUProcessHost::DestroyProcess() { // Cancel all tasks. We don't want anything triggering after our caller // expects this to go away. { MonitorAutoLock lock(mMonitor); mTaskFactory.RevokeAll(); } - DissociateActor(); + MessageLoop::current()-> + PostTask(NewRunnableFunction(DelayedDeleteSubprocess, this)); } } // namespace gfx } // namespace mozilla
--- a/gfx/ipc/GPUProcessManager.cpp +++ b/gfx/ipc/GPUProcessManager.cpp @@ -165,20 +165,19 @@ GPUProcessManager::CreateTopLevelComposi aUseAPZ, aUseExternalSurfaceSize, aSurfaceWidth, aSurfaceHeight); } PCompositorBridgeParent* GPUProcessManager::CreateTabCompositorBridge(ipc::Transport* aTransport, - base::ProcessId aOtherProcess, - ipc::GeckoChildProcessHost* aSubprocess) + base::ProcessId aOtherProcess) { - return CompositorBridgeParent::Create(aTransport, aOtherProcess, aSubprocess); + return CompositorBridgeParent::Create(aTransport, aOtherProcess); } already_AddRefed<APZCTreeManager> GPUProcessManager::GetAPZCTreeManagerForLayers(uint64_t aLayersId) { return CompositorBridgeParent::GetAPZCTreeManager(aLayersId); }
--- a/gfx/ipc/GPUProcessManager.h +++ b/gfx/ipc/GPUProcessManager.h @@ -65,18 +65,17 @@ public: CSSToLayoutDeviceScale aScale, bool aUseAPZ, bool aUseExternalSurfaceSize, int aSurfaceWidth, int aSurfaceHeight); layers::PCompositorBridgeParent* CreateTabCompositorBridge( ipc::Transport* aTransport, - base::ProcessId aOtherProcess, - ipc::GeckoChildProcessHost* aSubprocess); + base::ProcessId aOtherProcess); // This returns a reference to the APZCTreeManager to which // pan/zoom-related events can be sent. already_AddRefed<APZCTreeManager> GetAPZCTreeManagerForLayers(uint64_t aLayersId); // Allocate an ID that can be used to refer to a layer tree and // associated resources that live only on the compositor thread. //
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -63,17 +63,16 @@ #include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop #include "nsIXULRuntime.h" // for BrowserTabsRemoteAutostart #ifdef XP_WIN #include "mozilla/layers/CompositorD3D11.h" #include "mozilla/layers/CompositorD3D9.h" #endif #include "GeckoProfiler.h" #include "mozilla/ipc/ProtocolTypes.h" -#include "mozilla/ipc/GeckoChildProcessHost.h" #include "mozilla/unused.h" #include "mozilla/Hal.h" #include "mozilla/HalTypes.h" #include "mozilla/StaticPtr.h" #ifdef MOZ_ENABLE_PROFILER_SPS #include "ProfilerMarkers.h" #endif #include "mozilla/VsyncDispatcher.h" @@ -1814,17 +1813,16 @@ class CrossProcessCompositorBridgeParent public ShmemAllocator { friend class CompositorBridgeParent; public: explicit CrossProcessCompositorBridgeParent(Transport* aTransport) : CompositorBridgeParentIPCAllocator("CrossProcessCompositorBridgeParent") , mTransport(aTransport) - , mSubprocess(nullptr) , mNotifyAfterRemotePaint(false) , mDestroyCalled(false) { MOZ_ASSERT(NS_IsMainThread()); // Always run destructor on the main thread SetMessageLoopToPostDestructionTo(MessageLoop::current()); } @@ -1993,17 +1991,16 @@ private: void DeferredDestroy(); // There can be many CPCPs, and IPDL-generated code doesn't hold a // reference to top-level actors. So we hold a reference to // ourself. This is released (deferred) in ActorDestroy(). RefPtr<CrossProcessCompositorBridgeParent> mSelfRef; Transport* mTransport; - ipc::GeckoChildProcessHost* mSubprocess; RefPtr<CompositorThreadHolder> mCompositorThreadHolder; // If true, we should send a RemotePaintIsReady message when the layer transaction // is received bool mNotifyAfterRemotePaint; bool mDestroyCalled; }; @@ -2153,28 +2150,23 @@ OpenCompositor(CrossProcessCompositorBri Transport* aTransport, ProcessId aOtherPid, MessageLoop* aIOLoop) { DebugOnly<bool> ok = aCompositor->Open(aTransport, aOtherPid, aIOLoop); MOZ_ASSERT(ok); } /*static*/ PCompositorBridgeParent* -CompositorBridgeParent::Create(Transport* aTransport, ProcessId aOtherPid, GeckoChildProcessHost* aProcessHost) +CompositorBridgeParent::Create(Transport* aTransport, ProcessId aOtherPid) { gfxPlatform::InitLayersIPC(); RefPtr<CrossProcessCompositorBridgeParent> cpcp = new CrossProcessCompositorBridgeParent(aTransport); - if (aProcessHost) { - cpcp->mSubprocess = aProcessHost; - aProcessHost->AssociateActor(); - } - cpcp->mSelfRef = cpcp; CompositorLoop()->PostTask( NewRunnableFunction(OpenCompositor, cpcp.get(), aTransport, aOtherPid, XRE_GetIOMessageLoop())); // The return value is just compared to null for success checking, // we're not sharing a ref. return cpcp.get(); } @@ -2272,21 +2264,16 @@ CrossProcessCompositorBridgeParent::Recv } void CrossProcessCompositorBridgeParent::ActorDestroy(ActorDestroyReason aWhy) { RefPtr<CompositorLRU> lru = CompositorLRU::GetSingleton(); lru->Remove(this); - if (mSubprocess) { - mSubprocess->DissociateActor(); - mSubprocess = nullptr; - } - // We must keep this object alive untill the code handling message // reception is finished on this thread. MessageLoop::current()->PostTask(NewRunnableMethod(this, &CrossProcessCompositorBridgeParent::DeferredDestroy)); } PLayerTransactionParent* CrossProcessCompositorBridgeParent::AllocPLayerTransactionParent( const nsTArray<LayersBackend>&, @@ -2753,17 +2740,17 @@ CrossProcessCompositorBridgeParent::Clon base::ProcessHandle aPeerProcess, mozilla::ipc::ProtocolCloneContext* aCtx) { for (unsigned int i = 0; i < aFds.Length(); i++) { if (aFds[i].protocolId() == (unsigned)GetProtocolId()) { Transport* transport = OpenDescriptor(aFds[i].fd(), Transport::MODE_SERVER); PCompositorBridgeParent* compositor = - CompositorBridgeParent::Create(transport, base::GetProcId(aPeerProcess), mSubprocess); + CompositorBridgeParent::Create(transport, base::GetProcId(aPeerProcess)); compositor->CloneManagees(this, aCtx); compositor->IToplevelProtocol::SetTransport(transport); // The reference to the compositor thread is held in OnChannelConnected(). // We need to do this for cloned actors, too. compositor->OnChannelConnected(base::GetProcId(aPeerProcess)); return compositor; } }
--- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -46,17 +46,16 @@ namespace mozilla { class CancelableRunnable; namespace gfx { class DrawTarget; class GPUProcessManager; } // namespace gfx namespace ipc { -class GeckoChildProcessHost; class Shmem; } // namespace ipc namespace layers { class APZCTreeManager; class AsyncCompositionManager; class Compositor; @@ -395,17 +394,17 @@ public: static void SetControllerForLayerTree(uint64_t aLayersId, GeckoContentController* aController); /** * A new child process has been configured to push transactions * directly to us. Transport is to its thread context. */ static PCompositorBridgeParent* - Create(Transport* aTransport, ProcessId aOtherProcess, mozilla::ipc::GeckoChildProcessHost* aProcessHost); + Create(Transport* aTransport, ProcessId aOtherProcess); struct LayerTreeState { LayerTreeState(); ~LayerTreeState(); RefPtr<Layer> mRoot; RefPtr<GeckoContentController> mController; CompositorBridgeParent* mParent; LayerManagerComposite* mLayerManager;
--- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -11,17 +11,16 @@ #include "base/process.h" // for ProcessId #include "base/task.h" // for CancelableTask, DeleteTask, etc #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/Hal.h" // for hal::SetCurrentThreadPriority() #include "mozilla/HalTypes.h" // for hal::THREAD_PRIORITY_COMPOSITOR #include "mozilla/ipc/MessageChannel.h" // for MessageChannel, etc #include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/ipc/Transport.h" // for Transport -#include "mozilla/ipc/GeckoChildProcessHost.h" #include "mozilla/media/MediaSystemResourceManagerParent.h" // for MediaSystemResourceManagerParent #include "mozilla/layers/CompositableTransactionParent.h" #include "mozilla/layers/LayerManagerComposite.h" #include "mozilla/layers/LayersMessages.h" // for EditReply #include "mozilla/layers/LayersSurfaces.h" // for PGrallocBufferParent #include "mozilla/layers/PCompositableParent.h" #include "mozilla/layers/PImageBridgeParent.h" #include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL @@ -53,17 +52,16 @@ CompositorThreadHolder* GetCompositorThr ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop, Transport* aTransport, ProcessId aChildProcessId) : CompositableParentManager("ImageBridgeParent") , mMessageLoop(aLoop) , mTransport(aTransport) , mSetChildThreadPriority(false) , mClosed(false) - , mSubprocess(nullptr) { MOZ_ASSERT(NS_IsMainThread()); sMainLoop = MessageLoop::current(); // top-level actors must be destroyed on the main thread. SetMessageLoopToPostDestructionTo(sMainLoop); // creates the map only if it has not been created already, so it is safe @@ -95,21 +93,16 @@ ImageBridgeParent::~ImageBridgeParent() } void ImageBridgeParent::ActorDestroy(ActorDestroyReason aWhy) { // Can't alloc/dealloc shmems from now on. mClosed = true; - if (mSubprocess) { - mSubprocess->DissociateActor(); - mSubprocess = nullptr; - } - MessageLoop::current()->PostTask(NewRunnableMethod(this, &ImageBridgeParent::DeferredDestroy)); // It is very important that this method gets called at shutdown (be it a clean // or an abnormal shutdown), because DeferredDestroy is what clears mSelfRef. // If mSelfRef is not null and ActorDestroy is not called, the ImageBridgeParent // is leaked which causes the CompositorThreadHolder to be leaked and // CompsoitorParent's shutdown ends up spinning the event loop forever, waiting // for the compositor thread to terminate. @@ -198,26 +191,21 @@ static void ConnectImageBridgeInParentProcess(ImageBridgeParent* aBridge, Transport* aTransport, base::ProcessId aOtherPid) { aBridge->Open(aTransport, aOtherPid, XRE_GetIOMessageLoop(), ipc::ParentSide); } /*static*/ PImageBridgeParent* -ImageBridgeParent::Create(Transport* aTransport, ProcessId aChildProcessId, GeckoChildProcessHost* aProcessHost) +ImageBridgeParent::Create(Transport* aTransport, ProcessId aChildProcessId) { MessageLoop* loop = CompositorThreadHolder::Loop(); RefPtr<ImageBridgeParent> bridge = new ImageBridgeParent(loop, aTransport, aChildProcessId); - if (aProcessHost) { - bridge->mSubprocess = aProcessHost; - aProcessHost->AssociateActor(); - } - loop->PostTask(NewRunnableFunction(ConnectImageBridgeInParentProcess, bridge.get(), aTransport, aChildProcessId)); return bridge.get(); } bool ImageBridgeParent::RecvWillClose() { // If there is any texture still alive we have to force it to deallocate the @@ -364,17 +352,17 @@ IToplevelProtocol* ImageBridgeParent::CloneToplevel(const InfallibleTArray<ProtocolFdMapping>& aFds, base::ProcessHandle aPeerProcess, mozilla::ipc::ProtocolCloneContext* aCtx) { for (unsigned int i = 0; i < aFds.Length(); i++) { if (aFds[i].protocolId() == unsigned(GetProtocolId())) { Transport* transport = OpenDescriptor(aFds[i].fd(), Transport::MODE_SERVER); - PImageBridgeParent* bridge = Create(transport, base::GetProcId(aPeerProcess), mSubprocess); + PImageBridgeParent* bridge = Create(transport, base::GetProcId(aPeerProcess)); bridge->CloneManagees(this, aCtx); bridge->IToplevelProtocol::SetTransport(transport); // The reference to the compositor thread is held in OnChannelConnected(). // We need to do this for cloned actors, too. bridge->OnChannelConnected(base::GetProcId(aPeerProcess)); return bridge; } }
--- a/gfx/layers/ipc/ImageBridgeParent.h +++ b/gfx/layers/ipc/ImageBridgeParent.h @@ -23,17 +23,16 @@ class MessageLoop; namespace base { class Thread; } // namespace base namespace mozilla { namespace ipc { class Shmem; -class GeckoChildProcessHost; } // namespace ipc namespace layers { /** * ImageBridgeParent is the manager Protocol of ImageContainerParent. * It's purpose is mainly to setup the IPDL connection. Most of the * interesting stuff is in ImageContainerParent. @@ -50,17 +49,17 @@ public: ImageBridgeParent(MessageLoop* aLoop, Transport* aTransport, ProcessId aChildProcessId); ~ImageBridgeParent(); virtual ShmemAllocator* AsShmemAllocator() override { return this; } virtual void ActorDestroy(ActorDestroyReason aWhy) override; static PImageBridgeParent* - Create(Transport* aTransport, ProcessId aChildProcessId, ipc::GeckoChildProcessHost* aProcessHost); + Create(Transport* aTransport, ProcessId aChildProcessId); // CompositableParentManager virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override; virtual void NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId) override; virtual base::ProcessId GetChildProcessId() override { @@ -150,18 +149,16 @@ private: Transport* mTransport; // This keeps us alive until ActorDestroy(), at which point we do a // deferred destruction of ourselves. RefPtr<ImageBridgeParent> mSelfRef; bool mSetChildThreadPriority; bool mClosed; - ipc::GeckoChildProcessHost* mSubprocess; - /** * Map of all living ImageBridgeParent instances */ static std::map<base::ProcessId, ImageBridgeParent*> sImageBridges; static MessageLoop* sMainLoop; RefPtr<CompositorThreadHolder> mCompositorThreadHolder;
--- a/gfx/ycbcr/yuv_convert_arm.cpp +++ b/gfx/ycbcr/yuv_convert_arm.cpp @@ -11,17 +11,21 @@ #ifdef HAVE_YCBCR_TO_RGB565 namespace mozilla { namespace gfx { # if defined(MOZILLA_MAY_SUPPORT_NEON) +# if defined(__clang__) +void __attribute((noinline)) +# else void __attribute((noinline,optimize("-fomit-frame-pointer"))) +# endif yuv42x_to_rgb565_row_neon(uint16 *dst, const uint8 *y, const uint8 *u, const uint8 *v, int n, int oddflag) { static __attribute__((aligned(16))) uint16 acc_r[8] = {
--- a/ipc/chromium/moz.build +++ b/ipc/chromium/moz.build @@ -22,22 +22,20 @@ UNIFIED_SOURCES += [ 'src/base/revocable_store.cc', 'src/base/string_piece.cc', 'src/base/string_util.cc', 'src/base/thread.cc', 'src/base/time.cc', 'src/base/timer.cc', 'src/chrome/common/child_process.cc', 'src/chrome/common/child_process_host.cc', - 'src/chrome/common/child_process_info.cc', 'src/chrome/common/child_thread.cc', 'src/chrome/common/chrome_switches.cc', 'src/chrome/common/ipc_channel.cc', 'src/chrome/common/ipc_message.cc', - 'src/chrome/common/notification_service.cc', ] if os_win: SOURCES += [ 'src/base/condition_variable_win.cc', 'src/base/cpu.cc', 'src/base/file_util_win.cc', 'src/base/lock_impl_win.cc', @@ -49,17 +47,16 @@ if os_win: 'src/base/process_win.cc', 'src/base/rand_util_win.cc', 'src/base/shared_memory_win.cc', 'src/base/sys_info_win.cc', 'src/base/sys_string_conversions_win.cc', 'src/base/thread_local_storage_win.cc', 'src/base/thread_local_win.cc', 'src/base/time_win.cc', - 'src/base/waitable_event_watcher_win.cc', 'src/base/waitable_event_win.cc', 'src/base/win_util.cc', 'src/chrome/common/ipc_channel_win.cc', 'src/chrome/common/process_watcher_win.cc', 'src/chrome/common/transport_dib_win.cc', ] elif not CONFIG['MOZ_SYSTEM_LIBEVENT']: DIRS += ['src/third_party'] @@ -77,17 +74,16 @@ if os_posix: 'src/base/process_util_posix.cc', 'src/base/rand_util_posix.cc', 'src/base/shared_memory_posix.cc', 'src/base/string16.cc', 'src/base/sys_info_posix.cc', 'src/base/thread_local_posix.cc', 'src/base/thread_local_storage_posix.cc', 'src/base/waitable_event_posix.cc', - 'src/base/waitable_event_watcher_posix.cc', 'src/chrome/common/file_descriptor_set_posix.cc', 'src/chrome/common/ipc_channel_posix.cc', 'src/chrome/common/process_watcher_posix_sigchld.cc', ] if os_macosx: UNIFIED_SOURCES += [ 'src/base/chrome_application_mac.mm',
--- a/ipc/chromium/src/base/waitable_event.h +++ b/ipc/chromium/src/base/waitable_event.h @@ -49,26 +49,16 @@ class TimeDelta; class WaitableEvent { public: // If manual_reset is true, then to set the event state to non-signaled, a // consumer must call the Reset method. If this parameter is false, then the // system automatically resets the event state to non-signaled after a single // waiting thread has been released. WaitableEvent(bool manual_reset, bool initially_signaled); -#if defined(OS_WIN) - // Create a WaitableEvent from an Event HANDLE which has already been - // created. This objects takes ownership of the HANDLE and will close it when - // deleted. - explicit WaitableEvent(HANDLE event_handle); - - // Releases ownership of the handle from this object. - HANDLE Release(); -#endif - ~WaitableEvent(); // Put the event in the un-signaled state. void Reset(); // Put the event in the signaled state. Causing any thread blocked on Wait // to be woken up. void Signal();
deleted file mode 100644 --- a/ipc/chromium/src/base/waitable_event_watcher.h +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_WAITABLE_EVENT_WATCHER_H_ -#define BASE_WAITABLE_EVENT_WATCHER_H_ - -#include "build/build_config.h" - -#if defined(OS_WIN) -#include "base/object_watcher.h" -#else -#include "base/message_loop.h" -#include "base/waitable_event.h" -#include "nsAutoPtr.h" -#endif - -namespace base { - -class Flag; -class AsyncWaiter; -class AsyncCallbackTask; -class WaitableEvent; - -// ----------------------------------------------------------------------------- -// This class provides a way to wait on a WaitableEvent asynchronously. -// -// Each instance of this object can be waiting on a single WaitableEvent. When -// the waitable event is signaled, a callback is made in the thread of a given -// MessageLoop. This callback can be deleted by deleting the waiter. -// -// Typical usage: -// -// class MyClass : public base::WaitableEventWatcher::Delegate { -// public: -// void DoStuffWhenSignaled(WaitableEvent *waitable_event) { -// watcher_.StartWatching(waitable_event, this); -// } -// virtual void OnWaitableEventSignaled(WaitableEvent* waitable_event) { -// // OK, time to do stuff! -// } -// private: -// base::WaitableEventWatcher watcher_; -// }; -// -// In the above example, MyClass wants to "do stuff" when waitable_event -// becomes signaled. WaitableEventWatcher makes this task easy. When MyClass -// goes out of scope, the watcher_ will be destroyed, and there is no need to -// worry about OnWaitableEventSignaled being called on a deleted MyClass -// pointer. -// -// BEWARE: With automatically reset WaitableEvents, a signal may be lost if it -// occurs just before a WaitableEventWatcher is deleted. There is currently no -// safe way to stop watching an automatic reset WaitableEvent without possibly -// missing a signal. -// -// NOTE: you /are/ allowed to delete the WaitableEvent while still waiting on -// it with a Watcher. It will act as if the event was never signaled. -// ----------------------------------------------------------------------------- - -class WaitableEventWatcher -#if defined(OS_POSIX) - : public MessageLoop::DestructionObserver -#endif -{ - public: - - WaitableEventWatcher(); - ~WaitableEventWatcher(); - - class Delegate { - public: - virtual ~Delegate() { } - - // ------------------------------------------------------------------------- - // This is called on the MessageLoop thread when WaitableEvent has been - // signaled. - // - // Note: the event may not be signaled by the time that this function is - // called. This indicates only that it has been signaled at some point in - // the past. - // ------------------------------------------------------------------------- - virtual void OnWaitableEventSignaled(WaitableEvent* waitable_event) = 0; - }; - - // --------------------------------------------------------------------------- - // When @event is signaled, the given delegate is called on the thread of the - // current message loop when StartWatching is called. The delegate is not - // deleted. - // --------------------------------------------------------------------------- - bool StartWatching(WaitableEvent* event, Delegate* delegate); - - // --------------------------------------------------------------------------- - // Cancel the current watch. Must be called from the same thread which - // started the watch. - // - // Does nothing if no event is being watched, nor if the watch has completed. - // The delegate will *not* be called for the current watch after this - // function returns. Since the delegate runs on the same thread as this - // function, it cannot be called during this function either. - // --------------------------------------------------------------------------- - void StopWatching(); - - // --------------------------------------------------------------------------- - // Return the currently watched event, or NULL if no object is currently being - // watched. - // --------------------------------------------------------------------------- - WaitableEvent* GetWatchedEvent(); - - private: - WaitableEvent* event_; - -#if defined(OS_WIN) - // --------------------------------------------------------------------------- - // The helper class exists because, if WaitableEventWatcher were to inherit - // from ObjectWatcher::Delegate, then it couldn't also have an inner class - // called Delegate (at least on Windows). Thus this object exists to proxy - // the callback function - // --------------------------------------------------------------------------- - class ObjectWatcherHelper : public ObjectWatcher::Delegate { - public: - ObjectWatcherHelper(WaitableEventWatcher* watcher); - - // ------------------------------------------------------------------------- - // Implementation of ObjectWatcher::Delegate - // ------------------------------------------------------------------------- - void OnObjectSignaled(HANDLE h); - - private: - WaitableEventWatcher *const watcher_; - }; - - void OnObjectSignaled(); - - Delegate* delegate_; - ObjectWatcherHelper helper_; - ObjectWatcher watcher_; -#else - // --------------------------------------------------------------------------- - // Implementation of MessageLoop::DestructionObserver - // --------------------------------------------------------------------------- - void WillDestroyCurrentMessageLoop(); - - MessageLoop* message_loop_; - RefPtr<Flag> cancel_flag_; - AsyncWaiter* waiter_; - RefPtr<AsyncCallbackTask> callback_task_; - RefPtr<WaitableEvent::WaitableEventKernel> kernel_; -#endif -}; - -} // namespace base - -#endif // BASE_WAITABLE_EVENT_WATCHER_H_
deleted file mode 100644 --- a/ipc/chromium/src/base/waitable_event_watcher_posix.cc +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/waitable_event_watcher.h" - -#include "base/condition_variable.h" -#include "base/lock.h" -#include "base/message_loop.h" -#include "base/waitable_event.h" - -#include "nsISupportsImpl.h" -#include "nsAutoPtr.h" -#include "mozilla/Attributes.h" - -namespace base { - -// ----------------------------------------------------------------------------- -// WaitableEventWatcher (async waits). -// -// The basic design is that we add an AsyncWaiter to the wait-list of the event. -// That AsyncWaiter has a pointer to MessageLoop, and a Task to be posted to it. -// The MessageLoop ends up running the task, which calls the delegate. -// -// Since the wait can be canceled, we have a thread-safe Flag object which is -// set when the wait has been canceled. At each stage in the above, we check the -// flag before going onto the next stage. Since the wait may only be canceled in -// the MessageLoop which runs the Task, we are assured that the delegate cannot -// be called after canceling... - -// ----------------------------------------------------------------------------- -// A thread-safe, reference-counted, write-once flag. -// ----------------------------------------------------------------------------- -class Flag final { - public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Flag) - Flag() { flag_ = false; } - - void Set() { - AutoLock locked(lock_); - flag_ = true; - } - - bool value() const { - AutoLock locked(lock_); - return flag_; - } - - protected: - ~Flag() {} - private: - mutable Lock lock_; - bool flag_; -}; - -// ----------------------------------------------------------------------------- -// This is an asynchronous waiter which posts a task to a MessageLoop when -// fired. An AsyncWaiter may only be in a single wait-list. -// ----------------------------------------------------------------------------- -class AsyncWaiter final : public WaitableEvent::Waiter { - public: - AsyncWaiter(MessageLoop* message_loop, - already_AddRefed<mozilla::Runnable> task, Flag* flag) - : message_loop_(message_loop), - cb_task_(task), - flag_(flag) { } - - bool Fire(WaitableEvent* event) { - if (flag_->value()) { - // If the callback has been canceled, we don't enqueue the task, we just - // delete it instead. - cb_task_ = nullptr; - } else { - message_loop_->PostTask(cb_task_.forget()); - } - - // We are removed from the wait-list by the WaitableEvent itself. It only - // remains to delete ourselves. - delete this; - - // We can always return true because an AsyncWaiter is never in two - // different wait-lists at the same time. - return true; - } - - // See StopWatching for discussion - bool Compare(void* tag) { - return tag == flag_.get(); - } - - private: - MessageLoop *const message_loop_; - RefPtr<mozilla::Runnable> cb_task_; - RefPtr<Flag> flag_; -}; - -// ----------------------------------------------------------------------------- -// For async waits we need to make a callback in a MessageLoop thread. We do -// this by posting this task, which calls the delegate and keeps track of when -// the event is canceled. -// ----------------------------------------------------------------------------- -class AsyncCallbackTask : public mozilla::Runnable { - public: - AsyncCallbackTask(Flag* flag, WaitableEventWatcher::Delegate* delegate, - WaitableEvent* event) - : flag_(flag), - delegate_(delegate), - event_(event) { - } - - NS_IMETHOD Run() override { - // Runs in MessageLoop thread. - if (!flag_->value()) { - // This is to let the WaitableEventWatcher know that the event has occured - // because it needs to be able to return NULL from GetWatchedObject - flag_->Set(); - delegate_->OnWaitableEventSignaled(event_); - } - - return NS_OK; - // We are deleted by the MessageLoop - } - - private: - RefPtr<Flag> flag_; - WaitableEventWatcher::Delegate *const delegate_; - WaitableEvent *const event_; -}; - -WaitableEventWatcher::WaitableEventWatcher() - : event_(NULL), - message_loop_(NULL), - cancel_flag_(NULL) { -} - -WaitableEventWatcher::~WaitableEventWatcher() { - StopWatching(); -} - -// ----------------------------------------------------------------------------- -// The Handle is how the user cancels a wait. After deleting the Handle we -// insure that the delegate cannot be called. -// ----------------------------------------------------------------------------- -bool WaitableEventWatcher::StartWatching - (WaitableEvent* event, WaitableEventWatcher::Delegate* delegate) { - MessageLoop *const current_ml = MessageLoop::current(); - DCHECK(current_ml) << "Cannot create WaitableEventWatcher without a " - "current MessageLoop"; - - // A user may call StartWatching from within the callback function. In this - // case, we won't know that we have finished watching, expect that the Flag - // will have been set in AsyncCallbackTask::Run() - if (cancel_flag_.get() && cancel_flag_->value()) { - if (message_loop_) { - message_loop_->RemoveDestructionObserver(this); - message_loop_ = NULL; - } - - cancel_flag_ = NULL; - } - - DCHECK(!cancel_flag_.get()) << "StartWatching called while still watching"; - - cancel_flag_ = new Flag; - callback_task_ = new AsyncCallbackTask(cancel_flag_, delegate, event); - WaitableEvent::WaitableEventKernel* kernel = event->kernel_.get(); - - AutoLock locked(kernel->lock_); - - if (kernel->signaled_) { - if (!kernel->manual_reset_) - kernel->signaled_ = false; - - // No hairpinning - we can't call the delegate directly here. We have to - // enqueue a task on the MessageLoop as normal. - RefPtr<AsyncCallbackTask> addrefedTask = callback_task_; - current_ml->PostTask(addrefedTask.forget()); - return true; - } - - message_loop_ = current_ml; - current_ml->AddDestructionObserver(this); - - event_ = event; - kernel_ = kernel; - RefPtr<AsyncCallbackTask> addrefedTask = callback_task_; - waiter_ = new AsyncWaiter(current_ml, addrefedTask.forget(), cancel_flag_); - event->Enqueue(waiter_); - - return true; -} - -void WaitableEventWatcher::StopWatching() { - if (message_loop_) { - message_loop_->RemoveDestructionObserver(this); - message_loop_ = NULL; - } - - if (!cancel_flag_.get()) // if not currently watching... - return; - - if (cancel_flag_->value()) { - // In this case, the event has fired, but we haven't figured that out yet. - // The WaitableEvent may have been deleted too. - cancel_flag_ = NULL; - return; - } - - if (!kernel_.get()) { - // We have no kernel. This means that we never enqueued a Waiter on an - // event because the event was already signaled when StartWatching was - // called. - // - // In this case, a task was enqueued on the MessageLoop and will run. - // We set the flag in case the task hasn't yet run. The flag will stop the - // delegate getting called. If the task has run then we have the last - // reference to the flag and it will be deleted immedately after. - cancel_flag_->Set(); - cancel_flag_ = NULL; - return; - } - - AutoLock locked(kernel_->lock_); - // We have a lock on the kernel. No one else can signal the event while we - // have it. - - // We have a possible ABA issue here. If Dequeue was to compare only the - // pointer values then it's possible that the AsyncWaiter could have been - // fired, freed and the memory reused for a different Waiter which was - // enqueued in the same wait-list. We would think that that waiter was our - // AsyncWaiter and remove it. - // - // To stop this, Dequeue also takes a tag argument which is passed to the - // virtual Compare function before the two are considered a match. So we need - // a tag which is good for the lifetime of this handle: the Flag. Since we - // have a reference to the Flag, its memory cannot be reused while this object - // still exists. So if we find a waiter with the correct pointer value, and - // which shares a Flag pointer, we have a real match. - if (kernel_->Dequeue(waiter_, cancel_flag_.get())) { - // Case 2: the waiter hasn't been signaled yet; it was still on the wait - // list. We've removed it, thus we can delete it and the task (which cannot - // have been enqueued with the MessageLoop because the waiter was never - // signaled) - delete waiter_; - callback_task_ = nullptr; - cancel_flag_ = NULL; - return; - } - - // Case 3: the waiter isn't on the wait-list, thus it was signaled. It may - // not have run yet, so we set the flag to tell it not to bother enqueuing the - // task on the MessageLoop, but to delete it instead. The Waiter deletes - // itself once run. - cancel_flag_->Set(); - cancel_flag_ = NULL; - - // If the waiter has already run then the task has been enqueued. If the Task - // hasn't yet run, the flag will stop the delegate from getting called. (This - // is thread safe because one may only delete a Handle from the MessageLoop - // thread.) - // - // If the delegate has already been called then we have nothing to do. The - // task has been deleted by the MessageLoop. -} - -WaitableEvent* WaitableEventWatcher::GetWatchedEvent() { - if (!cancel_flag_.get()) - return NULL; - - if (cancel_flag_->value()) - return NULL; - - return event_; -} - -// ----------------------------------------------------------------------------- -// This is called when the MessageLoop which the callback will be run it is -// deleted. We need to cancel the callback as if we had been deleted, but we -// will still be deleted at some point in the future. -// ----------------------------------------------------------------------------- -void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { - StopWatching(); -} - -} // namespace base
deleted file mode 100644 --- a/ipc/chromium/src/base/waitable_event_watcher_win.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/waitable_event_watcher.h" - -#include "base/compiler_specific.h" -#include "base/object_watcher.h" -#include "base/waitable_event.h" - -namespace base { - -WaitableEventWatcher::ObjectWatcherHelper::ObjectWatcherHelper( - WaitableEventWatcher* watcher) - : watcher_(watcher) { -}; - -void WaitableEventWatcher::ObjectWatcherHelper::OnObjectSignaled(HANDLE h) { - watcher_->OnObjectSignaled(); -} - - -WaitableEventWatcher::WaitableEventWatcher() - : event_(NULL), - ALLOW_THIS_IN_INITIALIZER_LIST(helper_(this)), - delegate_(NULL) { -} - -WaitableEventWatcher::~WaitableEventWatcher() { -} - -bool WaitableEventWatcher::StartWatching(WaitableEvent* event, - Delegate* delegate) { - delegate_ = delegate; - event_ = event; - - return watcher_.StartWatching(event->handle(), &helper_); -} - -void WaitableEventWatcher::StopWatching() { - delegate_ = NULL; - event_ = NULL; - watcher_.StopWatching(); -} - -WaitableEvent* WaitableEventWatcher::GetWatchedEvent() { - return event_; -} - -void WaitableEventWatcher::OnObjectSignaled() { - WaitableEvent* event = event_; - Delegate* delegate = delegate_; - event_ = NULL; - delegate_ = NULL; - DCHECK(event); - - delegate->OnWaitableEventSignaled(event); -} - -} // namespace base
--- a/ipc/chromium/src/base/waitable_event_win.cc +++ b/ipc/chromium/src/base/waitable_event_win.cc @@ -16,31 +16,20 @@ namespace base { WaitableEvent::WaitableEvent(bool manual_reset, bool signaled) : handle_(CreateEvent(NULL, manual_reset, signaled, NULL)) { // We're probably going to crash anyways if this is ever NULL, so we might as // well make our stack reports more informative by crashing here. CHECK(handle_); } -WaitableEvent::WaitableEvent(HANDLE handle) - : handle_(handle) { - CHECK(handle) << "Tried to create WaitableEvent from NULL handle"; -} - WaitableEvent::~WaitableEvent() { CloseHandle(handle_); } -HANDLE WaitableEvent::Release() { - HANDLE rv = handle_; - handle_ = INVALID_HANDLE_VALUE; - return rv; -} - void WaitableEvent::Reset() { ResetEvent(handle_); } void WaitableEvent::Signal() { SetEvent(handle_); }
--- a/ipc/chromium/src/chrome/common/child_process.cc +++ b/ipc/chromium/src/chrome/common/child_process.cc @@ -8,54 +8,23 @@ #include "base/basictypes.h" #include "base/string_util.h" #include "chrome/common/child_thread.h" ChildProcess* ChildProcess::child_process_; ChildProcess::ChildProcess(ChildThread* child_thread) - : child_thread_(child_thread), - ref_count_(0), - shutdown_event_(true, false) { + : child_thread_(child_thread) { DCHECK(!child_process_); child_process_ = this; if (child_thread_.get()) // null in unittests. child_thread_->Run(); } ChildProcess::~ChildProcess() { DCHECK(child_process_ == this); - // Signal this event before destroying the child process. That way all - // background threads can cleanup. - // For example, in the renderer the RenderThread instances will be able to - // notice shutdown before the render process begins waiting for them to exit. - shutdown_event_.Signal(); - if (child_thread_.get()) child_thread_->Stop(); child_process_ = NULL; } - -void ChildProcess::AddRefProcess() { - DCHECK(!child_thread_.get() || // null in unittests. - MessageLoop::current() == child_thread_->message_loop()); - ref_count_++; -} - -void ChildProcess::ReleaseProcess() { - DCHECK(!child_thread_.get() || // null in unittests. - MessageLoop::current() == child_thread_->message_loop()); - DCHECK(ref_count_); - DCHECK(child_process_); - if (--ref_count_) - return; - - if (child_thread_.get()) // null in unittests. - child_thread_->OnProcessFinalRelease(); -} - -base::WaitableEvent* ChildProcess::GetShutDownEvent() { - DCHECK(child_process_); - return &child_process_->shutdown_event_; -}
--- a/ipc/chromium/src/chrome/common/child_process.h +++ b/ipc/chromium/src/chrome/common/child_process.h @@ -24,46 +24,23 @@ class ChildProcess { // Child processes should have an object that derives from this class. The // constructor will return once ChildThread has started. explicit ChildProcess(ChildThread* child_thread); virtual ~ChildProcess(); // Getter for this process' main thread. ChildThread* child_thread() { return child_thread_.get(); } - // A global event object that is signalled when the main thread's message - // loop exits. This gives background threads a way to observe the main - // thread shutting down. This can be useful when a background thread is - // waiting for some information from the browser process. If the browser - // process goes away prematurely, the background thread can at least notice - // the child processes's main thread exiting to determine that it should give - // up waiting. - // For example, see the renderer code used to implement - // webkit_glue::GetCookies. - base::WaitableEvent* GetShutDownEvent(); - - // These are used for ref-counting the child process. The process shuts - // itself down when the ref count reaches 0. - // For example, in the renderer process, generally each tab managed by this - // process will hold a reference to the process, and release when closed. - void AddRefProcess(); - void ReleaseProcess(); - // Getter for the one ChildProcess object for this process. static ChildProcess* current() { return child_process_; } private: // NOTE: make sure that child_thread_ is listed before shutdown_event_, since // it depends on it (indirectly through IPC::SyncChannel). mozilla::UniquePtr<ChildThread> child_thread_; - int ref_count_; - - // An event that will be signalled when we shutdown. - base::WaitableEvent shutdown_event_; - // The singleton instance for this process. static ChildProcess* child_process_; DISALLOW_EVIL_CONSTRUCTORS(ChildProcess); }; #endif // CHROME_COMMON_CHILD_PROCESS_H__
--- a/ipc/chromium/src/chrome/common/child_process_host.cc +++ b/ipc/chromium/src/chrome/common/child_process_host.cc @@ -11,74 +11,27 @@ #include "base/message_loop.h" #include "base/process_util.h" #include "base/singleton.h" #include "base/waitable_event.h" #include "mozilla/ipc/ProcessChild.h" #include "mozilla/ipc/BrowserProcessSubThread.h" #include "mozilla/ipc/Transport.h" typedef mozilla::ipc::BrowserProcessSubThread ChromeThread; -#include "chrome/common/notification_service.h" -#include "chrome/common/notification_type.h" #include "chrome/common/process_watcher.h" -#include "chrome/common/result_codes.h" using mozilla::ipc::FileDescriptor; -namespace { -typedef std::list<ChildProcessHost*> ChildProcessList; - -// The NotificationTask is used to notify about plugin process connection/ -// disconnection. It is needed because the notifications in the -// NotificationService must happen in the main thread. -class ChildNotificationTask : public mozilla::Runnable { - public: - ChildNotificationTask( - NotificationType notification_type, ChildProcessInfo* info) - : notification_type_(notification_type), info_(*info) { } - - NS_IMETHOD Run() { - NotificationService::current()-> - Notify(notification_type_, NotificationService::AllSources(), - Details<ChildProcessInfo>(&info_)); - return NS_OK; - } - - private: - NotificationType notification_type_; - ChildProcessInfo info_; -}; - -} // namespace - - - -ChildProcessHost::ChildProcessHost(ProcessType type) - : - ChildProcessInfo(type), - ALLOW_THIS_IN_INITIALIZER_LIST(listener_(this)), - opening_channel_(false), - process_event_(nullptr) { - Singleton<ChildProcessList>::get()->push_back(this); +ChildProcessHost::ChildProcessHost() + : ALLOW_THIS_IN_INITIALIZER_LIST(listener_(this)), + opening_channel_(false) { } ChildProcessHost::~ChildProcessHost() { - Singleton<ChildProcessList>::get()->remove(this); - - if (handle()) { - watcher_.StopWatching(); - ProcessWatcher::EnsureProcessTerminated(handle()); - -#if defined(OS_WIN) - // Above call took ownership, so don't want WaitableEvent to assert because - // the handle isn't valid anymore. - process_event_->Release(); -#endif - } } bool ChildProcessHost::CreateChannel() { channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::wstring()); channel_.reset(new IPC::Channel( channel_id_, IPC::Channel::MODE_SERVER, &listener_)); if (!channel_->Connect()) return false; @@ -99,121 +52,30 @@ bool ChildProcessHost::CreateChannel(Fil return false; } opening_channel_ = true; return true; } -void ChildProcessHost::SetHandle(base::ProcessHandle process) { -#if defined(OS_WIN) - process_event_.reset(new base::WaitableEvent(process)); - - DCHECK(!handle()); - set_handle(process); - watcher_.StartWatching(process_event_.get(), this); -#endif -} - -void ChildProcessHost::InstanceCreated() { - Notify(NotificationType(NotificationType::CHILD_INSTANCE_CREATED)); -} - -bool ChildProcessHost::Send(IPC::Message* msg) { - if (!channel_.get()) { - delete msg; - return false; - } - return channel_->Send(msg); -} - -void ChildProcessHost::Notify(NotificationType type) { - MessageLoop* loop = ChromeThread::GetMessageLoop(ChromeThread::IO); - if (!loop) - loop = mozilla::ipc::ProcessChild::message_loop(); - if (!loop) - loop = MessageLoop::current(); - RefPtr<ChildNotificationTask> task = new ChildNotificationTask(type, this); - loop->PostTask(task.forget()); -} - -void ChildProcessHost::OnWaitableEventSignaled(base::WaitableEvent *event) { -#if defined(OS_WIN) - HANDLE object = event->handle(); - DCHECK(handle()); - DCHECK_EQ(object, handle()); - - bool did_crash = base::DidProcessCrash(NULL, object); - if (did_crash) { - // Report that this child process crashed. - Notify(NotificationType(NotificationType::CHILD_PROCESS_CRASHED)); - } - // Notify in the main loop of the disconnection. - Notify(NotificationType(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED)); -#endif -} - ChildProcessHost::ListenerHook::ListenerHook(ChildProcessHost* host) : host_(host) { } void ChildProcessHost::ListenerHook::OnMessageReceived( IPC::Message&& msg) { - - bool msg_is_ok = true; - bool handled = false; - - if (!handled) { - host_->OnMessageReceived(mozilla::Move(msg)); - } - - if (!msg_is_ok) - base::KillProcess(host_->handle(), ResultCodes::KILLED_BAD_MESSAGE, false); - + host_->OnMessageReceived(mozilla::Move(msg)); } void ChildProcessHost::ListenerHook::OnChannelConnected(int32_t peer_pid) { host_->opening_channel_ = false; host_->OnChannelConnected(peer_pid); - - // Notify in the main loop of the connection. - host_->Notify(NotificationType(NotificationType::CHILD_PROCESS_HOST_CONNECTED)); } void ChildProcessHost::ListenerHook::OnChannelError() { host_->opening_channel_ = false; host_->OnChannelError(); } void ChildProcessHost::ListenerHook::GetQueuedMessages(std::queue<IPC::Message>& queue) { host_->GetQueuedMessages(queue); } - -ChildProcessHost::Iterator::Iterator() : all_(true) { - iterator_ = Singleton<ChildProcessList>::get()->begin(); -} - -ChildProcessHost::Iterator::Iterator(ProcessType type) - : all_(false), type_(type) { - iterator_ = Singleton<ChildProcessList>::get()->begin(); - if (!Done() && (*iterator_)->type() != type_) - ++(*this); -} - -ChildProcessHost* ChildProcessHost::Iterator::operator++() { - do { - ++iterator_; - if (Done()) - break; - - if (!all_ && (*iterator_)->type() != type_) - continue; - - return *iterator_; - } while (true); - - return NULL; -} - -bool ChildProcessHost::Iterator::Done() { - return iterator_ == Singleton<ChildProcessList>::get()->end(); -}
--- a/ipc/chromium/src/chrome/common/child_process_host.h +++ b/ipc/chromium/src/chrome/common/child_process_host.h @@ -7,102 +7,54 @@ #ifndef CHROME_COMMON_CHILD_PROCESS_HOST_H_ #define CHROME_COMMON_CHILD_PROCESS_HOST_H_ #include "build/build_config.h" #include <list> #include "base/basictypes.h" -#include "base/waitable_event_watcher.h" -#include "chrome/common/child_process_info.h" #include "chrome/common/ipc_channel.h" #include "mozilla/UniquePtr.h" namespace mozilla { namespace ipc { class FileDescriptor; } } -class NotificationType; - // Plugins/workers and other child processes that live on the IO thread should // derive from this class. -class ChildProcessHost : - public IPC::Message::Sender, - public ChildProcessInfo, - public base::WaitableEventWatcher::Delegate, - public IPC::Channel::Listener { +class ChildProcessHost : public IPC::Channel::Listener { public: virtual ~ChildProcessHost(); - // ResourceDispatcherHost::Receiver implementation: - virtual bool Send(IPC::Message* msg); - - // The Iterator class allows iteration through either all child processes, or - // ones of a specific type, depending on which constructor is used. Note that - // this should be done from the IO thread and that the iterator should not be - // kept around as it may be invalidated on subsequent event processing in the - // event loop. - class Iterator { - public: - Iterator(); - explicit Iterator(ProcessType type); - ChildProcessHost* operator->() { return *iterator_; } - ChildProcessHost* operator*() { return *iterator_; } - ChildProcessHost* operator++(); - bool Done(); - - private: - bool all_; - ProcessType type_; - std::list<ChildProcessHost*>::iterator iterator_; - }; - protected: - explicit ChildProcessHost(ProcessType type); + explicit ChildProcessHost(); // Derived classes return true if it's ok to shut down the child process. virtual bool CanShutdown() = 0; // Creates the IPC channel. Returns true iff it succeeded. bool CreateChannel(); bool CreateChannel(mozilla::ipc::FileDescriptor& aFileDescriptor); - // Once the subclass gets a handle to the process, it needs to tell - // ChildProcessHost using this function. - void SetHandle(base::ProcessHandle handle); - - // Notifies us that an instance has been created on this child process. - void InstanceCreated(); - // IPC::Channel::Listener implementation: virtual void OnMessageReceived(IPC::Message&& msg) { } virtual void OnChannelConnected(int32_t peer_pid) { } virtual void OnChannelError() { } bool opening_channel() { return opening_channel_; } const std::wstring& channel_id() { return channel_id_; } - base::WaitableEvent* GetProcessEvent() { return process_event_.get(); } - const IPC::Channel& channel() const { return *channel_; } IPC::Channel* channelp() const { return channel_.get(); } private: - // Sends the given notification to the notification service on the UI thread. - void Notify(NotificationType type); - - protected: - // WaitableEventWatcher::Delegate implementation: - virtual void OnWaitableEventSignaled(base::WaitableEvent *event); - - private: // By using an internal class as the IPC::Channel::Listener, we can intercept // OnMessageReceived/OnChannelConnected and do our own processing before // calling the subclass' implementation. class ListenerHook : public IPC::Channel::Listener { public: explicit ListenerHook(ChildProcessHost* host); virtual void OnMessageReceived(IPC::Message&& msg); virtual void OnChannelConnected(int32_t peer_pid); @@ -117,16 +69,11 @@ class ChildProcessHost : // True while we're waiting the channel to be opened. bool opening_channel_; // The IPC::Channel. mozilla::UniquePtr<IPC::Channel> channel_; // IPC Channel's id. std::wstring channel_id_; - - // Used to watch the child process handle. - base::WaitableEventWatcher watcher_; - - mozilla::UniquePtr<base::WaitableEvent> process_event_; }; #endif // CHROME_COMMON_CHILD_PROCESS_HOST_H_
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/child_process_info.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/child_process_info.h" - -#include <limits> - -#include "base/logging.h" - -std::wstring ChildProcessInfo::GetTypeNameInEnglish( - ChildProcessInfo::ProcessType type) { - switch (type) { - case BROWSER_PROCESS: - return L"Browser"; - case RENDER_PROCESS: - return L"Tab"; - case PLUGIN_PROCESS: - return L"Plug-in"; - case WORKER_PROCESS: - return L"Web Worker"; - case UNKNOWN_PROCESS: - default: - DCHECK(false) << "Unknown child process type!"; - return L"Unknown"; - } -} - -std::wstring ChildProcessInfo::GetLocalizedTitle() const { - return name_; -} - -ChildProcessInfo::ChildProcessInfo(ProcessType type) { - // This constructor is only used by objects which derive from this class, - // which means *this* is a real object that refers to a child process, and not - // just a simple object that contains information about it. So add it to our - // list of running processes. - type_ = type; - pid_ = -1; -} - - -ChildProcessInfo::~ChildProcessInfo() { -} \ No newline at end of file
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/child_process_info.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_CHILD_PROCESS_INFO_H_ -#define CHROME_COMMON_CHILD_PROCESS_INFO_H_ - -#include <string> - -#include "base/process.h" - -// Holds information about a child process. -class ChildProcessInfo { - public: - enum ProcessType { - BROWSER_PROCESS, - RENDER_PROCESS, - PLUGIN_PROCESS, - WORKER_PROCESS, - UNKNOWN_PROCESS - }; - - // Returns the type of the process. - ProcessType type() const { return type_; } - - // Returns the name of the process. i.e. for plugins it might be Flash, while - // for workers it might be the domain that it's from. - std::wstring name() const { return name_; } - - // Getter to the process handle. - base::ProcessHandle handle() const { return process_.handle(); } - - virtual int GetProcessId() const { - if (pid_ != -1) - return pid_; - - pid_ = process_.pid(); - return pid_; - } - void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); } - - // Returns an English name of the process type, should only be used for non - // user-visible strings, or debugging pages like about:memory. - static std::wstring GetTypeNameInEnglish(ProcessType type); - - // Returns a localized title for the child process. For example, a plugin - // process would be "Plug-in: Flash" when name is "Flash". - std::wstring GetLocalizedTitle() const; - - ChildProcessInfo(const ChildProcessInfo& original) { - type_ = original.type_; - name_ = original.name_; - process_ = original.process_; - pid_ = original.pid_; - } - - ChildProcessInfo& operator=(const ChildProcessInfo& original) { - if (&original != this) { - type_ = original.type_; - name_ = original.name_; - process_ = original.process_; - pid_ = original.pid_; - } - return *this; - } - - virtual ~ChildProcessInfo(); - - // We define the < operator so that the ChildProcessInfo can be used as a key - // in a std::map. - bool operator <(const ChildProcessInfo& rhs) const { - if (process_.handle() != rhs.process_.handle()) - return process_ .handle() < rhs.process_.handle(); - return false; - } - - bool operator ==(const ChildProcessInfo& rhs) const { - return process_.handle() == rhs.process_.handle(); - } - - protected: - void set_type(ProcessType aType) { type_ = aType; } - void set_name(const std::wstring& aName) { name_ = aName; } - void set_handle(base::ProcessHandle aHandle) { - process_.set_handle(aHandle); - pid_ = -1; - } - - // Derived objects need to use this constructor so we know what type we are. - explicit ChildProcessInfo(ProcessType type); - - private: - ProcessType type_; - std::wstring name_; - mutable int pid_; // Cache of the process id. - - // The handle to the process. - mutable base::Process process_; -}; - -#endif // CHROME_COMMON_CHILD_PROCESS_INFO_H_
--- a/ipc/chromium/src/chrome/common/child_thread.cc +++ b/ipc/chromium/src/chrome/common/child_thread.cc @@ -6,24 +6,20 @@ #include "chrome/common/child_thread.h" #include "base/string_util.h" #include "base/command_line.h" #include "chrome/common/child_process.h" #include "chrome/common/chrome_switches.h" -// V8 needs a 1MB stack size. -const size_t ChildThread::kV8StackSize = 1024 * 1024; - ChildThread::ChildThread(Thread::Options options) : Thread("Chrome_ChildThread"), owner_loop_(MessageLoop::current()), - options_(options), - check_with_browser_before_shutdown_(false) { + options_(options) { DCHECK(owner_loop_); channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( switches::kProcessChannelID); } ChildThread::~ChildThread() { } @@ -50,29 +46,17 @@ void ChildThread::OnChannelError() { void ChildThread::MarkThread() { NuwaMarkCurrentThread(nullptr, nullptr); if (!NuwaCheckpointCurrentThread()) { NS_RUNTIMEABORT("Should not be here!"); } } #endif -bool ChildThread::Send(IPC::Message* msg) { - if (!channel_.get()) { - delete msg; - return false; - } - - return channel_->Send(msg); -} - void ChildThread::OnMessageReceived(IPC::Message&& msg) { - if (msg.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(msg); - } } ChildThread* ChildThread::current() { return ChildProcess::current()->child_thread(); } void ChildThread::Init() { channel_ = mozilla::MakeUnique<IPC::Channel>(channel_name_, @@ -81,16 +65,8 @@ void ChildThread::Init() { } void ChildThread::CleanUp() { // Need to destruct the SyncChannel to the browser before we go away because // it caches a pointer to this thread. channel_ = nullptr; } - -void ChildThread::OnProcessFinalRelease() { - if (!check_with_browser_before_shutdown_) { - RefPtr<mozilla::Runnable> task = new MessageLoop::QuitTask(); - owner_loop_->PostTask(task.forget()); - return; - } -}
--- a/ipc/chromium/src/chrome/common/child_thread.h +++ b/ipc/chromium/src/chrome/common/child_thread.h @@ -10,50 +10,29 @@ #include "base/thread.h" #include "chrome/common/ipc_channel.h" #include "mozilla/UniquePtr.h" class ResourceDispatcher; // Child processes's background thread should derive from this class. class ChildThread : public IPC::Channel::Listener, - public IPC::Message::Sender, public base::Thread { public: // Creates the thread. explicit ChildThread(Thread::Options options); virtual ~ChildThread(); - // IPC::Message::Sender implementation: - virtual bool Send(IPC::Message* msg); - - // See documentation on MessageRouter for AddRoute and RemoveRoute - void AddRoute(int32_t routing_id, IPC::Channel::Listener* listener); - void RemoveRoute(int32_t routing_id); - - MessageLoop* owner_loop() { return owner_loop_; } - protected: friend class ChildProcess; // Starts the thread. bool Run(); - // Overrides the channel name. Used for --single-process mode. - void SetChannelName(const std::wstring& name) { channel_name_ = name; } - - // Called when the process refcount is 0. - void OnProcessFinalRelease(); - protected: - // The required stack size if V8 runs on a thread. - static const size_t kV8StackSize; - - virtual void OnControlMessageReceived(const IPC::Message& msg) { } - // Returns the one child thread. static ChildThread* current(); IPC::Channel* channel() { return channel_.get(); } // Thread implementation. virtual void Init(); virtual void CleanUp(); @@ -70,17 +49,12 @@ class ChildThread : public IPC::Channel: // The message loop used to run tasks on the thread that started this thread. MessageLoop* owner_loop_; std::wstring channel_name_; mozilla::UniquePtr<IPC::Channel> channel_; Thread::Options options_; - // If true, checks with the browser process before shutdown. This avoids race - // conditions if the process refcount is 0 but there's an IPC message inflight - // that would addref it. - bool check_with_browser_before_shutdown_; - DISALLOW_EVIL_CONSTRUCTORS(ChildThread); }; #endif // CHROME_COMMON_CHILD_THREAD_H_
--- a/ipc/chromium/src/chrome/common/ipc_channel.h +++ b/ipc/chromium/src/chrome/common/ipc_channel.h @@ -11,17 +11,17 @@ #include <queue> #include "chrome/common/ipc_message.h" namespace IPC { //------------------------------------------------------------------------------ -class Channel : public Message::Sender { +class Channel { // Security tests need access to the pipe handle. friend class ChannelTest; public: // Implemented by consumers of a Channel to receive messages. class Listener { public: virtual ~Listener() {} @@ -100,17 +100,17 @@ class Channel : public Message::Sender { // Send a message over the Channel to the listener on the other end. // // |message| must be allocated using operator new. This object will be // deleted once the contents of the Message have been sent. // // If you Send() a message on a Close()'d channel, we delete the message // immediately. - virtual bool Send(Message* message) override; + bool Send(Message* message); // Unsound_IsClosed() and Unsound_NumQueuedMessages() are safe to call from // any thread, but the value returned may be out of date, because we don't // use any synchronization when reading or writing it. bool Unsound_IsClosed() const; uint32_t Unsound_NumQueuedMessages() const; #if defined(OS_POSIX)
--- a/ipc/chromium/src/chrome/common/ipc_message.h +++ b/ipc/chromium/src/chrome/common/ipc_message.h @@ -33,28 +33,16 @@ namespace IPC { class Channel; class Message; struct LogData; class Message : public Pickle { public: typedef uint32_t msgid_t; - // Implemented by objects that can send IPC messages across a channel. - class Sender { - public: - virtual ~Sender() {} - - // Sends the given IPC message. The implementor takes ownership of the - // given Message regardless of whether or not this method succeeds. This - // is done to make this method easier to use. Returns true on success and - // false otherwise. - virtual bool Send(Message* msg) = 0; - }; - enum PriorityValue { PRIORITY_NORMAL = 1, PRIORITY_HIGH = 2, PRIORITY_URGENT = 3 }; enum MessageCompression { COMPRESSION_NONE,
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/notification_details.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file defines the type used to provide details for NotificationService -// notifications. - -#ifndef CHROME_COMMON_NOTIFICATION_DETAILS_H__ -#define CHROME_COMMON_NOTIFICATION_DETAILS_H__ - -#include "base/basictypes.h" - -// Do not declare a NotificationDetails directly--use either -// "Details<detailsclassname>(detailsclasspointer)" or -// NotificationService::NoDetails(). -class NotificationDetails { - public: - NotificationDetails() : ptr_(NULL) {} - NotificationDetails(const NotificationDetails& other) : ptr_(other.ptr_) {} - ~NotificationDetails() {} - - // NotificationDetails can be used as the index for a map; this method - // returns the pointer to the current details as an identifier, for use as a - // map index. - uintptr_t map_key() const { return reinterpret_cast<uintptr_t>(ptr_); } - - bool operator!=(const NotificationDetails& other) const { - return ptr_ != other.ptr_; - } - - bool operator==(const NotificationDetails& other) const { - return ptr_ == other.ptr_; - } - - protected: - explicit NotificationDetails(void* ptr) : ptr_(ptr) {} - - void* ptr_; -}; - -template <class T> -class Details : public NotificationDetails { - public: - explicit Details(T* ptr) : NotificationDetails(ptr) {} - explicit Details(const NotificationDetails& other) - : NotificationDetails(other) {} - - T* operator->() const { return ptr(); } - T* ptr() const { return static_cast<T*>(ptr_); } -}; - -#endif // CHROME_COMMON_NOTIFICATION_DETAILS_H__
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/notification_observer.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_NOTIFICATION_OBSERVER_H_ -#define CHROME_COMMON_NOTIFICATION_OBSERVER_H_ - -class NotificationDetails; -class NotificationSource; -class NotificationType; - -// This is the base class for notification observers. When a matching -// notification is posted to the notification service, Observe is called. -class NotificationObserver { - public: - virtual ~NotificationObserver(); - - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) = 0; -}; - -#endif // CHROME_COMMON_NOTIFICATION_OBSERVER_H_
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/notification_registrar.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ -#define CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ - -#include <vector> - -#include "base/basictypes.h" -#include "chrome/common/notification_observer.h" - -// Aids in registering for notifications and ensures that all registered -// notifications are unregistered when the class is destroyed. -// -// The intended use is that you make a NotificationRegistrar member in your -// class and use it to register your notifications instead of going through the -// notification service directly. It will automatically unregister them for -// you. -class NotificationRegistrar { - public: - // This class must not be derived from (we don't have a virtual destructor so - // it won't work). Instead, use it as a member in your class. - NotificationRegistrar(); - ~NotificationRegistrar(); - - // Wrappers around NotificationService::[Add|Remove]Observer. - void Add(NotificationObserver* observer, - NotificationType type, - const NotificationSource& source); - void Remove(NotificationObserver* observer, - NotificationType type, - const NotificationSource& source); - - // Unregisters all notifications. - void RemoveAll(); - - private: - struct Record; - - // We keep registered notifications in a simple vector. This means we'll do - // brute-force searches when removing them individually, but individual - // removal is uncommon, and there will typically only be a couple of - // notifications anyway. - typedef std::vector<Record> RecordVector; - - // Lists all notifications we're currently registered for. - RecordVector registered_; - - DISALLOW_COPY_AND_ASSIGN(NotificationRegistrar); -}; - -#endif // CHROME_COMMON_NOTIFICATION_REGISTRAR_H_
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/notification_service.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/notification_service.h" -#include "base/thread_local.h" - -static base::ThreadLocalPointer<NotificationService>& get_tls_ptr() { - static base::ThreadLocalPointer<NotificationService> tls_ptr; - return tls_ptr; -} - -// static -NotificationService* NotificationService::current() { - return get_tls_ptr().Get(); -} - -// static -bool NotificationService::HasKey(const NotificationSourceMap& map, - const NotificationSource& source) { - return map.find(source.map_key()) != map.end(); -} - -NotificationService::NotificationService() { - DCHECK(current() == NULL); -#ifndef NDEBUG - memset(observer_counts_, 0, sizeof(observer_counts_)); -#endif - - get_tls_ptr().Set(this); -} - -void NotificationService::AddObserver(NotificationObserver* observer, - NotificationType type, - const NotificationSource& source) { - DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT); - - // We have gotten some crashes where the observer pointer is NULL. The problem - // is that this happens when we actually execute a notification, so have no - // way of knowing who the bad observer was. We want to know when this happens - // in release mode so we know what code to blame the crash on (since this is - // guaranteed to crash later). - CHECK(observer); - - NotificationObserverList* observer_list; - if (HasKey(observers_[type.value], source)) { - observer_list = observers_[type.value][source.map_key()]; - } else { - observer_list = new NotificationObserverList; - observers_[type.value][source.map_key()] = observer_list; - } - - observer_list->AddObserver(observer); -#ifndef NDEBUG - ++observer_counts_[type.value]; -#endif -} - -void NotificationService::RemoveObserver(NotificationObserver* observer, - NotificationType type, - const NotificationSource& source) { - DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT); - DCHECK(HasKey(observers_[type.value], source)); - - NotificationObserverList* observer_list = - observers_[type.value][source.map_key()]; - if (observer_list) { - observer_list->RemoveObserver(observer); -#ifndef NDEBUG - --observer_counts_[type.value]; -#endif - } - - // TODO(jhughes): Remove observer list from map if empty? -} - -void NotificationService::Notify(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK(type.value > NotificationType::ALL) << - "Allowed for observing, but not posting."; - DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT); - - // There's no particular reason for the order in which the different - // classes of observers get notified here. - - // Notify observers of all types and all sources - if (HasKey(observers_[NotificationType::ALL], AllSources()) && - source != AllSources()) { - FOR_EACH_OBSERVER(NotificationObserver, - *observers_[NotificationType::ALL][AllSources().map_key()], - Observe(type, source, details)); - } - - // Notify observers of all types and the given source - if (HasKey(observers_[NotificationType::ALL], source)) { - FOR_EACH_OBSERVER(NotificationObserver, - *observers_[NotificationType::ALL][source.map_key()], - Observe(type, source, details)); - } - - // Notify observers of the given type and all sources - if (HasKey(observers_[type.value], AllSources()) && - source != AllSources()) { - FOR_EACH_OBSERVER(NotificationObserver, - *observers_[type.value][AllSources().map_key()], - Observe(type, source, details)); - } - - // Notify observers of the given type and the given source - if (HasKey(observers_[type.value], source)) { - FOR_EACH_OBSERVER(NotificationObserver, - *observers_[type.value][source.map_key()], - Observe(type, source, details)); - } -} - - -NotificationService::~NotificationService() { - get_tls_ptr().Set(NULL); - -#ifndef NDEBUG - for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { - if (observer_counts_[i] > 0) { - // This may not be completely fixable -- see - // http://code.google.com/p/chromium/issues/detail?id=11010 . - // But any new leaks should be fixed. - CHROMIUM_LOG(WARNING) << observer_counts_[i] << " notification observer(s) leaked" - << " of notification type " << i; - } - } -#endif - - for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { - NotificationSourceMap omap = observers_[i]; - for (NotificationSourceMap::iterator it = omap.begin(); - it != omap.end(); ++it) { - delete it->second; - } - } -} - -NotificationObserver::~NotificationObserver() {}
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/notification_service.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file describes a central switchboard for notifications that might -// happen in various parts of the application, and allows users to register -// observers for various classes of events that they're interested in. - -#ifndef CHROME_COMMON_NOTIFICATION_SERVICE_H_ -#define CHROME_COMMON_NOTIFICATION_SERVICE_H_ - -#include <map> - -#include "base/observer_list.h" -#include "chrome/common/notification_details.h" -#include "chrome/common/notification_observer.h" -#include "chrome/common/notification_source.h" -#include "chrome/common/notification_type.h" - -class NotificationObserver; - -class NotificationService { - public: - // Returns the NotificationService object for the current thread, or NULL if - // none. - static NotificationService* current(); - - // Normally instantiated when the thread is created. Not all threads have - // a NotificationService. Only one instance should be created per thread. - NotificationService(); - ~NotificationService(); - - // Registers a NotificationObserver to be called whenever a matching - // notification is posted. Observer is a pointer to an object subclassing - // NotificationObserver to be notified when an event matching the other two - // parameters is posted to this service. Type is the type of events to - // be notified about (or NOTIFY_ALL to receive events of all types). - // Source is a NotificationSource object (created using - // "Source<classname>(pointer)"), if this observer only wants to - // receive events from that object, or NotificationService::AllSources() - // to receive events from all sources. - // - // A given observer can be registered only once for each combination of - // type and source. If the same object is registered more than once, - // it must be removed for each of those combinations of type and source later. - // - // The caller retains ownership of the object pointed to by observer. - void AddObserver(NotificationObserver* observer, - NotificationType type, const NotificationSource& source); - - // Removes the object pointed to by observer from receiving notifications - // that match type and source. If no object matching the parameters is - // currently registered, this method is a no-op. - void RemoveObserver(NotificationObserver* observer, - NotificationType type, const NotificationSource& source); - - // Synchronously posts a notification to all interested observers. - // Source is a reference to a NotificationSource object representing - // the object originating the notification (can be - // NotificationService::AllSources(), in which case - // only observers interested in all sources will be notified). - // Details is a reference to an object containing additional data about - // the notification. If no additional data is needed, NoDetails() is used. - // There is no particular order in which the observers will be notified. - void Notify(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - // Returns a NotificationSource that represents all notification sources - // (for the purpose of registering an observer for events from all sources). - static Source<void> AllSources() { return Source<void>(NULL); } - - // Returns a NotificationDetails object that represents a lack of details - // associated with a notification. (This is effectively a null pointer.) - static Details<void> NoDetails() { return Details<void>(NULL); } - - private: - typedef base::ObserverList<NotificationObserver> NotificationObserverList; - typedef std::map<uintptr_t, NotificationObserverList*> NotificationSourceMap; - - // Convenience function to determine whether a source has a - // NotificationObserverList in the given map; - static bool HasKey(const NotificationSourceMap& map, - const NotificationSource& source); - - // Keeps track of the observers for each type of notification. - // Until we get a prohibitively large number of notification types, - // a simple array is probably the fastest way to dispatch. - NotificationSourceMap observers_[NotificationType::NOTIFICATION_TYPE_COUNT]; - -#ifndef NDEBUG - // Used to check to see that AddObserver and RemoveObserver calls are - // balanced. - int observer_counts_[NotificationType::NOTIFICATION_TYPE_COUNT]; -#endif - - DISALLOW_COPY_AND_ASSIGN(NotificationService); -}; - -#endif // CHROME_COMMON_NOTIFICATION_SERVICE_H_
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/notification_source.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file defines the type used to provide sources for NotificationService -// notifications. - -#ifndef CHROME_COMMON_NOTIFICATION_SOURCE_H__ -#define CHROME_COMMON_NOTIFICATION_SOURCE_H__ - -#include "base/basictypes.h" - -// Do not declare a NotificationSource directly--use either -// "Source<sourceclassname>(sourceclasspointer)" or -// NotificationService::AllSources(). -class NotificationSource { - public: - NotificationSource(const NotificationSource& other) : ptr_(other.ptr_) { } - ~NotificationSource() {} - - // NotificationSource can be used as the index for a map; this method - // returns the pointer to the current source as an identifier, for use as a - // map index. - uintptr_t map_key() const { return reinterpret_cast<uintptr_t>(ptr_); } - - bool operator!=(const NotificationSource& other) const { - return ptr_ != other.ptr_; - } - bool operator==(const NotificationSource& other) const { - return ptr_ == other.ptr_; - } - - protected: - explicit NotificationSource(void* ptr) : ptr_(ptr) {} - - void* ptr_; -}; - -template <class T> -class Source : public NotificationSource { - public: - explicit Source(T* ptr) : NotificationSource(ptr) {} - - explicit Source(const NotificationSource& other) - : NotificationSource(other) {} - - T* operator->() const { return ptr(); } - T* ptr() const { return static_cast<T*>(ptr_); } -}; - -#endif // CHROME_COMMON_NOTIFICATION_SOURCE_H__
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/notification_type.h +++ /dev/null @@ -1,576 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_NOTIFICATION_TYPE_H_ -#define CHROME_COMMON_NOTIFICATION_TYPE_H_ - -// This file describes various types used to describe and filter notifications -// that pass through the NotificationService. -// -// It is written as an enum inside a class so that it can be forward declared. -// You're not allowed to forward declare an enum, and we want to forward -// declare this since it's required by NotificationObserver which is included -// by a lot of header files. -// -// Since this class encapsulates an integral value, it should be passed by -// value. -class NotificationType { - public: - enum Type { - // General ----------------------------------------------------------------- - - // Special signal value to represent an interest in all notifications. - // Not valid when posting a notification. - ALL = 0, - - // The app is done processing user actions, now is a good time to do - // some background work. - IDLE, - - // Means that the app has just started doing something in response to a - // user action, and that background processes shouldn't run if avoidable. - BUSY, - - // This is sent when the user does a gesture resulting in a noteworthy - // action taking place. This is typically used for logging. The source is - // the profile, and the details is a wstring identifying the action. - USER_ACTION, - - // NavigationController ---------------------------------------------------- - - // A new pending navigation has been created. Pending entries are created - // when the user requests the navigation. We don't know if it will actually - // happen until it does (at this point, it will be "committed." Note that - // renderer- initiated navigations such as link clicks will never be - // pending. - // - // This notification is called after the pending entry is created, but - // before we actually try to navigate. The source will be the - // NavigationController that owns the pending entry, and there are no - // details. - NAV_ENTRY_PENDING, - - // A new non-pending navigation entry has been created. This will - // correspond to one NavigationController entry being created (in the case - // of new navigations) or renavigated to (for back/forward navigations). - // - // The source will be the navigation controller doing the commit. The - // details will be NavigationController::LoadCommittedDetails. - NAV_ENTRY_COMMITTED, - - // Indicates that the NavigationController given in the Source has - // decreased its back/forward list count by removing entries from either - // the front or back of its list. This is usually the result of going back - // and then doing a new navigation, meaning all the "forward" items are - // deleted. - // - // This normally happens as a result of a new navigation. It will be - // followed by a NAV_ENTRY_COMMITTED message for the new page that - // caused the pruning. It could also be a result of removing an item from - // the list to fix up after interstitials. - // - // The details are NavigationController::PrunedDetails. - NAV_LIST_PRUNED, - - // Indicates that a NavigationEntry has changed. The source will be the - // NavigationController that owns the NavigationEntry. The details will be - // a NavigationController::EntryChangedDetails struct. - // - // This will NOT be sent on navigation, interested parties should also - // listen for NAV_ENTRY_COMMITTED to handle that case. This will be - // sent when the entry is updated outside of navigation (like when a new - // title comes). - NAV_ENTRY_CHANGED, - - // Other load-related (not from NavigationController) ---------------------- - - // A content load is starting. The source will be a - // Source<NavigationController> corresponding to the tab in which the load - // is occurring. No details are expected for this notification. - LOAD_START, - - // A content load has stopped. The source will be a - // Source<NavigationController> corresponding to the tab in which the load - // is occurring. Details in the form of a LoadNotificationDetails object - // are optional. - LOAD_STOP, - - // A frame is staring a provisional load. The source is a - // Source<NavigationController> corresponding to the tab in which the load - // occurs. Details is a bool specifying if the load occurs in the main - // frame (or a sub-frame if false). - FRAME_PROVISIONAL_LOAD_START, - - // Content was loaded from an in-memory cache. The source will be a - // Source<NavigationController> corresponding to the tab in which the load - // occurred. Details in the form of a LoadFromMemoryCacheDetails object - // are provided. - LOAD_FROM_MEMORY_CACHE, - - // A provisional content load has failed with an error. The source will be - // a Source<NavigationController> corresponding to the tab in which the - // load occurred. Details in the form of a ProvisionalLoadDetails object - // are provided. - FAIL_PROVISIONAL_LOAD_WITH_ERROR, - - // A response has been received for a resource request. The source will be - // a Source<NavigationController> corresponding to the tab in which the - // request was issued. Details in the form of a ResourceRequestDetails - // object are provided. - RESOURCE_RESPONSE_STARTED, - - // The response to a resource request has completed. The source will be a - // Source<NavigationController> corresponding to the tab in which the - // request was issued. Details in the form of a ResourceRequestDetails - // object are provided. - RESOURCE_RESPONSE_COMPLETED, - - // A redirect was received while requesting a resource. The source will be - // a Source<NavigationController> corresponding to the tab in which the - // request was issued. Details in the form of a ResourceRedirectDetails - // are provided. - RESOURCE_RECEIVED_REDIRECT, - - // The SSL state of a page has changed in some visible way. For example, - // if an insecure resource is loaded on a secure page. Note that a - // toplevel load commit will also update the SSL state (since the - // NavigationEntry is new) and this message won't always be sent in that - // case. Listen to this notification if you need to refresh SSL-related UI - // elements. - // - // The source will be the navigation controller associated with the load. - // There are no details. The entry changed will be the active entry of the - // controller. - SSL_VISIBLE_STATE_CHANGED, - - // The SSL state of the browser has changed in some internal way. For - // example, the user might have explicitly allowed some broken certificate - // or a secure origin might have included some insecure content. Listen to - // this notifiation if you need to keep track of our internal SSL state. - // - // The source will be the navigation controller associated with the state - // change. There are no details. - SSL_INTERNAL_STATE_CHANGED, - - // Lets resource handlers and other interested observers know when the - // message filter is being deleted and can no longer be used. - RESOURCE_MESSAGE_FILTER_SHUTDOWN, - - // Views ------------------------------------------------------------------- - - // Notification that a view was removed from a view hierarchy. The source - // is the view, the details is the parent view. - VIEW_REMOVED, - - // Browser-window ---------------------------------------------------------- - - // This message is sent after a window has been opened. The source is a - // Source<Browser> with a pointer to the new window. No details are - // expected. - BROWSER_OPENED, - - // This message is sent after a window has been closed. The source is a - // Source<Browser> with a pointer to the closed window. Details is a - // boolean that if true indicates that the application will be closed as a - // result of this browser window closure (i.e. this was the last opened - // browser window). Note that the boolean pointed to by Details is only - // valid for the duration of this call. - BROWSER_CLOSED, - - // This message is sent when the last window considered to be an - // "application window" has been closed. Dependent/dialog/utility windows - // can use this as a way to know that they should also close. No source or - // details are passed. - ALL_APPWINDOWS_CLOSED, - - // Indicates a new top window has been created. The source is the - // WindowWin. - WINDOW_CREATED, - - // Indicates that a top window has been closed. The source is the HWND - // that was closed, no details are expected. - WINDOW_CLOSED, - - // Sent when an info bubble has been created but not yet shown. The source - // is the InfoBubble. - INFO_BUBBLE_CREATED, - - // Tabs -------------------------------------------------------------------- - - // This notification is sent after a tab has been appended to the - // tab_strip. The source is a Source<NavigationController> with a pointer - // to controller for the added tab. There are no details. - TAB_PARENTED, - - // This message is sent before a tab has been closed. The source is a - // Source<NavigationController> with a pointer to the controller for the - // closed tab. No details are expected. - // - // See also TAB_CLOSED. - TAB_CLOSING, - - // Notification that a tab has been closed. The source is the - // NavigationController with no details. - TAB_CLOSED, - - // This notification is sent when a render view host has connected to a - // renderer process. The source is a Source<TabContents> with a pointer to - // the TabContents. A TAB_CONTENTS_DISCONNECTED notification is - // guaranteed before the source pointer becomes junk. No details are - // expected. - TAB_CONTENTS_CONNECTED, - - // This notification is sent when a TabContents swaps its render view host - // with another one, possibly changing processes. The source is a - // Source<TabContents> with a pointer to the TabContents. A - // TAB_CONTENTS_DISCONNECTED notification is guaranteed before the - // source pointer becomes junk. No details are expected. - TAB_CONTENTS_SWAPPED, - - // This message is sent after a TabContents is disconnected from the - // renderer process. The source is a Source<TabContents> with a pointer to - // the TabContents (the pointer is usable). No details are expected. - TAB_CONTENTS_DISCONNECTED, - - // This message is sent when a new InfoBar has been added to a TabContents. - // The source is a Source<TabContents> with a pointer to the TabContents - // the InfoBar was added to. The details is a Details<InfoBarDelegate> with - // a pointer to an object implementing the InfoBarDelegate interface for - // the InfoBar that was added. - TAB_CONTENTS_INFOBAR_ADDED, - - // This message is sent when an InfoBar is about to be removed from a - // TabContents. The source is a Source<TabContents> with a pointer to the - // TabContents the InfoBar was removed from. The details is a - // Details<InfoBarDelegate> with a pointer to an object implementing the - // InfoBarDelegate interface for the InfoBar that was removed. - TAB_CONTENTS_INFOBAR_REMOVED, - - // This is sent when an externally hosted tab is created. The details - // contain the ExternalTabContainer that contains the tab - EXTERNAL_TAB_CREATED, - - // This is sent when an externally hosted tab is closed. No details are - // expected. - EXTERNAL_TAB_CLOSED, - - // Indicates that the new page tab has finished loading. This is used for - // performance testing to see how fast we can load it after startup, and is - // only called once for the lifetime of the browser. The source is unused. - // Details is an integer: the number of milliseconds elapsed between - // starting and finishing all painting. - INITIAL_NEW_TAB_UI_LOAD, - - // This notification is sent when a TabContents is being hidden, e.g. due - // to switching away from this tab. The source is a Source<TabContents>. - TAB_CONTENTS_HIDDEN, - - // This notification is sent when a TabContents is being destroyed. Any - // object holding a reference to a TabContents can listen to that - // notification to properly reset the reference. The source is a - // Source<TabContents>. - TAB_CONTENTS_DESTROYED, - - // Stuff inside the tabs --------------------------------------------------- - - // This message is sent after a constrained window has been closed. The - // source is a Source<ConstrainedWindow> with a pointer to the closed child - // window. (The pointer isn't usable, except for identification.) No - // details are expected. - CWINDOW_CLOSED, - - // Indicates that a RenderProcessHost is destructing. The source will be the - // RenderProcessHost that corresponds to the process. - RENDERER_PROCESS_TERMINATED, - - // Indicates that a render process was closed (meaning it exited, but the - // RenderProcessHost might be reused). The source will be the corresponding - // RenderProcessHost. The details will be a bool which is true if the - // process crashed. This may get sent along with - // RENDERER_PROCESS_TERMINATED. - RENDERER_PROCESS_CLOSED, - - // Indicates that a render process has become unresponsive for a period of - // time. The source will be the RenderWidgetHost that corresponds to the - // hung view, and no details are expected. - RENDERER_PROCESS_HANG, - - // Indicates that a render process is created in the sandbox. The source - // will be the RenderProcessHost that corresponds to the created process - // and the detail is a bool telling us if the process got created on the - // sandbox desktop or not. - RENDERER_PROCESS_IN_SBOX, - - // This is sent to notify that the RenderViewHost displayed in a - // TabContents has changed. Source is the TabContents for which the change - // happened, details is the previous RenderViewHost (can be NULL when the - // first RenderViewHost is set). - RENDER_VIEW_HOST_CHANGED, - - // This is sent when a RenderWidgetHost is being destroyed. The source is - // the RenderWidgetHost, the details are not used. - RENDER_WIDGET_HOST_DESTROYED, - - // Notification from TabContents that we have received a response from the - // renderer after using the dom inspector. - DOM_INSPECT_ELEMENT_RESPONSE, - - // Notification from TabContents that we have received a response from the - // renderer in response to a dom automation controller action. - DOM_OPERATION_RESPONSE, - - // Sent when the bookmark bubble hides. The source is the profile, the - // details unused. - BOOKMARK_BUBBLE_HIDDEN, - - // This notification is sent when the result of a find-in-page search is - // available with the browser process. The source is a Source<TabContents> - // with a pointer to the TabContents. Details encompass a - // FindNotificationDetail object that tells whether the match was found or - // not found. - FIND_RESULT_AVAILABLE, - - // This is sent when the users preference for when the bookmark bar should - // be shown changes. The source is the profile, and the details are - // NoDetails. - BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, - - // Used to monitor web cache usage by notifying whenever the - // CacheManagerHost observes new UsageStats. The source will be the - // RenderProcessHost that corresponds to the new statistics. Details are a - // UsageStats object sent by the renderer, and should be copied - ptr not - // guaranteed to be valid after the notification. - WEB_CACHE_STATS_OBSERVED, - - // Child Processes --------------------------------------------------------- - - // This notification is sent when a child process host has connected to a - // child process. There is no usable source, since it is sent from an - // ephemeral task; register for AllSources() to receive this notification. - // The details are in a Details<ChildProcessInfo>. - CHILD_PROCESS_HOST_CONNECTED, - - // This message is sent after a ChildProcessHost is disconnected from the - // child process. There is no usable source, since it is sent from an - // ephemeral task; register for AllSources() to receive this notification. - // The details are in a Details<ChildProcessInfo>. - CHILD_PROCESS_HOST_DISCONNECTED, - - // This message is sent when a child process disappears unexpectedly. - // There is no usable source, since it is sent from an ephemeral task; - // register for AllSources() to receive this notification. The details are - // in a Details<ChildProcessInfo>. - CHILD_PROCESS_CRASHED, - - // This message indicates that an instance of a particular child was - // created in a page. (If one page contains several regions rendered by - // the same child, this notification will occur once for each region - // during the page load.) - // - // There is no usable source, since it is sent from an ephemeral task; - // register for AllSources() to receive this notification. The details are - // in a Details<ChildProcessInfo>. - CHILD_INSTANCE_CREATED, - - // This is sent when network interception is disabled for a plugin, or the - // plugin is unloaded. This should only be sent/received on the browser IO - // thread or the plugin thread. The source is the plugin that is disabling - // interception. No details are expected. - CHROME_PLUGIN_UNLOADED, - - // This is sent when a login prompt is shown. The source is the - // Source<NavigationController> for the tab in which the prompt is shown. - // Details are a LoginNotificationDetails which provide the LoginHandler - // that should be given authentication. - AUTH_NEEDED, - - // This is sent when authentication credentials have been supplied (either - // by the user or by an automation service), but before we've actually - // received another response from the server. The source is the - // Source<NavigationController> for the tab in which the prompt was shown. - // No details are expected. - AUTH_SUPPLIED, - - // History ----------------------------------------------------------------- - - // Sent when a history service is created on the main thread. This is sent - // after history is created, but before it has finished loading. Use - // HISTORY_LOADED is you need to know when loading has completed. - // The source is the profile that the history service belongs to, and the - // details is the pointer to the newly created HistoryService object. - HISTORY_CREATED, - - // Sent when a history service has finished loading. The source is the - // profile that the history service belongs to, and the details is the - // HistoryService. - HISTORY_LOADED, - - // Sent when a URL that has been typed has been added or modified. This is - // used by the in-memory URL database (used by autocomplete) to track - // changes to the main history system. - // - // The source is the profile owning the history service that changed, and - // the details is history::URLsModifiedDetails that lists the modified or - // added URLs. - HISTORY_TYPED_URLS_MODIFIED, - - // Sent when the user visits a URL. - // - // The source is the profile owning the history service that changed, and - // the details is history::URLVisitedDetails. - HISTORY_URL_VISITED, - - // Sent when one or more URLs are deleted. - // - // The source is the profile owning the history service that changed, and - // the details is history::URLsDeletedDetails that lists the deleted URLs. - HISTORY_URLS_DELETED, - - // Sent by history when the favicon of a URL changes. The source is the - // profile, and the details is history::FavIconChangeDetails (see - // history_notifications.h). - FAVICON_CHANGED, - - // Bookmarks --------------------------------------------------------------- - - // Sent when the starred state of a URL changes. A URL is starred if there - // is at least one bookmark for it. The source is a Profile and the details - // is history::URLsStarredDetails that contains the list of URLs and - // whether they were starred or unstarred. - URLS_STARRED, - - // Sent when the bookmark bar model finishes loading. This source is the - // Profile, and the details aren't used. - BOOKMARK_MODEL_LOADED, - - // Sent when the spellchecker object changes. Note that this is not sent - // the first time the spellchecker gets initialized. The source is the - // profile, the details is SpellcheckerReinitializedDetails defined in - // profile. - SPELLCHECKER_REINITIALIZED, - - // Sent when the bookmark bubble is shown for a particular URL. The source - // is the profile, the details the URL. - BOOKMARK_BUBBLE_SHOWN, - - // Non-history storage services -------------------------------------------- - - // Notification that the TemplateURLModel has finished loading from the - // database. The source is the TemplateURLModel, and the details are - // NoDetails. - TEMPLATE_URL_MODEL_LOADED, - - // Notification triggered when a web application has been installed or - // uninstalled. Any application view should reload its data. The source is - // the profile. No details are provided. - WEB_APP_INSTALL_CHANGED, - - // This is sent to a pref observer when a pref is changed. - PREF_CHANGED, - - // Sent when a default request context has been created, so calling - // Profile::GetDefaultRequestContext() will not return NULL. This is sent - // on the thread where Profile::GetRequestContext() is first called, which - // should be the UI thread. - DEFAULT_REQUEST_CONTEXT_AVAILABLE, - - // Autocomplete ------------------------------------------------------------ - - // Sent by the autocomplete controller at least once per query, each time - // new matches are available, subject to rate-limiting/coalescing to reduce - // the number of updates. There are no details. - AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, - - // Sent by the autocomplete controller once per query, immediately after - // synchronous matches become available. There are no details. - AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE, - - // This is sent when an item of the Omnibox popup is selected. The source - // is the profile. - OMNIBOX_OPENED_URL, - - // Sent by the autocomplete edit when it is destroyed. - AUTOCOMPLETE_EDIT_DESTROYED, - - // Sent when the main Google URL has been updated. Some services cache - // this value and need to update themselves when it changes. See - // google_util::GetGoogleURLAndUpdateIfNecessary(). - GOOGLE_URL_UPDATED, - - // Printing ---------------------------------------------------------------- - - // Notification from a PrintedDocument that it has been updated. It may be - // that a printed page has just been generated or that the document's - // number of pages has been calculated. Details is the new page or NULL if - // only the number of pages in the document has been updated. - PRINTED_DOCUMENT_UPDATED, - - // Notification from PrintJob that an event occured. It can be that a page - // finished printing or that the print job failed. Details is - // PrintJob::EventDetails. - PRINT_JOB_EVENT, - - // Shutdown ---------------------------------------------------------------- - - // Sent on the browser IO thread when an URLRequestContext is released by - // its owning Profile. The source is a pointer to the URLRequestContext. - URL_REQUEST_CONTEXT_RELEASED, - - // Sent when WM_ENDSESSION has been received, after the browsers have been - // closed but before browser process has been shutdown. The source/details - // are all source and no details. - SESSION_END, - - // Personalization --------------------------------------------------------- - - PERSONALIZATION, - PERSONALIZATION_CREATED, - - // User Scripts ------------------------------------------------------------ - - // Sent when there are new user scripts available. The details are a - // pointer to SharedMemory containing the new scripts. - USER_SCRIPTS_LOADED, - - // Extensions -------------------------------------------------------------- - - // Sent when new extensions are loaded. The details are an ExtensionList*. - EXTENSIONS_LOADED, - - // Sent when new extensions are installed. The details are a FilePath. - EXTENSION_INSTALLED, - - // Debugging --------------------------------------------------------------- - - // Sent from ~RenderViewHost. The source is the RenderViewHost. - RENDER_VIEW_HOST_DELETED, - - // Count (must be last) ---------------------------------------------------- - // Used to determine the number of notification types. Not valid as - // a type parameter when registering for or posting notifications. - NOTIFICATION_TYPE_COUNT - }; - - explicit NotificationType(Type v) : value(v) {} - - bool operator==(NotificationType t) const { return value == t.value; } - bool operator!=(NotificationType t) const { return value != t.value; } - - // Comparison to explicit enum values. - bool operator==(Type v) const { return value == v; } - bool operator!=(Type v) const { return value != v; } - - Type value; -}; - -inline bool operator==(NotificationType::Type a, NotificationType b) { - return a == b.value; -} -inline bool operator!=(NotificationType::Type a, NotificationType b) { - return a != b.value; -} - -#endif // CHROME_COMMON_NOTIFICATION_TYPE_H_
--- a/ipc/chromium/src/chrome/common/process_watcher_win.cc +++ b/ipc/chromium/src/chrome/common/process_watcher_win.cc @@ -4,93 +4,115 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/common/process_watcher.h" #include "base/message_loop.h" #include "base/object_watcher.h" #include "base/sys_info.h" -#include "chrome/common/result_codes.h" // Maximum amount of time (in milliseconds) to wait for the process to exit. static const int kWaitInterval = 2000; namespace { -class TimerExpiredTask : public mozilla::Runnable, - public base::ObjectWatcher::Delegate { +class ChildReaper : public mozilla::Runnable, + public base::ObjectWatcher::Delegate, + public MessageLoop::DestructionObserver { public: - explicit TimerExpiredTask(base::ProcessHandle process) : process_(process) { + explicit ChildReaper(base::ProcessHandle process, bool force) + : process_(process), force_(force) { watcher_.StartWatching(process_, this); } - virtual ~TimerExpiredTask() { + virtual ~ChildReaper() { if (process_) { KillProcess(); DCHECK(!process_) << "Make sure to close the handle."; } } + // MessageLoop::DestructionObserver ----------------------------------------- + + virtual void WillDestroyCurrentMessageLoop() + { + MOZ_ASSERT(!force_); + if (process_) { + WaitForSingleObject(process_, INFINITE); + base::CloseProcessHandle(process_); + process_ = 0; + + MessageLoop::current()->RemoveDestructionObserver(this); + delete this; + } + } + // Task --------------------------------------------------------------------- NS_IMETHOD Run() override { - if (process_) + MOZ_ASSERT(force_); + if (process_) { KillProcess(); + } return NS_OK; } // MessageLoop::Watcher ----------------------------------------------------- virtual void OnObjectSignaled(HANDLE object) { // When we're called from KillProcess, the ObjectWatcher may still be // watching. the process handle, so make sure it has stopped. watcher_.StopWatching(); base::CloseProcessHandle(process_); - process_ = NULL; + process_ = 0; + + if (!force_) { + MessageLoop::current()->RemoveDestructionObserver(this); + delete this; + } } private: void KillProcess() { + MOZ_ASSERT(force_); + // OK, time to get frisky. We don't actually care when the process // terminates. We just care that it eventually terminates, and that's what // TerminateProcess should do for us. Don't check for the result code since // it fails quite often. This should be investigated eventually. - TerminateProcess(process_, ResultCodes::HUNG); + TerminateProcess(process_, base::PROCESS_END_PROCESS_WAS_HUNG); // Now, just cleanup as if the process exited normally. OnObjectSignaled(process_); } // The process that we are watching. base::ProcessHandle process_; base::ObjectWatcher watcher_; - DISALLOW_EVIL_CONSTRUCTORS(TimerExpiredTask); + bool force_; + + DISALLOW_EVIL_CONSTRUCTORS(ChildReaper); }; } // namespace // static -void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process - , bool force -) { +void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process, bool force) { DCHECK(process != GetCurrentProcess()); - if (!force) { - WaitForSingleObject(process, INFINITE); - base::CloseProcessHandle(process); - return; - } - // If already signaled, then we are done! if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) { base::CloseProcessHandle(process); return; } - RefPtr<mozilla::Runnable> task = new TimerExpiredTask(process); - - MessageLoop::current()->PostDelayedTask(task.forget(), - kWaitInterval); + MessageLoopForIO* loop = MessageLoopForIO::current(); + if (force) { + RefPtr<mozilla::Runnable> task = new ChildReaper(process, force); + loop->PostDelayedTask(task.forget(), kWaitInterval); + } else { + loop->AddDestructionObserver(new ChildReaper(process, force)); + } }
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/result_codes.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_RESULT_CODES_H_ -#define CHROME_COMMON_RESULT_CODES_H_ - -#include "base/process_util.h" - -// This file consolidates all the return codes for the browser and renderer -// process. The return code is the value that: -// a) is returned by main() or winmain(), or -// b) specified in the call for ExitProcess() or TerminateProcess(), or -// c) the exception value that causes a process to terminate. -// -// It is advisable to not use negative numbers because the Windows API returns -// it as an unsigned long and the exception values have high numbers. For -// example EXCEPTION_ACCESS_VIOLATION value is 0xC0000005. - -class ResultCodes { - public: - enum ExitCode { - NORMAL_EXIT = base::PROCESS_END_NORMAL_TERMINATON, - TASKMAN_KILL = base::PROCESS_END_KILLED_BY_USER, - HUNG = base::PROCESS_END_PROCESS_WAS_HUNG, - INVALID_CMDLINE_URL, // An invalid command line url was given. - SBOX_INIT_FAILED, // The sandbox could not be initialized. - GOOGLE_UPDATE_INIT_FAILED, // The Google Update client stub init failed. - GOOGLE_UPDATE_LAUNCH_FAILED,// Google Update could not launch chrome DLL. - BAD_PROCESS_TYPE, // The process is of an unknown type. - MISSING_PATH, // An critical chrome path is missing. - MISSING_DATA, // A critical chrome file is missing. - SHELL_INTEGRATION_FAILED, // Failed to make Chrome default browser. - MACHINE_LEVEL_INSTALL_EXISTS, // Machine level install exists - UNINSTALL_DELETE_FILE_ERROR,// Error while deleting shortcuts. - UNINSTALL_CHROME_ALIVE, // Uninstall detected another chrome instance. - UNINSTALL_NO_SURVEY, // Do not launch survey after uninstall. - UNINSTALL_USER_CANCEL, // The user changed her mind. - UNINSTALL_DELETE_PROFILE, // Delete profile as well during uninstall. - UNSUPPORTED_PARAM, // Command line parameter is not supported. - KILLED_BAD_MESSAGE, // A bad message caused the process termination. - IMPORTER_CANCEL, // The user canceled the browser import. - IMPORTER_HUNG, // Browser import hung and was killed. - EXIT_LAST_CODE // Last return code (keep it last). - }; -}; - -#endif // CHROME_COMMON_RESULT_CODES_H_
--- a/ipc/glue/BrowserProcessSubThread.cpp +++ b/ipc/glue/BrowserProcessSubThread.cpp @@ -1,16 +1,15 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/ipc/BrowserProcessSubThread.h" -#include "chrome/common/notification_service.h" #if defined(OS_WIN) #include <objbase.h> #endif namespace mozilla { namespace ipc { @@ -37,18 +36,17 @@ BrowserProcessSubThread* BrowserProcessS // nullptr, // HISTORY #if defined(OS_LINUX) nullptr, // BACKGROUND_X11 #endif }; BrowserProcessSubThread::BrowserProcessSubThread(ID aId) : base::Thread(kBrowserThreadNames[aId]), - mIdentifier(aId), - mNotificationService(nullptr) + mIdentifier(aId) { StaticMutexAutoLock lock(sLock); DCHECK(aId >= 0 && aId < ID_COUNT); DCHECK(sBrowserThreads[aId] == nullptr); sBrowserThreads[aId] = this; } BrowserProcessSubThread::~BrowserProcessSubThread() @@ -63,25 +61,21 @@ BrowserProcessSubThread::~BrowserProcess void BrowserProcessSubThread::Init() { #if defined(OS_WIN) // Initializes the COM library on the current thread. CoInitialize(nullptr); #endif - mNotificationService = new NotificationService(); } void BrowserProcessSubThread::CleanUp() { - delete mNotificationService; - mNotificationService = nullptr; - #if defined(OS_WIN) // Closes the COM library on the current thread. CoInitialize must // be balanced by a corresponding call to CoUninitialize. CoUninitialize(); #endif } // static
--- a/ipc/glue/BrowserProcessSubThread.h +++ b/ipc/glue/BrowserProcessSubThread.h @@ -7,18 +7,16 @@ #ifndef mozilla_ipc_BrowserProcessSubThread_h #define mozilla_ipc_BrowserProcessSubThread_h #include "base/thread.h" #include "mozilla/StaticMutex.h" #include "nsDebug.h" -class NotificationService; - namespace mozilla { namespace ipc { // Copied from browser_process_impl.cc, modified slightly. class BrowserProcessSubThread : public base::Thread { public: // An enumeration of the well-known threads. @@ -49,18 +47,16 @@ protected: virtual void Init(); virtual void CleanUp(); private: // The identifier of this thread. Only one thread can exist with a given // identifier at a given time. ID mIdentifier; - NotificationService* mNotificationService; - // This lock protects |browser_threads_|. Do not read or modify that array // without holding this lock. Do not block while holding this lock. static StaticMutex sLock; // An array of the ChromeThread objects. This array is protected by |lock_|. // The threads are not owned by this array. Typically, the threads are owned // on the UI thread by the g_browser_process object. ChromeThreads remove
--- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -88,31 +88,28 @@ base::ChildPrivileges GeckoChildProcessHost::DefaultChildPrivileges() { return (kLowRightsSubprocesses ? base::PRIVILEGES_UNPRIVILEGED : base::PRIVILEGES_INHERIT); } GeckoChildProcessHost::GeckoChildProcessHost(GeckoProcessType aProcessType, ChildPrivileges aPrivileges) - : ChildProcessHost(RENDER_PROCESS), // FIXME/cjones: we should own this enum - mProcessType(aProcessType), + : mProcessType(aProcessType), mPrivileges(aPrivileges), mMonitor("mozilla.ipc.GeckChildProcessHost.mMonitor"), mProcessState(CREATING_CHANNEL), #if defined(MOZ_SANDBOX) && defined(XP_WIN) mEnableSandboxLogging(false), mSandboxLevel(0), #endif - mDelegate(nullptr), mChildProcessHandle(0) #if defined(MOZ_WIDGET_COCOA) , mChildTask(MACH_PORT_NULL) #endif - , mAssociatedActors(1) { MOZ_COUNT_CTOR(GeckoChildProcessHost); } GeckoChildProcessHost::~GeckoChildProcessHost() { AssertIOThread(); @@ -482,36 +479,16 @@ GeckoChildProcessHost::SetAlreadyDead() if (mChildProcessHandle && mChildProcessHandle != kInvalidProcessHandle) { base::CloseProcessHandle(mChildProcessHandle); } mChildProcessHandle = 0; } -namespace { - -void -DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess) -{ - XRE_GetIOMessageLoop() - ->PostTask(mozilla::MakeAndAddRef<DeleteTask<GeckoChildProcessHost>>(aSubprocess)); -} - -} - -void -GeckoChildProcessHost::DissociateActor() -{ - if (!--mAssociatedActors) { - MessageLoop::current()-> - PostTask(NewRunnableFunction(DelayedDeleteSubprocess, this)); - } -} - int32_t GeckoChildProcessHost::mChildCounter = 0; void GeckoChildProcessHost::SetChildLogName(const char* varName, const char* origLogName, nsACString &buffer) { // We currently have no portable way to launch child with environment // different than parent. So temporarily change NSPR_LOG_FILE so child @@ -1155,17 +1132,16 @@ GeckoChildProcessHost::PerformAsyncLaunc #endif if (!process) { return false; } // NB: on OS X, we block much longer than we need to in order to // reach this call, waiting for the child process's task_t. The // best way to fix that is to refactor this file, hard. - SetHandle(process); #if defined(MOZ_WIDGET_COCOA) mChildTask = child_task; #endif OpenPrivilegedHandle(base::GetProcId(process)); { MonitorAutoLock lock(mMonitor); mProcessState = PROCESS_CREATED; @@ -1231,25 +1207,16 @@ void GeckoChildProcessHost::GetQueuedMessages(std::queue<IPC::Message>& queue) { // If this is called off the IO thread, bad things will happen. DCHECK(MessageLoopForIO::current()); swap(queue, mQueue); // We expect the next listener to take over processing of our queue. } -void -GeckoChildProcessHost::OnWaitableEventSignaled(base::WaitableEvent *event) -{ - if (mDelegate) { - mDelegate->OnWaitableEventSignaled(event); - } - ChildProcessHost::OnWaitableEventSignaled(event); -} - bool GeckoChildProcessHost::sRunSelfAsContentProc(false); #ifdef MOZ_NUWA_PROCESS using mozilla::ipc::GeckoExistingProcessHost; using mozilla::ipc::FileDescriptor; GeckoExistingProcessHost::
--- a/ipc/glue/GeckoChildProcessHost.h +++ b/ipc/glue/GeckoChildProcessHost.h @@ -7,17 +7,16 @@ #ifndef __IPC_GLUE_GECKOCHILDPROCESSHOST_H__ #define __IPC_GLUE_GECKOCHILDPROCESSHOST_H__ #include "base/file_path.h" #include "base/process_util.h" #include "base/waitable_event.h" #include "chrome/common/child_process_host.h" -#include "mozilla/Atomics.h" #include "mozilla/DebugOnly.h" #include "mozilla/ipc/FileDescriptor.h" #include "mozilla/Monitor.h" #include "mozilla/StaticPtr.h" #include "nsCOMPtr.h" #include "nsXULAppAPI.h" // for GeckoProcessType #include "nsString.h" @@ -88,26 +87,20 @@ public: virtual void OnMessageReceived(IPC::Message&& aMsg); virtual void OnChannelError(); virtual void GetQueuedMessages(std::queue<IPC::Message>& queue); virtual void InitializeChannel(); virtual bool CanShutdown() { return true; } - virtual void OnWaitableEventSignaled(base::WaitableEvent *event); - IPC::Channel* GetChannel() { return channelp(); } - base::WaitableEvent* GetShutDownEvent() { - return GetProcessEvent(); - } - // Returns a "borrowed" handle to the child process - the handle returned // by this function must not be closed by the caller. ProcessHandle GetChildProcessHandle() { return mChildProcessHandle; } GeckoProcessType GetProcessType() { return mProcessType; @@ -123,24 +116,16 @@ public: * Must run on the IO thread. Cause the OS process to exit and * ensure its OS resources are cleaned up. */ void Join(); // For bug 943174: Skip the EnsureProcessTerminated call in the destructor. void SetAlreadyDead(); - // This associates an actor telling the process host to stay alive at least - // until DissociateActor has been called. - void AssociateActor() { mAssociatedActors++; } - - // This gets called when actors get destroyed and will schedule the object - // for deletion when all actors have cleared their associations. - void DissociateActor(); - static void EnableSameExecutableForContentProc() { sRunSelfAsContentProc = true; } protected: GeckoProcessType mProcessType; ChildPrivileges mPrivileges; Monitor mMonitor; FilePath mProcessPath; @@ -178,18 +163,16 @@ protected: int32_t mSandboxLevel; #endif #endif // XP_WIN #if defined(OS_POSIX) base::file_handle_mapping_vector mFileMap; #endif - base::WaitableEventWatcher::Delegate* mDelegate; - ProcessHandle mChildProcessHandle; #if defined(OS_MACOSX) task_t mChildTask; #endif void OpenPrivilegedHandle(base::ProcessId aPid); private: @@ -213,20 +196,16 @@ private: // channel, there's a small window of time in which *we* might still // be the channel listener, and receive messages. That's bad // because we have no idea what to do with those messages. So queue // them here until we hand off the eventual listener. // // FIXME/cjones: this strongly indicates bad design. Shame on us. std::queue<IPC::Message> mQueue; - // This tracks how many actors are associated with this process that require - // it to stay alive and have not yet been destroyed. - Atomic<int32_t> mAssociatedActors; - // Remember original env values so we can restore it (there is no other // simple way how to change environment of a child process than to modify // the current environment). nsCString mRestoreOrigNSPRLogName; nsCString mRestoreOrigMozLogName; static uint32_t sNextUniqueID;
--- a/ipc/glue/Transport_posix.cpp +++ b/ipc/glue/Transport_posix.cpp @@ -5,18 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <unistd.h> #include <string> #include "base/eintr_wrapper.h" -#include "chrome/common/child_process_info.h" - #include "mozilla/ipc/Transport.h" #include "mozilla/ipc/FileDescriptor.h" #include "ProtocolUtils.h" using namespace std; using base::ProcessHandle;
--- a/ipc/glue/Transport_win.cpp +++ b/ipc/glue/Transport_win.cpp @@ -1,16 +1,15 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "base/message_loop.h" -#include "chrome/common/child_process_info.h" #include "mozilla/ipc/Transport.h" #include "mozilla/ipc/ProtocolUtils.h" using namespace std; using base::ProcessHandle;
--- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -489,18 +489,16 @@ XPCShellEnvironment::Init() NS_ERROR("failed to get JSRuntime from nsJSRuntimeService!"); return false; } mGlobalHolder.init(rt); AutoSafeJSContext cx; - JS_SetContextPrivate(cx, this); - nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID()); if (!xpc) { NS_ERROR("failed to get nsXPConnect service!"); return false; } nsCOMPtr<nsIPrincipal> principal;
--- a/js/public/Conversions.h +++ b/js/public/Conversions.h @@ -395,19 +395,19 @@ ToIntWidth(double d) } } // namespace detail /* ES5 9.5 ToInt32 (specialized for doubles). */ inline int32_t ToInt32(double d) { - // clang crashes compiling this when targeting arm-darwin: + // clang crashes compiling this when targeting arm: // https://llvm.org/bugs/show_bug.cgi?id=22974 -#if defined (__arm__) && defined (__GNUC__) && !defined(__APPLE__) +#if defined (__arm__) && defined (__GNUC__) && !defined(__clang__) int32_t i; uint32_t tmp0; uint32_t tmp1; uint32_t tmp2; asm ( // We use a pure integer solution here. In the 'softfp' ABI, the argument // will start in r0 and r1, and VFP can't do all of the necessary ECMA // conversions by itself so some integer code will be required anyway. A
--- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -2106,19 +2106,34 @@ BytecodeEmitter::checkSideEffects(ParseN MOZ_ASSERT(pn->isArity(PN_NAME)); *answer = true; return true; // Unary cases with side effects only if the child has them. case PNK_TYPEOFEXPR: case PNK_VOID: case PNK_NOT: + MOZ_ASSERT(pn->isArity(PN_UNARY)); + return checkSideEffects(pn->pn_kid, answer); + + // Even if the name expression is effect-free, performing ToPropertyKey on + // it might not be effect-free: + // + // RegExp.prototype.toString = () => { throw 42; }; + // ({ [/regex/]: 0 }); // ToPropertyKey(/regex/) throws 42 + // + // function Q() { + // ({ [new.target]: 0 }); + // } + // Q.toString = () => { throw 17; }; + // new Q; // new.target will be Q, ToPropertyKey(Q) throws 17 case PNK_COMPUTED_NAME: MOZ_ASSERT(pn->isArity(PN_UNARY)); - return checkSideEffects(pn->pn_kid, answer); + *answer = true; + return true; // Looking up or evaluating the associated name could throw. case PNK_TYPEOFNAME: MOZ_ASSERT(pn->isArity(PN_UNARY)); *answer = true; return true; // These unary cases have side effects on the enclosing object/array,
--- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -218,26 +218,23 @@ AutoGCRooter::trace(JSTracer* trc) MOZ_ASSERT(tag_ >= 0); if (Value* vp = static_cast<AutoArrayRooter*>(this)->array) TraceRootRange(trc, tag_, vp, "JS::AutoArrayRooter.array"); } /* static */ void AutoGCRooter::traceAll(JSTracer* trc) { - if (JSContext* cx = trc->runtime()->maybeContextFromMainThread()) - traceAllInContext(cx, trc); + traceAllInContext(trc->runtime()->contextFromMainThread(), trc); } /* static */ void AutoGCRooter::traceAllWrappers(JSTracer* trc) { - JSContext* cx = trc->runtime()->maybeContextFromMainThread(); - if (!cx) - return; + JSContext* cx = trc->runtime()->contextFromMainThread(); for (AutoGCRooter* gcr = cx->roots.autoGCRooters_; gcr; gcr = gcr->down) { if (gcr->tag_ == WRAPVECTOR || gcr->tag_ == WRAPPER) gcr->trace(trc); } } void @@ -315,18 +312,17 @@ js::gc::GCRuntime::markRuntime(JSTracer* MarkWellKnownSymbols(trc); jit::JitRuntime::Mark(trc, lock); } } if (rt->isHeapMinorCollecting()) jit::JitRuntime::MarkJitcodeGlobalTableUnconditionally(trc); - if (JSContext* cx = rt->maybeContextFromMainThread()) - cx->mark(trc); + rt->contextFromMainThread()->mark(trc); for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) c->traceRoots(trc, traceOrMark); MarkInterpreterActivations(rt, trc); jit::MarkJitActivations(rt, trc);
--- a/js/src/irregexp/RegExpEngine.cpp +++ b/js/src/irregexp/RegExpEngine.cpp @@ -88,20 +88,20 @@ static const int kIgnoreCaseWordRanges[] static const int kIgnoreCaseWordCount = ArrayLength(kIgnoreCaseWordRanges); static const int kWordAndSurrogateRanges[] = { '0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, unicode::LeadSurrogateMin, unicode::TrailSurrogateMax + 1, 0x10000 }; static const int kWordAndSurrogateRangeCount = ArrayLength(kWordAndSurrogateRanges); static const int kNegatedIgnoreCaseWordAndSurrogateRanges[] = { 0, '0', '9' + 1, 'A', - 'K', 'K' + 1, 'S', 'S' + 1, 'Z' + 1, '_', '_' + 1, 'a', - 'k', 'k' + 1, 's', 's' + 1, - 'z' + 1, unicode::LeadSurrogateMin, + 'z' + 1, 0x017F, + 0x017F + 1, 0x212A, + 0x212A + 1, unicode::LeadSurrogateMin, unicode::TrailSurrogateMax + 1, 0x10000, 0x10000 }; static const int kNegatedIgnoreCaseWordAndSurrogateRangeCount = ArrayLength(kNegatedIgnoreCaseWordAndSurrogateRanges); static const int kDigitRanges[] = { '0', '9' + 1, 0x10000 }; static const int kDigitRangeCount = ArrayLength(kDigitRanges); static const int kDigitAndSurrogateRanges[] = { '0', '9' + 1,
--- a/js/src/jit-test/tests/auto-regress/bug746376.js +++ b/js/src/jit-test/tests/auto-regress/bug746376.js @@ -27,32 +27,30 @@ function reportCompare (expected, actual function enterFunc (funcName) { var lastFunc = callStack.pop(); reportCompare(funcName, lastFunc, "Test driver failure wrong exit function "); } function getTestCaseResult(expected, actual) function getFailedCases() { for ( var i = 0; i < gTestcases.length; i++ ) {} }; -function jit(on) {} var lfcode = new Array(); lfcode.push("\ var summary = 'decompilation of \"let with with\" ';\ var actual = '';\ var expect = '';\ test();\ function test() {\ enterFunc ('test');\ gczeal(2);\ for (let q = 0; q < 50; ++q) {\ new Function('for (var i = 0; i < 5; ++i) { } ')();\ var w = 'r'.match(/r/);\ new Function('for (var j = 0; j < 1; ++j) { } ')();\ }\ - jit(('Math.log'));\ reportCompare(expect, actual, summary);\ }\ "); delete Debugger; while (true) { var file = lfcode.shift(); if (file == undefined) { break; } if (file == "evaluate") { } else {
--- a/js/src/jit-test/tests/jaeger/recompile/bug648843.js +++ b/js/src/jit-test/tests/jaeger/recompile/bug648843.js @@ -1,8 +1,8 @@ -function jit(on) +function Q(on) { options().match } function options() { return "methodjit"; } gczeal(2); -for (i = 0; i < 100 ; ++i) { jit(jit(42, [])); } +for (i = 0; i < 100 ; ++i) { Q(Q(42, [])); }
--- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -1,16 +1,17 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jit/arm/MacroAssembler-arm.h" +#include "mozilla/Attributes.h" #include "mozilla/Casting.h" #include "mozilla/DebugOnly.h" #include "mozilla/MathAlgorithms.h" #include "asmjs/WasmBinary.h" #include "jit/arm/Simulator-arm.h" #include "jit/Bailouts.h" #include "jit/BaselineFrame.h" @@ -4901,24 +4902,24 @@ MacroAssembler::callWithABIPost(uint32_t if (secondScratchReg_ != lr) ma_mov(secondScratchReg_, lr); switch (result) { case MoveOp::DOUBLE: if (!UseHardFpABI()) { // Move double from r0/r1 to ReturnFloatReg. ma_vxfer(r0, r1, ReturnDoubleReg); - break; } + break; case MoveOp::FLOAT32: if (!UseHardFpABI()) { // Move float32 from r0 to ReturnFloatReg. ma_vxfer(r0, ReturnFloat32Reg.singleOverlay()); - break; } + break; case MoveOp::GENERAL: break; default: MOZ_CRASH("unexpected callWithABI result"); } freeStack(stackAdjust);
--- a/js/src/jit/arm/disasm/Disasm-arm.cpp +++ b/js/src/jit/arm/disasm/Disasm-arm.cpp @@ -1898,17 +1898,17 @@ Decoder::DecodeSpecialCondition(Instruct out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "dmb %s", option); break; default: Unknown(instr); } break; } - // else fall through + MOZ_FALLTHROUGH; case 0xB: if ((instr->Bits(22, 20) == 5) && (instr->Bits(15, 12) == 0xf)) { int Rn = instr->Bits(19, 16); int offset = instr->Bits(11, 0); if (offset == 0) { out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "pld [r%d]", Rn); } else if (instr->Bit(23) == 0) {
--- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -461,32 +461,24 @@ JS_NewRuntime(uint32_t maxbytes, uint32_ { MOZ_ASSERT(JS::detail::libraryInitState == JS::detail::InitState::Running, "must call JS_Init prior to creating any JSRuntimes"); // Make sure that all parent runtimes are the topmost parent. while (parentRuntime && parentRuntime->parentRuntime) parentRuntime = parentRuntime->parentRuntime; - JSRuntime* rt = js_new<JSRuntime>(parentRuntime); - if (!rt) - return nullptr; - - if (!rt->init(maxbytes, maxNurseryBytes)) { - JS_DestroyRuntime(rt); - return nullptr; - } - - return rt; + return NewContext(maxbytes, maxNurseryBytes, parentRuntime); } JS_PUBLIC_API(void) JS_DestroyRuntime(JSRuntime* rt) { - js_delete(rt); + JSContext* cx = rt->contextFromMainThread(); + DestroyContext(cx); } static JS_CurrentEmbedderTimeFunction currentEmbedderTimeFunction; JS_PUBLIC_API(void) JS_SetCurrentEmbedderTimeFunction(JS_CurrentEmbedderTimeFunction timeFn) { currentEmbedderTimeFunction = timeFn; @@ -558,40 +550,16 @@ JS_BeginRequest(JSContext* cx) JS_PUBLIC_API(void) JS_EndRequest(JSContext* cx) { MOZ_ASSERT(cx->outstandingRequests != 0); cx->outstandingRequests--; StopRequest(cx); } -JS_PUBLIC_API(void*) -JS_GetContextPrivate(JSContext* cx) -{ - return cx->data; -} - -JS_PUBLIC_API(void) -JS_SetContextPrivate(JSContext* cx, void* data) -{ - cx->data = data; -} - -JS_PUBLIC_API(void*) -JS_GetSecondContextPrivate(JSContext* cx) -{ - return cx->data2; -} - -JS_PUBLIC_API(void) -JS_SetSecondContextPrivate(JSContext* cx, void* data) -{ - cx->data2 = data; -} - JS_PUBLIC_API(JSRuntime*) JS_GetRuntime(JSContext* cx) { return cx->runtime(); } JS_PUBLIC_API(JSContext*) JS_GetContext(JSRuntime* rt)
--- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1036,28 +1036,16 @@ class MOZ_RAII JSAutoRequest #if 0 private: static void* operator new(size_t) CPP_THROW_NEW { return 0; } static void operator delete(void*, size_t) { } #endif }; -extern JS_PUBLIC_API(void*) -JS_GetContextPrivate(JSContext* cx); - -extern JS_PUBLIC_API(void) -JS_SetContextPrivate(JSContext* cx, void* data); - -extern JS_PUBLIC_API(void*) -JS_GetSecondContextPrivate(JSContext* cx); - -extern JS_PUBLIC_API(void) -JS_SetSecondContextPrivate(JSContext* cx, void* data); - extern JS_PUBLIC_API(JSRuntime*) JS_GetRuntime(JSContext* cx); /** * Returns the runtime's JSContext. The plan is to expose a single type to the * API, so this function will likely be removed soon. */ extern JS_PUBLIC_API(JSContext*)
--- a/js/src/jsatominlines.h +++ b/js/src/jsatominlines.h @@ -205,22 +205,16 @@ ClassName(JSProtoKey key, JSAtomState& a JS_STATIC_ASSERT(offsetof(JSAtomState, Null) + JSProto_LIMIT * sizeof(ImmutablePropertyNamePtr) <= sizeof(JSAtomState)); JS_STATIC_ASSERT(JSProto_Null == 0); return (&atomState.Null)[key]; } inline Handle<PropertyName*> -ClassName(JSProtoKey key, JSRuntime* rt) -{ - return ClassName(key, *rt->commonNames); -} - -inline Handle<PropertyName*> ClassName(JSProtoKey key, ExclusiveContext* cx) { return ClassName(key, cx->names()); } } // namespace js #endif /* jsatominlines_h */
--- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -82,27 +82,37 @@ js::AutoCycleDetector::~AutoCycleDetecto void js::TraceCycleDetectionSet(JSTracer* trc, AutoCycleDetector::Set& set) { for (AutoCycleDetector::Set::Enum e(set); !e.empty(); e.popFront()) TraceRoot(trc, &e.mutableFront(), "cycle detector table entry"); } -JSContext* -js::NewContext(JSRuntime* rt) +bool +JSContext::init(uint32_t maxBytes, uint32_t maxNurseryBytes) { - MOZ_ASSERT(!rt->maybeContextFromMainThread()); + if (!JSRuntime::init(maxBytes, maxNurseryBytes)) + return false; - JS_AbortIfWrongThread(rt); + return true; +} - JSContext* cx = js_new<JSContext>(rt); +JSContext* +js::NewContext(uint32_t maxBytes, uint32_t maxNurseryBytes, JSRuntime* parentRuntime) +{ + JSContext* cx = js_new<JSContext>(parentRuntime); if (!cx) return nullptr; + if (!cx->init(maxBytes, maxNurseryBytes)) { + js_delete(cx); + return nullptr; + } + return cx; } void js::DestroyContext(JSContext* cx) { JSRuntime* rt = cx->runtime(); JS_AbortIfWrongThread(rt); @@ -853,38 +863,39 @@ ExclusiveContext::recoverFromOutOfMemory } return; } // Keep in sync with addPendingOutOfMemory. if (ParseTask* task = helperThread()->parseTask()) task->outOfMemory = false; } -JSContext::JSContext(JSRuntime* rt) - : ExclusiveContext(rt, &rt->mainThread, Context_JS), +JSContext::JSContext(JSRuntime* parentRuntime) + : ExclusiveContext(this, &this->JSRuntime::mainThread, Context_JS), + JSRuntime(this, parentRuntime), throwing(false), unwrappedException_(this), overRecursed_(false), propagatingForcedReturn_(false), liveVolatileJitFrameIterators_(nullptr), reportGranularity(JS_DEFAULT_JITREPORT_GRANULARITY), resolvingList(nullptr), generatingError(false), cycleDetectorSet(this), - data(nullptr), - data2(nullptr), outstandingRequests(0), jitIsBroken(false) { MOZ_ASSERT(static_cast<ContextFriendFields*>(this) == ContextFriendFields::get(this)); } JSContext::~JSContext() { + destroyRuntime(); + /* Free the stuff hanging off of cx. */ MOZ_ASSERT(!resolvingList); } bool JSContext::getPendingException(MutableHandleValue rval) { MOZ_ASSERT(throwing); @@ -1006,32 +1017,31 @@ IsJITBrokenHere() void JSContext::updateJITEnabled() { jitIsBroken = IsJITBrokenHere(); } size_t -JSContext::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const +JSContext::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { /* * There are other JSContext members that could be measured; the following * ones have been found by DMD to be worth measuring. More stuff may be * added later. */ - return mallocSizeOf(this) + cycleDetectorSet.sizeOfExcludingThis(mallocSizeOf); + return cycleDetectorSet.sizeOfExcludingThis(mallocSizeOf); } void JSContext::mark(JSTracer* trc) { - /* Stack frames and slots are traced by StackSpace::mark. */ - - TraceCycleDetectionSet(trc, cycleDetectorSet); + if (cycleDetectorSet.initialized()) + TraceCycleDetectionSet(trc, cycleDetectorSet); if (compartment_) compartment_->mark(); } void* ExclusiveContext::stackLimitAddressForJitCode(StackKind kind) {
--- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -290,21 +290,39 @@ class ExclusiveContext : public ContextF void addPendingOverRecursed(); void addPendingOutOfMemory(); }; void ReportOverRecursed(JSContext* cx, unsigned errorNumber); } /* namespace js */ -struct JSContext : public js::ExclusiveContext +struct JSContext : public js::ExclusiveContext, + public JSRuntime { - explicit JSContext(JSRuntime* rt); + explicit JSContext(JSRuntime* parentRuntime); ~JSContext(); + bool init(uint32_t maxBytes, uint32_t maxNurseryBytes); + + // For names that exist in both ExclusiveContext and JSRuntime, pick the + // ExclusiveContext version. + using ExclusiveContext::atomsCompartment; + using ExclusiveContext::buildIdOp; + using ExclusiveContext::emptyString; + using ExclusiveContext::jitSupportsSimd; + using ExclusiveContext::make_pod_array; + using ExclusiveContext::make_unique; + using ExclusiveContext::new_; + using ExclusiveContext::permanentAtoms; + using ExclusiveContext::pod_calloc; + using ExclusiveContext::pod_malloc; + using ExclusiveContext::staticStrings; + using ExclusiveContext::wellKnownSymbols; + JSRuntime* runtime() const { return runtime_; } js::PerThreadData& mainThread() const { return runtime()->mainThread; } static size_t offsetOfRuntime() { return offsetof(JSContext, runtime_); } static size_t offsetOfCompartment() { return offsetof(JSContext, compartment_); @@ -338,20 +356,16 @@ struct JSContext : public js::ExclusiveC js::AutoResolving* resolvingList; /* True if generating an error, to prevent runaway recursion. */ bool generatingError; /* State for object and array toSource conversion. */ js::AutoCycleDetector::Set cycleDetectorSet; - /* Client opaque pointers. */ - void* data; - void* data2; - public: /* * Return: * - The newest scripted frame's version, if there is such a frame. * - The version from the compartment. * - The default version. * @@ -433,17 +447,17 @@ struct JSContext : public js::ExclusiveC void clearPropagatingForcedReturn() { propagatingForcedReturn_ = false; } /* * See JS_SetTrustedPrincipals in jsapi.h. * Note: !cx->compartment is treated as trusted. */ inline bool runningWithTrustedPrincipals() const; - JS_FRIEND_API(size_t) sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; + JS_FRIEND_API(size_t) sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const; void mark(JSTracer* trc); private: /* * The allocation code calls the function to indicate either OOM failure * when p is null or that a memory pressure counter has reached some * threshold when p is not null. The function takes the pointer and not @@ -490,17 +504,17 @@ struct MOZ_RAII AutoResolving { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; /* * Create and destroy functions for JSContext, which is manually allocated * and exclusively owned. */ extern JSContext* -NewContext(JSRuntime* rt); +NewContext(uint32_t maxBytes, uint32_t maxNurseryBytes, JSRuntime* parentRuntime); extern void DestroyContext(JSContext* cx); enum ErrorArgumentsType { ArgumentsAreUnicode, ArgumentsAreASCII }; @@ -716,16 +730,20 @@ class MOZ_RAII AutoLockForExclusiveAcces explicit AutoLockForExclusiveAccess(ExclusiveContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; init(cx->runtime_); } explicit AutoLockForExclusiveAccess(JSRuntime* rt MOZ_GUARD_OBJECT_NOTIFIER_PARAM) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; init(rt); } + explicit AutoLockForExclusiveAccess(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) { + MOZ_GUARD_OBJECT_NOTIFIER_INIT; + init(cx->runtime()); + } ~AutoLockForExclusiveAccess() { if (runtime->numExclusiveThreads) { #ifdef DEBUG MOZ_ASSERT(runtime->exclusiveAccessOwner == PR_GetCurrentThread()); runtime->exclusiveAccessOwner = nullptr; #endif runtime->exclusiveAccessLock.unlock(); } else {
--- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -25,24 +25,16 @@ namespace js { class CompartmentChecker { JSCompartment* compartment; public: explicit CompartmentChecker(ExclusiveContext* cx) : compartment(cx->compartment()) { -#ifdef DEBUG - // In debug builds, make sure the embedder passed the cx it claimed it - // was going to use. - JSContext* activeContext = nullptr; - if (cx->isJSContext()) - activeContext = cx->asJSContext()->runtime()->activeContext; - MOZ_ASSERT_IF(activeContext, cx == activeContext); -#endif } /* * Set a breakpoint here (break js::CompartmentChecker::fail) to debug * compartment mismatches. */ static void fail(JSCompartment* c1, JSCompartment* c2) { printf("*** Compartment mismatch %p vs. %p\n", (void*) c1, (void*) c2);
--- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -517,17 +517,17 @@ js::GetErrorTypeName(JSRuntime* rt, int1 * is prepended before "uncaught exception: " */ if (exnType < 0 || exnType >= JSEXN_LIMIT || exnType == JSEXN_INTERNALERR || exnType == JSEXN_WARN) { return nullptr; } JSProtoKey key = GetExceptionProtoKey(JSExnType(exnType)); - return ClassName(key, rt); + return ClassName(key, rt->contextFromMainThread()); } void js::ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp, JSErrorCallback callback, void* userRef) { MOZ_ASSERT(reportp); MOZ_ASSERT(!JSREPORT_IS_WARNING(reportp->flags));
--- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -1251,24 +1251,16 @@ js::PrepareScriptEnvironmentAndInvoke(JS } JS_FRIEND_API(void) js::SetScriptEnvironmentPreparer(JSRuntime* rt, ScriptEnvironmentPreparer* preparer) { rt->scriptEnvironmentPreparer = preparer; } -#ifdef DEBUG -JS_FRIEND_API(void) -js::Debug_SetActiveJSContext(JSRuntime* rt, JSContext* cx) -{ - rt->activeContext = cx; -} -#endif - JS_FRIEND_API(void) js::SetCTypesActivityCallback(JSRuntime* rt, CTypesActivityCallback cb) { rt->ctypesActivityCallback = cb; } js::AutoCTypesActivityCallback::AutoCTypesActivityCallback(JSContext* cx, js::CTypesActivityType beginType,
--- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -2686,30 +2686,16 @@ struct ScriptEnvironmentPreparer { extern JS_FRIEND_API(void) PrepareScriptEnvironmentAndInvoke(JSContext* cx, JS::HandleObject scope, ScriptEnvironmentPreparer::Closure& closure); JS_FRIEND_API(void) SetScriptEnvironmentPreparer(JSRuntime* rt, ScriptEnvironmentPreparer* preparer); -/** - * To help embedders enforce their invariants, we allow them to specify in - * advance which JSContext should be passed to JSAPI calls. If this is set - * to a non-null value, the assertSameCompartment machinery does double- - * duty (in debug builds) to verify that it matches the cx being used. - */ -#ifdef DEBUG -JS_FRIEND_API(void) -Debug_SetActiveJSContext(JSRuntime* rt, JSContext* cx); -#else -inline void -Debug_SetActiveJSContext(JSRuntime* rt, JSContext* cx) {} -#endif - enum CTypesActivityType { CTYPES_CALL_BEGIN, CTYPES_CALL_END, CTYPES_CALLBACK_BEGIN, CTYPES_CALLBACK_END }; typedef void
--- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -6991,18 +6991,18 @@ AutoSuppressGC::AutoSuppressGC(Exclusive } AutoSuppressGC::AutoSuppressGC(JSCompartment* comp) : suppressGC_(comp->runtimeFromMainThread()->mainThread.suppressGC) { suppressGC_++; } -AutoSuppressGC::AutoSuppressGC(JSRuntime* rt) - : suppressGC_(rt->mainThread.suppressGC) +AutoSuppressGC::AutoSuppressGC(JSContext* cx) + : suppressGC_(cx->mainThread().suppressGC) { suppressGC_++; } bool js::UninlinedIsInsideNursery(const gc::Cell* cell) { return IsInsideNursery(cell);
--- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -1271,17 +1271,17 @@ MaybeVerifyBarriers(JSContext* cx, bool */ class MOZ_RAII JS_HAZ_GC_SUPPRESSED AutoSuppressGC { int32_t& suppressGC_; public: explicit AutoSuppressGC(ExclusiveContext* cx); explicit AutoSuppressGC(JSCompartment* comp); - explicit AutoSuppressGC(JSRuntime* rt); + explicit AutoSuppressGC(JSContext* cx); ~AutoSuppressGC() { suppressGC_--; } }; // A singly linked list of zones.
--- a/js/src/tests/browser.js +++ b/js/src/tests/browser.js @@ -1,13 +1,58 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// NOTE: If you're adding new test harness functionality to this file -- first, +// should you at all? Most stuff is better in specific tests, or in +// nested shell.js/browser.js. Second, can you instead add it to +// shell.js? Our goal is to unify these two files for readability, and +// the plan is to empty out this file into that one over time. Third, +// supposing you must add to this file, please add it to this IIFE for +// better modularity/resilience against tests that must do particularly +// bizarre things that might break the harness. + +(function(global) { + /**************************** + * UTILITY FUNCTION EXPORTS * + ****************************/ + + var newGlobal = global.newGlobal; + if (typeof newGlobal !== "function") { + newGlobal = function newGlobal() { + var iframe = global.document.createElement("iframe"); + global.document.documentElement.appendChild(iframe); + var win = iframe.contentWindow; + iframe.remove(); + // Shim in "evaluate" + win.evaluate = win.eval; + return win; + }; + global.newGlobal = newGlobal; + } + + // This function is *only* used in this file! Ultimately it should only be + // used by other exports in this IIFE, but for now just export it so that + // functions not exported within this IIFE (but still in this file) can use + // it. + function DocumentWrite(s) { + try { + var msgDiv = global.document.createElement('div'); + msgDiv.innerHTML = s; + global.document.body.appendChild(msgDiv); + } catch (e) { + global.document.write(s + '<br>\n'); + } + } + global.DocumentWrite = DocumentWrite; +})(this); + + var gPageCompleted; var GLOBAL = this + ''; // Variables local to jstests harness. var jstestsTestPassesUnlessItThrows = false; var jstestsRestoreFunction; var jstestsOptions; @@ -43,31 +88,16 @@ function htmlesc(str) { return '<'; if (str == '>') return '>'; if (str == '&') return '&'; return str; } -function DocumentWrite(s) -{ - try - { - var msgDiv = document.createElement('div'); - msgDiv.innerHTML = s; - document.body.appendChild(msgDiv); - msgDiv = null; - } - catch(excp) - { - document.write(s + '<br>\n'); - } -} - function print() { var s = 'TEST-INFO | '; var a; for (var i = 0; i < arguments.length; i++) { a = arguments[i]; s += String(a) + ' '; } @@ -246,20 +276,16 @@ function optionsInit() { } } function gczeal(z) { SpecialPowers.setGCZeal(z); } -function jit(on) -{ -} - function jsTestDriverBrowserInit() { if (typeof dump != 'function') { dump = print; } @@ -352,28 +378,16 @@ function jsTestDriverBrowserInit() gTestPath = properties.test; if (properties.gczeal) { gczeal(Number(properties.gczeal)); } - /* - * since the default setting of jit changed from false to true - * in http://hg.mozilla.org/tracemonkey/rev/685e00e68be9 - * bisections which depend upon jit settings can be thrown off. - * default jit(false) when not running jsreftests to make bisections - * depending upon jit settings consistent over time. This is not needed - * in shell tests as the default jit setting has not changed there. - */ - - if (properties.jit || !document.location.href.match(/jsreftest.html/)) - jit(properties.jit); - var testpathparts = properties.test.split(/\//); if (testpathparts.length < 2) { // must have at least suitepath/testcase.js return; } @@ -555,22 +569,12 @@ function closeDialog() else { // alerts inside of reftest framework are not XULDocument dialogs. subject.close(); } } } -function newGlobal() { - var iframe = document.createElement("iframe"); - document.documentElement.appendChild(iframe); - var win = iframe.contentWindow; - iframe.remove(); - // Shim in "evaluate" - win.evaluate = win.eval; - return win; -} - registerDialogCloser(); window.addEventListener('unload', unregisterDialogCloser, true); jsTestDriverBrowserInit();
--- a/js/src/tests/ecma_3/RegExp/regress-465862.js +++ b/js/src/tests/ecma_3/RegExp/regress-465862.js @@ -19,17 +19,16 @@ var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); // Note: we must call the RegExp constructor here instead of using // literals. Otherwise, because the regexps are compiled at parse // time, they will not be compiled to native code and we will not // actually be testing jitted regexps. -jit(true); status = inSection(1); string = '@'; pattern = new RegExp('@', 'i'); actualmatch = string.match(pattern); expectedmatch = Array(string); addThis(); @@ -52,17 +51,16 @@ string = '`'; pattern = new RegExp('@', 'i'); print(string + ' ' + pattern); actualmatch = string.match(pattern); print('z ' + actualmatch); print('`'.match(/@/i)); expectedmatch = null; addThis(); -jit(false); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusmessages[i] = status;
--- a/js/src/tests/ecma_5/RegExp/regexp-space-character-class.js +++ b/js/src/tests/ecma_5/RegExp/regexp-space-character-class.js @@ -33,15 +33,13 @@ var non_space_chars = [ "\u200b", "\u200 var chars = [].concat(space_chars, non_space_chars); var is_space = [].concat(space_chars.map(function(ch) { return true; }), non_space_chars.map(function(ch) { return false; })); var expect = is_space.join(','); var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(','); reportCompare(expect, actual, summary); -jit(true); var actual = chars.map(function(ch) { return /\s/.test(ch); }).join(','); reportCompare(expect, actual, summary); -jit(false); exitFunc ('test'); }
new file mode 100644 --- /dev/null +++ b/js/src/tests/ecma_6/Expressions/computed-property-side-effects.js @@ -0,0 +1,35 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 1199695; +var summary = + "Computed property names must be considered as always effectful even when " + + "the name expression isn't effectful, because calling ToPropertyKey on " + + "some non-effectful expressions has user-modifiable behavior"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +RegExp.prototype.toString = () => { throw 42; }; +assertThrowsValue(function() { + ({ [/regex/]: 0 }); // ToPropertyKey(/regex/) throws 42 +}, 42); + +function Q() { + ({ [new.target]: 0 }); // new.target will be Q, ToPropertyKey(Q) throws 17 +} +Q.toString = () => { throw 17; }; +assertThrowsValue(function() { + new Q; +}, 17); + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete");
--- a/js/src/tests/ecma_6/RegExp/unicode-ignoreCase-escape.js +++ b/js/src/tests/ecma_6/RegExp/unicode-ignoreCase-escape.js @@ -1,39 +1,71 @@ var BUGNUMBER = 1135377; var summary = "Implement RegExp unicode flag -- ignoreCase flag with character class escape."; +// \W doesn't match S or K from the change in +// https://github.com/tc39/ecma262/pull/525 +// (bug 1281739) + print(BUGNUMBER + ": " + summary); // LATIN SMALL LETTER LONG S assertEqArray(/\w/iu.exec("S"), ["S"]); assertEqArray(/\w/iu.exec("s"), ["s"]); assertEqArray(/\w/iu.exec("\u017F"), ["\u017F"]); -assertEqArray(/\W/iu.exec("S"), +assertEqArray(/[^\W]/iu.exec("S"), ["S"]); -assertEqArray(/\W/iu.exec("s"), +assertEqArray(/[^\W]/iu.exec("s"), ["s"]); -assertEqArray(/\W/iu.exec("\u017F"), +assertEqArray(/[^\W]/iu.exec("\u017F"), ["\u017F"]); +assertEq(/\W/iu.exec("S"), + null); +assertEq(/\W/iu.exec("s"), + null); +assertEq(/\W/iu.exec("\u017F"), + null); + +assertEq(/[^\w]/iu.exec("S"), + null); +assertEq(/[^\w]/iu.exec("s"), + null); +assertEq(/[^\w]/iu.exec("\u017F"), + null); + // KELVIN SIGN assertEqArray(/\w/iu.exec("k"), ["k"]); assertEqArray(/\w/iu.exec("k"), ["k"]); assertEqArray(/\w/iu.exec("\u212A"), ["\u212A"]); -assertEqArray(/\W/iu.exec("k"), +assertEqArray(/[^\W]/iu.exec("k"), + ["k"]); +assertEqArray(/[^\W]/iu.exec("k"), ["k"]); -assertEqArray(/\W/iu.exec("k"), - ["k"]); -assertEqArray(/\W/iu.exec("\u212A"), +assertEqArray(/[^\W]/iu.exec("\u212A"), ["\u212A"]); +assertEq(/\W/iu.exec("k"), + null); +assertEq(/\W/iu.exec("k"), + null); +assertEq(/\W/iu.exec("\u212A"), + null); + +assertEq(/[^\w]/iu.exec("k"), + null); +assertEq(/[^\w]/iu.exec("k"), + null); +assertEq(/[^\w]/iu.exec("\u212A"), + null); + if (typeof reportCompare === "function") reportCompare(true, true);
--- a/js/src/tests/js1_5/Array/regress-456845.js +++ b/js/src/tests/js1_5/Array/regress-456845.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); try { var chars = '0123456789abcdef'; var size = 1000; var mult = 100; var arr = []; @@ -35,20 +34,18 @@ function test() var popArrs = []; for (var i=0; i<mult; i++) { popArrs.push(arr.slice()); } for(var a=0;a<mult;a++) { var x; while (x = popArrs[a].pop()) { } } - jit(false); } catch(ex) { - jit(false); actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Array/regress-474529.js +++ b/js/src/tests/js1_5/Array/regress-474529.js @@ -39,19 +39,17 @@ function test() reportResults((1 << i) + 1, N, timeit(N, "[" + zeros + " 0 ]"), timeit(N, "new Array(" + zeros + " 0)"), timeit(N, "Array(" + zeros + " 0)")); zeros += zeros; } } - jit(true); gc(); print("Size\t\Rep.\t\Literal\tnew Arr\tArray()"); print("====\t=====\t=======\t=======\t======="); main(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-440926.js +++ b/js/src/tests/js1_5/Regress/regress-440926.js @@ -17,17 +17,15 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); actual += 'iI\u0130'.replace(/[\u0130]/gi, '#'); actual += ',' + 'iI\u0130'.replace(/\u0130/gi, '#'); - jit(true); actual += ';' + 'iI\u0130'.replace(/[\u0130]/gi, '#'); actual += ',' + 'iI\u0130'.replace(/\u0130/gi, '#'); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-449627.js +++ b/js/src/tests/js1_5/Regress/regress-449627.js @@ -9,17 +9,16 @@ var BUGNUMBER = 449627; var summary = 'Crash with JIT in js_FillPropertyCache'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); /************************ BROWSER DETECT (http://www.quirksmode.org/js/detect.html) ************************/ if (typeof navigator == 'undefined') { navigator = { userAgent: "Firefox", vendor: "Mozilla", @@ -106,11 +105,10 @@ var BrowserDetect = { { string:navigator.platform,subString:"Linux",identity:"Linux" } ] }; BrowserDetect.init(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-449666.js +++ b/js/src/tests/js1_5/Regress/regress-449666.js @@ -19,17 +19,16 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var global; - jit(true); if (typeof window == 'undefined') { global = this; } else { global = window; } @@ -54,14 +53,13 @@ function test() } function T(a){return "hmm"} k("g.l.loaded",T); })(); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-450369.js +++ b/js/src/tests/js1_5/Regress/regress-450369.js @@ -4,17 +4,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 450369; var summary = 'Crash with JIT and json2.js'; var actual = 'No Crash'; var expect = 'No Crash'; -jit(true); /* json2.js 2007-11-06 Public Domain See http://www.JSON.org/js.html @@ -275,17 +274,16 @@ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { }(); } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- -jit(false); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary);
--- a/js/src/tests/js1_5/Regress/regress-450833.js +++ b/js/src/tests/js1_5/Regress/regress-450833.js @@ -17,33 +17,29 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 100; - jit(true); function f(i) { for (var m = 0; m < 20; ++m) for (var n = 0; n < 100; n += i) ; return n; } print(actual = f(1)); - jit(false); reportCompare(expect, actual, summary); - jit(true); print(actual = f(.5)); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-451322.js +++ b/js/src/tests/js1_5/Regress/regress-451322.js @@ -16,24 +16,22 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function f() { for (var i = 0; i < 200000; i++) { var m = new Function("var k = 0; for (var j = 0; j < 5; j++) { k += j * 2 + 8 / (j+3) * k} return k;"); m(); } } f(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-451946.js +++ b/js/src/tests/js1_5/Regress/regress-451946.js @@ -17,18 +17,16 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print('This test is only valid with SELinux targetted policy with exeheap protection'); - jit(true); var i; for (i = 0; i < 2000000; i++) {;} - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452008.js +++ b/js/src/tests/js1_5/Regress/regress-452008.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); // regression test for Bug 452008 - TM: SRP in Clipperz crypto library fails when JIT (TraceMonkey) is enabled. var x = [9385, 32112, 25383, 16317, 30138, 14565, 17812, 24500, 2719, 30174, 3546, 9096, 15352, 19120, 20648, 14334, 7426, 0, 0, 0]; var n = [27875, 25925, 30422, 12227, 27798, 32170, 10873, 21748, 30629, 26296, 20697, 5125, 4815, 2221, 14392, 23369, 5560, 2, 0, 0]; var np = 18229; var expected = [18770, 31456, 17999, 32635, 27508, 29131, 2856, 16233, 5439, 27580, 7093, 18192, 30804, 5472, 8529, 28649, 14852, 0, 0, 0]; @@ -137,17 +136,16 @@ function test() var passed = expected.length == x.length; for (var i = 0; i < expected.length; i++) { if (passed) passed = expected[i] == x[i]; } print(passed); - jit(false); expect = true; actual = passed; reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452170.js +++ b/js/src/tests/js1_5/Regress/regress-452170.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 4; ++j) { (-0).toString(); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452333.js +++ b/js/src/tests/js1_5/Regress/regress-452333.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var j = 0; j < 5; ++j) { (typeof 3/0); } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452336.js +++ b/js/src/tests/js1_5/Regress/regress-452336.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 4; ++j) { [1].x++; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452495.js +++ b/js/src/tests/js1_5/Regress/regress-452495.js @@ -7,15 +7,13 @@ var BUGNUMBER = 452495; var summary = 'Do not crash with JIT: @ TraceRecorder::getThis'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); for (var j = 0; j < 4; ++j) { try { new 1(this); } catch(e) { } } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-452573-01.js +++ b/js/src/tests/js1_5/Regress/regress-452573-01.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for(var j=0;j<5;++j) typeof void /x/; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452573-02.js +++ b/js/src/tests/js1_5/Regress/regress-452573-02.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for(var j=0;j<5;++j) typeof void 1; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452713.js +++ b/js/src/tests/js1_5/Regress/regress-452713.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 5; ++j) { if (''[-1]) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452724-01.js +++ b/js/src/tests/js1_5/Regress/regress-452724-01.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var j=0;j<5;++j) { (0/0) in this; } })() - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452724-02.js +++ b/js/src/tests/js1_5/Regress/regress-452724-02.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j=0;j<5;++j) { (0/0) in this; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452853.js +++ b/js/src/tests/js1_5/Regress/regress-452853.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j=0; j<4; ++j) { var a = ["", ""]; a[0] * a[1]; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452884-01.js +++ b/js/src/tests/js1_5/Regress/regress-452884-01.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j=0;j<5;++j) { switch(1.1) { case NaN: case 2: } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-452884-02.js +++ b/js/src/tests/js1_5/Regress/regress-452884-02.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j=0;j<5;++j) { switch(1.1) { case 2: case NaN: } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-453173.js +++ b/js/src/tests/js1_5/Regress/regress-453173.js @@ -16,18 +16,16 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var i; - jit(true); for(i=0;i<4;++i) [,]; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-453397.js +++ b/js/src/tests/js1_5/Regress/regress-453397.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function computeEscapeSpeed(real) { for (var j = 1; j < 4; ++j) { if (real > 2) { } } } @@ -35,14 +34,13 @@ function test() for (var i = 0, curReal = -2.1; i < numCols; ++i, curReal += realStep) { for (var j = 0; j < numRows; ++j) { computeEscapeSpeed(curReal); } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-453701.js +++ b/js/src/tests/js1_5/Regress/regress-453701.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var j = 0; j < 5; ++j) { (1).hasOwnProperty(""); } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-453747.js +++ b/js/src/tests/js1_5/Regress/regress-453747.js @@ -14,26 +14,24 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function(){ var a = []; var s = 10; for (var i = 0; i < s; ++i) a[i] = 1; a[4*s-1] = 2; for (var i = s+1; i < s+4; ++i) typeof a[i]; })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-454682.js +++ b/js/src/tests/js1_5/Regress/regress-454682.js @@ -15,21 +15,19 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var a = new String("foo"); for (i = 0; i < 300; i++) { a.match(/bar/); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-454981.js +++ b/js/src/tests/js1_5/Regress/regress-454981.js @@ -15,22 +15,20 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function f1() { function f0() { return arguments[0]; } for (var i = 0; i < 4; i++) f0('a'); } f1(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-455605.js +++ b/js/src/tests/js1_5/Regress/regress-455605.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 4; ++j) { switch(0/0) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-455748.js +++ b/js/src/tests/js1_5/Regress/regress-455748.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 5; ++j) { if([1][-0]) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-455758-01.js +++ b/js/src/tests/js1_5/Regress/regress-455758-01.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var j = 0; j < 5; ++j) { var t = 3 % (-0); } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-455758-02.js +++ b/js/src/tests/js1_5/Regress/regress-455758-02.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var j = 0; j < 5; ++j) { 3 % (-0); } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-456470.js +++ b/js/src/tests/js1_5/Regress/regress-456470.js @@ -15,26 +15,24 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function x() { function a() { return true; } return a(); } for (var i = 0; i < 10; ++i) x(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-456477-01.js +++ b/js/src/tests/js1_5/Regress/regress-456477-01.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 5; ++j) { var t = (0 / 0) % (-1); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-456477-02.js +++ b/js/src/tests/js1_5/Regress/regress-456477-02.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var j = 0; j < 5; ++j) { (0 / 0) % (-1); } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-456494.js +++ b/js/src/tests/js1_5/Regress/regress-456494.js @@ -15,31 +15,29 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function k(s) { } function f() { for (i = 0; i < 10; i++) { k.apply(this, arguments); } } f(1); - jit(false); if (typeof this.tracemonkey != 'undefined') { for (var p in this.tracemonkey) { print(p + ':' + this.tracemonkey[p]); } }
--- a/js/src/tests/js1_5/Regress/regress-456540-01.js +++ b/js/src/tests/js1_5/Regress/regress-456540-01.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 5; ++j) { var t = ((-1) % "" ); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-456540-02.js +++ b/js/src/tests/js1_5/Regress/regress-456540-02.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var j = 0; j < 5; ++j) { ((-1) % "" ); } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-457065-03.js +++ b/js/src/tests/js1_5/Regress/regress-457065-03.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { new function (){ for (var x = 0; x < 3; ++x){} }; })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-457456.js +++ b/js/src/tests/js1_5/Regress/regress-457456.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 4; ++j) { if (undefined < false) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-457778.js +++ b/js/src/tests/js1_5/Regress/regress-457778.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 4; ++j) { if (undefined < false) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-458851.js +++ b/js/src/tests/js1_5/Regress/regress-458851.js @@ -7,26 +7,24 @@ var BUGNUMBER = 458851; var summary = 'TM: for-in loops should not skip every other value sometimes'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function f() { var a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]; var x = 0; for (var i in a) { i = parseInt(i); x++; } print(actual = x); } expect = 16; f(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-459085.js +++ b/js/src/tests/js1_5/Regress/regress-459085.js @@ -17,20 +17,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var m = new Number(3); function foo() { for (var i=0; i<20;i++) m.toString(); } foo(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-459628.js +++ b/js/src/tests/js1_5/Regress/regress-459628.js @@ -15,22 +15,20 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function() { for (var odjoff = 0; odjoff < 4; ++odjoff) { new Date()[0] = 3; } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-460024.js +++ b/js/src/tests/js1_5/Regress/regress-460024.js @@ -18,24 +18,22 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'PASS'; actual = 'FAIL'; - jit(true); var js = 'Function.prototype.inherits = function(a) {' + ' actual = "PASS";' + '};' + 'function f() { }' + 'f.inherits();'; function doeval(callback) { callback(js) }; doeval(eval); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-460117.js +++ b/js/src/tests/js1_5/Regress/regress-460117.js @@ -30,18 +30,16 @@ function test() } } }; t({ bar: 123, baz: 123, quux: 123 }, 'bar baz quux'); reportCompare(expect, actual, summary + ' : nonjit'); - jit(true); t({ bar: 123, baz: 123, quux: 123 }, 'bar baz quux'); - jit(false); reportCompare(expect, actual, summary + ' : jit'); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-461307.js +++ b/js/src/tests/js1_5/Regress/regress-461307.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); print(function() { for(/x/[''] in []) { } }); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-461723.js +++ b/js/src/tests/js1_5/Regress/regress-461723.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 30; ++j) { (0 + void 0) && 0; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-462989.js +++ b/js/src/tests/js1_5/Regress/regress-462989.js @@ -7,27 +7,25 @@ var BUGNUMBER = 462989; var summary = 'Do not assert: need a way to EOT now, since this is trace end'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function a() { "".split(";"); this.v = true; } function b() { var z = { t: function() { for (var i = 0; i < 5; i++) { a(); } } }; z.t(); } b(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-463259.js +++ b/js/src/tests/js1_5/Regress/regress-463259.js @@ -7,23 +7,21 @@ var BUGNUMBER = 463259; var summary = 'Do not assert: VALUE_IS_FUNCTION(cx, fval)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); try { (function(){ eval("(function(){ for (var j=0;j<4;++j) if (j==3) undefined(); })();"); })(); } catch(ex) { } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-463782.js +++ b/js/src/tests/js1_5/Regress/regress-463782.js @@ -7,17 +7,16 @@ var BUGNUMBER = 463782; var summary = 'Do not assert: "need a way to EOT now, since this is trace end": 0'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function dateCheck() { return true; } function dateToString() { if (!this.dtsReturnValue) this.dtsReturnValue = "200811080616"; @@ -57,12 +56,11 @@ function placeAd2() { } }; adClasses[""].templateCheck(); } placeAd2(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-465013.js +++ b/js/src/tests/js1_5/Regress/regress-465013.js @@ -17,25 +17,23 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'bgcolor="dummy" quality="dummy" allowScriptAccess="dummy" '; - jit(true); print((function(x) { var ja = ""; var ka = {bgcolor:"#FFFFFF", quality:"high", allowScriptAccess:"always"}; for (var la in ka) { ja +=[la] + "=\"" + x/*ka[la]*/ + "\" "; } return actual = ja; })("dummy")); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465132.js +++ b/js/src/tests/js1_5/Regress/regress-465132.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var constants = ['E', 'LN10', 'LN2', 'LOG2E', 'LOG10E', 'PI', 'SQRT1_2', 'SQRT2']; for (var j = 0; j < constants.length; j++) { expect = Math[constants[j]]; for(i=0;i<9;++i) @@ -34,12 +33,11 @@ function test() for(i=0;i<9;++i) eval('++Math.' + constants[j]); actual = Math[constants[j]]; reportCompare(expect, actual, summary + ' Math.' + constants[j]); } - jit(false); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465133.js +++ b/js/src/tests/js1_5/Regress/regress-465133.js @@ -18,18 +18,16 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'false,false,false,false,false,'; actual = ''; - jit(true); for (var i=0;i<5;++i) actual += ({} < {}) + ','; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465135.js +++ b/js/src/tests/js1_5/Regress/regress-465135.js @@ -18,18 +18,16 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '2,2,2,2,2,'; actual = ''; - jit(true); for (var i=0;i<5;++i) actual += (true << true) + ','; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465136.js +++ b/js/src/tests/js1_5/Regress/regress-465136.js @@ -18,18 +18,16 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'true,true,true,true,true,'; actual = ''; - jit(true); for (var i=0;i<5;++i) actual += (false == '') + ','; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465137.js +++ b/js/src/tests/js1_5/Regress/regress-465137.js @@ -18,18 +18,16 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'falsy,falsy,falsy,falsy,falsy,'; actual = ''; - jit(true); for (var i=0;i<5;++i) actual += (!(NaN) ? "falsy" : "truthy") + ','; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465262.js +++ b/js/src/tests/js1_5/Regress/regress-465262.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); expect = 'true,true,true,true,true,'; for(j=0;j<5;++j) print(actual += "" + (3 > null) + ',') - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465272.js +++ b/js/src/tests/js1_5/Regress/regress-465272.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); expect = '3,3,3,3,3,'; for (j=0;j<5;++j) print(actual += "" + ((5) - 2) + ','); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-465366.js +++ b/js/src/tests/js1_5/Regress/regress-465366.js @@ -15,27 +15,25 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function f() { var k = 1; for (var n = 0; n < 2; n++) { k = (k * 10); } return k; } f(); print(f()); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-466262.js +++ b/js/src/tests/js1_5/Regress/regress-466262.js @@ -15,22 +15,20 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var e = 1; for (var d = 0; d < 3; ++d) { if (d == 2) { e = ""; } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-466747.js +++ b/js/src/tests/js1_5/Regress/regress-466747.js @@ -25,34 +25,32 @@ function test() { expect = actual = 'Test skipped: browser only'; reportCompare(expect, actual, summary); } else { gDelayTestDriverEnd = true; - jit(true); function newScriptWithLoop(m) { var ns = document.createElement("script"); var nt = document.createTextNode("for (var q = 0; q < " + m + "; ++q) { }"); ns.appendChild(nt); return ns; } function boom() { var div = document.createElement("div"); div.appendChild(newScriptWithLoop(7)); div.appendChild(newScriptWithLoop(1)); document.body.appendChild(div); - jit(false); reportCompare(expect, actual, summary); gDelayTestDriverEnd = false; jsTestDriverEnd(); } window.addEventListener('load', boom, false); }
--- a/js/src/tests/js1_5/Regress/regress-470061.js +++ b/js/src/tests/js1_5/Regress/regress-470061.js @@ -15,31 +15,29 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function x (w, z) { var h = 0; var q = 0; while (q < 300) { while (w) { } ++q; if (q % 4 == 1) { h = Math.ceil(z); } } } x(false, 40); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-475645-01.js +++ b/js/src/tests/js1_5/Regress/regress-475645-01.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); linkarr = new Array(); picarr = new Array(); textarr = new Array(); var f=161; var t=27; var pics = ""; var links = ""; @@ -36,14 +35,13 @@ function test() for(i=1;i<picarr.length;i++) { if(pics=="") pics = picarr[i]; else{ if(picarr[i].indexOf("jpg")==-1 && picarr[i].indexOf("JPG")==-1) picarr[i] = d; } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-475645-02.js +++ b/js/src/tests/js1_5/Regress/regress-475645-02.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); if (typeof window != 'undefined') { var q = (function () { }); window.addEventListener("load", q, false); window.onerror = q; arr = new Array(); pic = r = new Array; @@ -43,14 +42,13 @@ function test() } catch(ex) { } arr[i]=''; } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-476192.js +++ b/js/src/tests/js1_5/Regress/regress-476192.js @@ -15,26 +15,24 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var global; (function(){ var ad = {present: ""}; var params = ['present', 'a', 'present', 'a', 'present', 'a', 'present']; for (var j = 0; j < params.length; j++) { global = ad[params[j]]; } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-477733.js +++ b/js/src/tests/js1_5/Regress/regress-477733.js @@ -15,30 +15,28 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function g() { []; } try { d.d.d; } catch(e) { void (function(){}); } for (var o in [1, 2, 3]) { g(); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-477758.js +++ b/js/src/tests/js1_5/Regress/regress-477758.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function map(array, func) { var result = []; for(var i=0;i<array.length;i++) { result.push(func(array[i])); } return result; } @@ -41,12 +40,11 @@ function test() for (var i = 0; i < 4; i++) { actual = ''; run(); reportCompare(expect, actual, summary + ': ' + i); } - jit(false); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-478314.js +++ b/js/src/tests/js1_5/Regress/regress-478314.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var z = 0; z < 2; ++z) { switch(false & 1e-81) {} } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-480147.js +++ b/js/src/tests/js1_5/Regress/regress-480147.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var w = [/a/, /b/, /c/, {}]; for (var i = 0; i < w.length; ++i) "".replace(w[i], ""); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-480244.js +++ b/js/src/tests/js1_5/Regress/regress-480244.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function outer() { var v = 10.234; for (var i = 0; i < 0xff; ++i) { inner(v); } } @@ -40,14 +39,13 @@ function test() h++; } return h; } outer(); print("g=" + g + " h=" + h); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-481436.js +++ b/js/src/tests/js1_5/Regress/regress-481436.js @@ -8,17 +8,16 @@ var BUGNUMBER = 481436; var summary = 'TM: Do not crash @ FlushNativeStackFrame/JS_XDRNewMem'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function search(m, n) { if (m.name == n) return m; for (var i = 0; i < m.items.length; i++) if (m.items[i].type == 'M') search(m.items[i], n); } @@ -30,11 +29,10 @@ function crash() { root.items.push({name: 'tim', type: 'M', items: []}); search(root, 'x'); search(root, 'x'); } } crash(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-482421.js +++ b/js/src/tests/js1_5/Regress/regress-482421.js @@ -7,22 +7,20 @@ var BUGNUMBER = 482421; var summary = 'TM: Do not assert: vp >= StackBase(fp)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function f() { var x; var foo = "for (var z = 0; z < 2; ++z) { new Object(new String(this), x)}"; foo.replace(/\n/g, " "); eval(foo); } f(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/Regress/regress-482783.js +++ b/js/src/tests/js1_5/Regress/regress-482783.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); [].concat(); for (var x = 0; x < 3; ++x) { (null + [,,]); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-483103.js +++ b/js/src/tests/js1_5/Regress/regress-483103.js @@ -15,21 +15,19 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var t = new String(""); for (var j = 0; j < 3; ++j) { var e = t["-1"]; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/Regress/regress-501124.js +++ b/js/src/tests/js1_5/Regress/regress-501124.js @@ -15,31 +15,29 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var hexVal = "00000000000000000000000000000000DEADBABE"; var nblk = (((hexVal.length/2) + 8) >> 6) + 1; var blks = new Array(nblk * 16); for(var i = 0; i < nblk * 16; i++) blks[i] = 0; for(i = 0; i < hexVal.length; i++) { blks[i >> 3] |= ("0x"+hexVal.charAt(i)) << (28 - (i % 8) * 4); } expect = '0,0,0,0,-559039810,0,0,0,0,0,0,0,0,0,0,0'; actual = blks + ''; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-452168.js +++ b/js/src/tests/js1_5/extensions/regress-452168.js @@ -25,20 +25,18 @@ function test() expect = actual = 'Test requires gczeal, skipped.'; } else { // Enumerate the global once before we turn on gczeal, so we're not // trying to do all the enumerate hook object creation with a gc on // every object, because that makes tests time out. for (z in this); - jit(true); gczeal(2); var a, b; gczeal(2); (function() { for (var p in this) { } })(); gczeal(0); - jit(false); } reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-452178.js +++ b/js/src/tests/js1_5/extensions/regress-452178.js @@ -14,19 +14,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); Object.defineProperty(this, "q", { get: function(){}, enumerable: true, configurable: true }); for (var j = 0; j < 4; ++j) q = 1; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-452338.js +++ b/js/src/tests/js1_5/extensions/regress-452338.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 4; ++j) __count__ = 3; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-452565.js +++ b/js/src/tests/js1_5/extensions/regress-452565.js @@ -7,15 +7,13 @@ var BUGNUMBER = 452565; var summary = 'Do not assert with JIT: !(sprop->attrs & JSPROP_READONLY)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); var c = undefined; (function() { for (var j=0;j<5;++j) { c = 1; } })(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/extensions/regress-453249.js +++ b/js/src/tests/js1_5/extensions/regress-453249.js @@ -7,17 +7,15 @@ var BUGNUMBER = 453249; var summary = 'Do not assert with JIT: s0->isQuad()'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); this.__proto__.a = 3; for (var j = 0; j < 4; ++j) { [a]; } this.a = 3; for (var j = 0; j < 4; ++j) { [a]; } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/extensions/regress-455380.js +++ b/js/src/tests/js1_5/extensions/regress-455380.js @@ -9,17 +9,16 @@ var BUGNUMBER = 455380; var summary = 'Do not assert with JIT: !lhs->isQuad() && !rhs->isQuad()'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); const IS_TOKEN_ARRAY = [0, 0, 0, 0, 0, 0, 0, 0, // 0 0, 0, 0, 0, 0, 0, 0, 0, // 8 0, 0, 0, 0, 0, 0, 0, 0, // 16 0, 0, 0, 0, 0, 0, 0, 0, // 24 0, 1, 0, 1, 1, 1, 1, 1, // 32 @@ -52,11 +51,10 @@ normalizeFieldName: function(fieldName) } return fieldName.toLowerCase(); } }; headerUtils.normalizeFieldName("Host"); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/extensions/regress-455408.js +++ b/js/src/tests/js1_5/extensions/regress-455408.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 5; ++j) { if (({}).__proto__ = 1) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-455413.js +++ b/js/src/tests/js1_5/extensions/regress-455413.js @@ -12,15 +12,13 @@ var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); this.watch('x', Math.pow); (function() { for(var j=0;j<4;++j){x=1;} })(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/extensions/regress-465145.js +++ b/js/src/tests/js1_5/extensions/regress-465145.js @@ -7,20 +7,18 @@ var BUGNUMBER = 465145; var summary = 'Do not crash with watched defined setter'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); this.__defineSetter__("x", function(){}); this.watch("x", function(){}); y = this; for (var z = 0; z < 2; ++z) { x = y }; this.__defineSetter__("x", function(){}); for (var z = 0; z < 2; ++z) { x = y }; -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_5/extensions/regress-465276.js +++ b/js/src/tests/js1_5/extensions/regress-465276.js @@ -15,22 +15,20 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); expect = '[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]'; empty = []; out = []; for (var j=0;j<10;++j) { empty[42]; out.push((1 * (1)) | ""); } print(actual = uneval(out)); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-469625.js +++ b/js/src/tests/js1_5/extensions/regress-469625.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); [].__proto__[0] = 'a'; for (var j = 0; j < 3; ++j) [[, ]] = [,]; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-469761.js +++ b/js/src/tests/js1_5/extensions/regress-469761.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var o = { __proto__: function(){} }; for (var j = 0; j < 3; ++j) { try { o.call(3); } catch (e) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-472599.js +++ b/js/src/tests/js1_5/extensions/regress-472599.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var a = (function(){}).prototype; a.__proto__ = a.toString; for (var i = 0; i < 4; ++i) { try{ a.call({}); } catch(e) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-479487.js +++ b/js/src/tests/js1_5/extensions/regress-479487.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); Array.prototype[1] = 2; Array.prototype.__defineSetter__(32, function() { print("Hello from arbitrary JS");}); Array.prototype.__defineGetter__(32, function() { return 11; }); function f() { @@ -33,14 +32,13 @@ function test() for (var i = 0; i != 10; ++i) { a[1 << i] = 9999; } return a; } f(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-479551.js +++ b/js/src/tests/js1_5/extensions/regress-479551.js @@ -21,24 +21,22 @@ function test() printStatus (summary); if (typeof shapeOf != 'function') { print(expect = actual = 'Test skipped: requires shell'); } else { - jit(true); var o = {a:3, b:2}; shapeOf(o); var p = {}; p.a =3; p.b=2; shapeOf(p); - jit(false); } reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_5/extensions/regress-543839.js +++ b/js/src/tests/js1_5/extensions/regress-543839.js @@ -9,21 +9,19 @@ var BUGNUMBER = 543839; var summary = 'js_GetMutableScope caller must lock the object'; var actual; var expect = 1; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function test() { - jit(true); for (var i = 0; i != 100; ++i) var tmp = { a: 1 }; return 1; } if (typeof evalcx == 'undefined') { print('Skipping. This test requires evalcx.');
--- a/js/src/tests/js1_6/Regress/regress-475469.js +++ b/js/src/tests/js1_6/Regress/regress-475469.js @@ -19,17 +19,15 @@ function test() enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // print('Note this test originally required jit enabled with the environment '); // print('variable TRACEMONKEY=verbose defined. Note that the calls to enable '); // print('jit are necessary for the crash.'); - jit(true); [1,2,3].map(function(v, i, t) { return /a/gi.exec(v); }); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_6/Regress/regress-476655.js +++ b/js/src/tests/js1_6/Regress/regress-476655.js @@ -15,28 +15,26 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); try { eval( "(function (){ for (var y in this) {} })();" + "[''.watch(\"\", function(){}) for each (x in ['', '', eval, '', '']) if " + "(x)].map(Function)" ); } catch(ex) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_6/extensions/regress-455464-01.js +++ b/js/src/tests/js1_6/extensions/regress-455464-01.js @@ -8,15 +8,13 @@ var BUGNUMBER = 455464; var summary = 'Do not assert with JIT: !TRACE_RECORDER(cx) ^ (jumpTable == recordingJumpTable)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); a=b=c=d=0; this.__defineGetter__('g', gc); for each (y in this); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_6/extensions/regress-455464-02.js +++ b/js/src/tests/js1_6/extensions/regress-455464-02.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); a=b=c=d=0; this.__defineGetter__('g', gc); for each (y in this); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_6/extensions/regress-455464-03.js +++ b/js/src/tests/js1_6/extensions/regress-455464-03.js @@ -17,18 +17,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); a=b=c=d=0; this.__defineGetter__('g', gc); for each (y in this); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_6/extensions/regress-455464-04.js +++ b/js/src/tests/js1_6/extensions/regress-455464-04.js @@ -18,18 +18,16 @@ if (typeof gczeal == 'undefined') expect = actual = 'Test requires gczeal, skipped.'; } else { // Enumerate the global once before we turn on gczeal, so we're not // trying to do all the enumerate hook object creation with a gc on // every object, because that makes tests time out. for (z in this); - jit(true); gczeal(2); a=b=c=d=0; this.__defineGetter__('g', gc); for each (y in this); gczeal(0); - jit(false); } reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_6/extensions/regress-456826.js +++ b/js/src/tests/js1_6/extensions/regress-456826.js @@ -16,17 +16,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); if (typeof gcparam != 'undefined') { gc(); gc(); gcparam("maxBytes", gcparam("gcBytes") + 4*1024); expectExitCode(5); } @@ -117,14 +116,13 @@ function test() } print(Date.now() - start); } var realRange = { min: -2.1, max: 2 }; var imagRange = { min: -2, max: 2 }; createMandelSet(realRange, imagRange); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_6/extensions/regress-465443.js +++ b/js/src/tests/js1_6/extensions/regress-465443.js @@ -17,25 +17,23 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'TypeError: invalid assignment to const `b\''; - jit(true); try { eval('(function () { const b = 16; var out = []; for each (b in [true, "", true, "", true, ""]) out.push(b >> 1) })();'); } catch(ex) { actual = ex + ''; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_6/extensions/regress-472508.js +++ b/js/src/tests/js1_6/extensions/regress-472508.js @@ -7,19 +7,17 @@ var BUGNUMBER = 472508; var summary = 'TM: Do not crash @ TraceRecorder::emitTreeCall'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); for (var x in this) { } var a = [false, false, false]; a.__defineGetter__("q", function() { }); a.__defineGetter__("r", function() { }); for (var i = 0; i < 2; ++i) for each (var e in a) { } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_6/extensions/regress-479567.js +++ b/js/src/tests/js1_6/extensions/regress-479567.js @@ -7,17 +7,16 @@ var BUGNUMBER = 479567; var summary = 'Do not assert: thing'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function f() { (eval("(function(){for each (y in [false, false, false]);});"))(); } try { @@ -25,11 +24,10 @@ try uneval(this.watch("y", this.toSource)) f(); throw x; } catch(ex) { } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_7/extensions/regress-469234.js +++ b/js/src/tests/js1_7/extensions/regress-469234.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for(var j=0;j<3;++j)({__proto__:[]}).__defineSetter__('x',function(){}); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/extensions/regress-470300-01.js +++ b/js/src/tests/js1_7/extensions/regress-470300-01.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let a = 0; a < 3; ++a) { let b = '' + []; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/extensions/regress-470300-02.js +++ b/js/src/tests/js1_7/extensions/regress-470300-02.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let a = 0; a < 7; ++a) { let e = 8; if (a > 3) { let x; } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/extensions/regress-474771-01.js +++ b/js/src/tests/js1_7/extensions/regress-474771-01.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var o = {}; o.__defineSetter__('x', function(){}); for (let j = 0; j < 4; ++j) o.x = 3; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/extensions/regress-474771-02.js +++ b/js/src/tests/js1_7/extensions/regress-474771-02.js @@ -7,16 +7,14 @@ var BUGNUMBER = 474771; var summary = 'TM: do not assert: jumpTable == interruptJumpTable'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); this.__defineSetter__('x', function(){}); for (var j = 0; j < 5; ++j) { x = 3; } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_7/extensions/regress-476257.js +++ b/js/src/tests/js1_7/extensions/regress-476257.js @@ -8,17 +8,16 @@ var BUGNUMBER = 476257; var summary = 'Do not assert: !JS_ON_TRACE(cx)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); function f1() { try { Object.defineProperty(__proto__, "functional", { enumerable: true, configurable: true, get: function () @@ -49,11 +48,10 @@ function f2() { catch(ex) { } } f1(); f2(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_7/regress/regress-452703.js +++ b/js/src/tests/js1_7/regress/regress-452703.js @@ -7,15 +7,13 @@ var BUGNUMBER = 452703; var summary = 'Do not assert with JIT: rmask(rr)&FpRegs'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); (function() { for(let y in [0,1,2,3,4]) y = NaN; })(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_7/regress/regress-452960.js +++ b/js/src/tests/js1_7/regress/regress-452960.js @@ -14,20 +14,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var f = function(){}; f.prototype = false; for (let j=0;j<5;++j) { new f; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-453049.js +++ b/js/src/tests/js1_7/regress/regress-453049.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var z = 0; for (let j = 0; j < 5; ++j) { ({p: (-z)}); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-453051.js +++ b/js/src/tests/js1_7/regress/regress-453051.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var p in this){} for (let a in [5,6,7]) for (var b=0;b<1;++b) break; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-453411.js +++ b/js/src/tests/js1_7/regress/regress-453411.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var i in (function(){ for (var j=0;j<4;++j) { yield ""; } })()); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-462071.js +++ b/js/src/tests/js1_7/regress/regress-462071.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let i in [{}, 0, 0, {}, 0, {}, 0]) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-462282.js +++ b/js/src/tests/js1_7/regress/regress-462282.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let i in [0, 0, 0, "", 0, 0, "", 0, 0, "", 0]) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-462388.js +++ b/js/src/tests/js1_7/regress/regress-462388.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var c = 0, v; for each (let x in ["",v,v,v]) { for (c=0;c<4;++c) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-462407.js +++ b/js/src/tests/js1_7/regress/regress-462407.js @@ -7,15 +7,13 @@ var BUGNUMBER = 462407; var summary = 'Do not assert: !ti->stackTypeMap.matches(ti_other->stackTypeMap)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); (function f() { for each (let i in [0, {}, 0, 1.5, {}, 0, 1.5, 0, 0]) { }})(); -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_7/regress/regress-464403.js +++ b/js/src/tests/js1_7/regress/regress-464403.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); print(8); var u = [print, print, function(){}]; for each (x in u) for (u.e in [1,1,1,1]); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-465236.js +++ b/js/src/tests/js1_7/regress/regress-465236.js @@ -15,16 +15,14 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let j = 0; j < 2; ++j) null <= null; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-465424.js +++ b/js/src/tests/js1_7/regress/regress-465424.js @@ -17,16 +17,14 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '0,1,2,3,4,'; - jit(true); for (let j=0;j<5;++j) { jj=j; print(actual += '' + (jj--) + ',') } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-465484.js +++ b/js/src/tests/js1_7/regress/regress-465484.js @@ -16,15 +16,13 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let a in [2, 2, 2]) { a %= a; a %= a; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-469239-01.js +++ b/js/src/tests/js1_7/regress/regress-469239-01.js @@ -15,24 +15,22 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let b=0;b<9;++b) { for each (let h in ['', 3, /x/]) { for each (c in [[], [], [], /x/]) { '' + c; } } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-469239-02.js +++ b/js/src/tests/js1_7/regress/regress-469239-02.js @@ -15,24 +15,22 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let b=0;b<9;++b) { for each (let h in [33, 3, /x/]) { for each (c in [[], [], [], /x/]) { '' + c; } } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-470223.js +++ b/js/src/tests/js1_7/regress/regress-470223.js @@ -15,26 +15,24 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function F(A) { for (R = [], s = 0; (m = A.indexOf("m", s++)) >= 0; ) R.push([m]); for (i = R.length; i--; ) { let r = R[i]; if (r[0]); } } F("m"); F("mm"); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_7/regress/regress-474771.js +++ b/js/src/tests/js1_7/regress/regress-474771.js @@ -17,27 +17,25 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'PASS'; - jit(true); if (typeof gczeal == 'function') { gczeal(2); } Object.prototype.q = 3; for each (let x in [6, 7]) { } print(actual = "PASS"); - jit(false); delete Object.prototype.q; if (typeof gczeal == 'function') { gczeal(0); }
--- a/js/src/tests/js1_8/extensions/regress-454744.js +++ b/js/src/tests/js1_8/extensions/regress-454744.js @@ -14,24 +14,22 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); try { this.__defineGetter__('x', function() 2); for (var j=0;j<4;++j) { x=1; } } catch(ex) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/extensions/regress-465337.js +++ b/js/src/tests/js1_8/extensions/regress-465337.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var out = []; for (let j = 0; j < 5; ++j) { out.push(6 - ((void 0) ^ 0x80000005)); } print(uneval(out)); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/extensions/regress-465453.js +++ b/js/src/tests/js1_8/extensions/regress-465453.js @@ -18,27 +18,25 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '[(new Boolean(true)), (void 0), (new Boolean(true)), ' + '(new Boolean(true)), (void 0), (void 0), "", "", (void 0)]'; - jit(true); var out = []; for each (var e in [(new Boolean(true)), (void 0), (new Boolean(true)), (new Boolean(true)), (void 0), (void 0), "", "", (void 0)]) out.push(e); print(actual = uneval(out)); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/extensions/regress-469625.js +++ b/js/src/tests/js1_8/extensions/regress-469625.js @@ -19,26 +19,24 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'TypeError: [].__proto__ is not a function'; - jit(true); Array.prototype.__proto__ = function () 3; try { [].__proto__(); } catch(ex) { print(actual = ex + ''); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/extensions/regress-471197.js +++ b/js/src/tests/js1_8/extensions/regress-471197.js @@ -18,30 +18,28 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var results; - jit(true); function f() { for (var i = 0; i != 1000; ++i) { } } if (typeof scatter == 'function') { results = scatter([f, f]); } else { print('Test skipped due to lack of scatter threadsafe function'); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/extensions/regress-472450-03.js +++ b/js/src/tests/js1_8/extensions/regress-472450-03.js @@ -15,22 +15,20 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var cyclic = []; cyclic[0] = cyclic; ({__proto__: cyclic}) for (var y = 0; y < 3; ++y) { for each (let z in ['', function(){}]) { let x = 1, c = []; } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/extensions/regress-472450-04.js +++ b/js/src/tests/js1_8/extensions/regress-472450-04.js @@ -15,24 +15,22 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var cyclic = []; cyclic[0] = cyclic; ({__proto__: cyclic}); function f(){ eval("for (var y = 0; y < 1; ++y) { for each (let z in [null, function(){}, null, '', null, '', null]) { let x = 1, c = []; } }"); } f(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/extensions/regress-473040.js +++ b/js/src/tests/js1_8/extensions/regress-473040.js @@ -7,21 +7,19 @@ var BUGNUMBER = 473040; var summary = 'Do not assert: tm->reservedDoublePoolPtr > tm->reservedDoublePool'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); Object.defineProperty(__proto__, "functional", { enumerable: true, configurable: true, get: new Function("gc()") }); for each (let x in [new Boolean(true), new Boolean(true), -0, new Boolean(true), -0]) { undefined; } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/extensions/regress-476653.js +++ b/js/src/tests/js1_8/extensions/regress-476653.js @@ -8,29 +8,27 @@ var BUGNUMBER = 476653; var summary = 'Do not crash @ QuoteString'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); for each (let x1 in ['']) for (i = 0; i < 1; ++i) {} delete uneval; for (i = 0; i < 1; ++i) {} for each (let x in [new String('q'), '', /x/, '', /x/]) { for (var y = 0; y < 7; ++y) { if (y == 2 || y == 6) { setter = x; } } } try { this.f(z); } catch(ex) { } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/extensions/regress-476869.js +++ b/js/src/tests/js1_8/extensions/regress-476869.js @@ -21,26 +21,24 @@ function test() printBugNumber(BUGNUMBER); printStatus (summary); if (typeof gczeal == 'undefined') { gczeal = (function (){}); } - jit(true); function f() { (new Function("gczeal(1); for each (let y in [/x/,'',new Boolean(false),new Boolean(false),new Boolean(false),'',/x/,new Boolean(false),new Boolean(false)]){}"))(); } __proto__.__iterator__ = this.__defineGetter__("", function(){}) f(); - jit(false); delete __proto__.__iterator__; gczeal(0); reportCompare(expect, actual, summary); exitFunc ('test');
--- a/js/src/tests/js1_8/extensions/regress-481989.js +++ b/js/src/tests/js1_8/extensions/regress-481989.js @@ -7,15 +7,13 @@ var BUGNUMBER = 481989; var summary = 'TM: Do not assert: SPROP_HAS_STUB_SETTER(sprop)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); y = this.watch("x", function(){}); for each (let y in ['', '']) x = y; -jit(true); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/extensions/regress-482263.js +++ b/js/src/tests/js1_8/extensions/regress-482263.js @@ -7,22 +7,20 @@ var BUGNUMBER = 482263; var summary = 'TM: Do not assert: x->oprnd2() == lirbuf->sp || x->oprnd2() == gp_ins'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); Object.defineProperty(__proto__, "x", { enumerable: true, configurable: true, get: function () { return ([]) } }); for each (let x in []) { for each (let x in ['', '']) { } } -jit(true); reportCompare(expect, actual, summary); delete __proto__.x;
--- a/js/src/tests/js1_8/regress/regress-452491.js +++ b/js/src/tests/js1_8/regress/regress-452491.js @@ -14,18 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j=0;j<5;++j) (new (function(q) q)).a; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-457065-01.js +++ b/js/src/tests/js1_8/regress/regress-457065-01.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var e = eval; for (var a in this) { } (function() { eval("this; for (let b in [0,1,2]) { }"); })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-457065-02.js +++ b/js/src/tests/js1_8/regress/regress-457065-02.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function(){ eval('this'); (function(){ for(let y in [0,1,2]) 6;})(); })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-458076.js +++ b/js/src/tests/js1_8/regress/regress-458076.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let j = 0; j < 3; ++j) { true == 0; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-459389.js +++ b/js/src/tests/js1_8/regress/regress-459389.js @@ -9,17 +9,16 @@ var summary = 'Do not crash with JIT'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); print('mmmm, food!'); -jit(true); var SNI = {}; SNI.MetaData={}; SNI.MetaData.Parameter=function() { var parameters={}; this.addParameter=function(key,value) { @@ -110,11 +109,10 @@ function FoodAd(adtype) { ad=new DartAd() ad.addParameter("",adtype) adRestrictionManager.isActive(ad, mdManager) } var mdManager = new MetaDataManager() ; FoodAd('P') -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/regress/regress-461930.js +++ b/js/src/tests/js1_8/regress/regress-461930.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function gen() { for (let j = 0; j < 4; ++j) { yield 1; yield 2; gc(); } } for (let i in gen()) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-461932.js +++ b/js/src/tests/js1_8/regress/regress-461932.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function gen() { for (var j = 0; j < 4; ++j) { NaN; yield 3; } } for (let i in gen()) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-463334-01.js +++ b/js/src/tests/js1_8/regress/regress-463334-01.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); u = 3; for (let i in (function() { for (var j=0;j<4;++j) { void u; yield; } })()); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-463334-02.js +++ b/js/src/tests/js1_8/regress/regress-463334-02.js @@ -15,21 +15,19 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let i in (function() { for (let j = 0; j < 4; ++j) with({t: NaN}) yield; })()) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-464096.js +++ b/js/src/tests/js1_8/regress/regress-464096.js @@ -15,20 +15,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let f in [1,1]); Object.prototype.__defineGetter__('x', function() gc()); (function() { for each (let j in [1,1,1,1,1]) { var y = .2; } })(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-464418.js +++ b/js/src/tests/js1_8/regress/regress-464418.js @@ -17,30 +17,28 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); if (typeof gczeal == 'function') { gczeal(2); } for (let q = 0; q < 50; ++q) { new Function("for (var i = 0; i < 5; ++i) { } ")(); var w = "r".match(/r/); new Function("for (var j = 0; j < 1; ++j) { } ")(); } - jit(false); if (typeof gczeal == 'function') { gczeal(0); } reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/regress/regress-464978.js +++ b/js/src/tests/js1_8/regress/regress-464978.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let j = 0; j < 2; ++j) { [] + null; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465220.js +++ b/js/src/tests/js1_8/regress/regress-465220.js @@ -17,29 +17,27 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'TypeError: can\'t convert o to primitive type'; - jit(true); try { var o = {toString: function()(i > 2) ? this : "foo"}; var s = ""; for (var i = 0; i < 5; i++) s += o + o; print(s); actual = 'No Exception'; } catch(ex) { actual = 'TypeError: can\'t convert o to primitive type'; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465234.js +++ b/js/src/tests/js1_8/regress/regress-465234.js @@ -18,18 +18,16 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = true; actual = true; - jit(true); for (let j = 0; j < 5; ++j) actual = actual && ("" <= null); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465239.js +++ b/js/src/tests/js1_8/regress/regress-465239.js @@ -18,18 +18,16 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '3,3,3,3,3,'; actual = ''; - jit(true); for (let j = 0; j < 5; ++j) actual += ("1e+81" ^ 3) + ','; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465241.js +++ b/js/src/tests/js1_8/regress/regress-465241.js @@ -18,18 +18,16 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = true; actual = true; - jit(true); for (let j = 0; j < 5; ++j) actual = actual && ("0" in [3]); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465249.js +++ b/js/src/tests/js1_8/regress/regress-465249.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); eval("for (let j = 0; j < 5; ++j) { (0x50505050) + (0x50505050); }"); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465261.js +++ b/js/src/tests/js1_8/regress/regress-465261.js @@ -15,22 +15,20 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let z = 0; z < 2; ++z) { for each (let x in [0, true, (void 0), 0, (void 0)]) { if(x){} } }; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465308.js +++ b/js/src/tests/js1_8/regress/regress-465308.js @@ -17,17 +17,15 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '-1073741824,-1073741824,-1073741824,-1073741824,-1073741824,'; - jit(true); for (let j=0;j<5;++j) print(actual += "" + (0 | ((0x60000009) * 0x60000009)) + ','); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465454.js +++ b/js/src/tests/js1_8/regress/regress-465454.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let b in [(-1/0), new String(''), new String(''), null, (-1/0), (-1/0), new String(''), new String(''), null]) '' + b; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-01.js +++ b/js/src/tests/js1_8/regress/regress-465460-01.js @@ -17,18 +17,16 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '11111'; - jit(true); (function(d) { for (let j = 0; j < 5; ++j) { actual += ('' + d); } })({valueOf: function()1}); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-02.js +++ b/js/src/tests/js1_8/regress/regress-465460-02.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let c in [null, null, null, {}]) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-03.js +++ b/js/src/tests/js1_8/regress/regress-465460-03.js @@ -15,18 +15,15 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit (true); - for each (let j in [null, 2, 3]) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-04.js +++ b/js/src/tests/js1_8/regress/regress-465460-04.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 3; ++j) { 1 & new Date; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-05.js +++ b/js/src/tests/js1_8/regress/regress-465460-05.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 3; ++j) { 1 & Date; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-06.js +++ b/js/src/tests/js1_8/regress/regress-465460-06.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let x in [1, {}, 1, null, 1, {}, 1, null, 1]) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-07.js +++ b/js/src/tests/js1_8/regress/regress-465460-07.js @@ -17,25 +17,22 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'pass'; - jit (true); - try { e = {}; for (j=0;j<3;++j) { 3 | e; } "PASS"; } catch(ex) { actual = ex + ''; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-08.js +++ b/js/src/tests/js1_8/regress/regress-465460-08.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let _ in [{}, {}, null, null, null, null]) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-09.js +++ b/js/src/tests/js1_8/regress/regress-465460-09.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let i in (function() { for (var j = 0; j < 3; ++j) yield; })()) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-10.js +++ b/js/src/tests/js1_8/regress/regress-465460-10.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let i = 0; i < 2; ++i) { ({}) + 3; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-11.js +++ b/js/src/tests/js1_8/regress/regress-465460-11.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let d=0;d<2;++d) for (let a=0;a<1;++a) "" + (d && function(){}); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465460-12.js +++ b/js/src/tests/js1_8/regress/regress-465460-12.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (var j = 0; j < 2; ++j) { if (null > "") { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465483.js +++ b/js/src/tests/js1_8/regress/regress-465483.js @@ -17,16 +17,14 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'NaN'; - jit(true); for each (i in [4, 'a', 'b', (void 0)]) print(actual = '' + (i + i)); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-465567-01.js +++ b/js/src/tests/js1_8/regress/regress-465567-01.js @@ -9,23 +9,21 @@ var summary = 'TM: Weirdness with var, l var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = '99999'; -jit(true); for (let j = 0; j < 5; ++j) { var e; e = 9; print(actual += '' + e); e = 47; if (e & 0) { let e; } } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/regress/regress-465567-02.js +++ b/js/src/tests/js1_8/regress/regress-465567-02.js @@ -7,21 +7,19 @@ var BUGNUMBER = 465567; var summary = 'TM: Do not assert: JSVAL_TAG(v) == JSVAL_OBJECT'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); try { eval("for each (e in ['', true, 1, true, 1]) { e = null; if (0) { let e; var e; } }"); } catch(ex) { } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/regress/regress-465688.js +++ b/js/src/tests/js1_8/regress/regress-465688.js @@ -15,16 +15,14 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let d in [-0x80000000, -0x80000000]) - -d; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-466128.js +++ b/js/src/tests/js1_8/regress/regress-466128.js @@ -15,19 +15,17 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (let a = 0; a < 3; ++a) { for each (let b in [1, 2, "three", 4, 5, 6, 7, 8]) { } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-466787.js +++ b/js/src/tests/js1_8/regress/regress-466787.js @@ -17,19 +17,17 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '4444'; - jit(true); for (let j = 0; j < 4; ++j) { for each (let one in [new Number(1)]) { print(actual += '' + (3 + one)); } } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-468711.js +++ b/js/src/tests/js1_8/regress/regress-468711.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (5).toString(); for each (let b in [3, this]) { b.toString(); } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-471373.js +++ b/js/src/tests/js1_8/regress/regress-471373.js @@ -20,26 +20,24 @@ function test() printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window == 'undefined') { expectExitCode(5); } - jit(true); function g() { var x = {}; for (var b = 0; b < 2; ++b) { yield x; for (var c = 0; c < 10;++c) { x.r = x; } } } for (let y in g()) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-471660.js +++ b/js/src/tests/js1_8/regress/regress-471660.js @@ -15,25 +15,23 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); y = {"a":1}; for (var w = 0; w < 5; ++w) { { let y; do break ; while (true); } for each (let x in [{}, function(){}]) {y} } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-474769.js +++ b/js/src/tests/js1_8/regress/regress-474769.js @@ -17,21 +17,19 @@ test(); function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 1; - jit(true); for each (b in [1, 1, 1, 1.5, 1, 1]) { (function() { for each (let h in [0, 0, 1.4, ""]) {} })(); } actual = b; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-474935.js +++ b/js/src/tests/js1_8/regress/regress-474935.js @@ -15,28 +15,26 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); var a = ["", 0, 0, 0, 0, 0, "", "", 0, "", 0, ""]; var i = 0; var g = 0; for each (let e in a) { "" + [e]; if (i == 3 || i == 7) { for each (g in [1]) { } } ++i; } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-476655.js +++ b/js/src/tests/js1_8/regress/regress-476655.js @@ -15,27 +15,25 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); try { eval( "for(let y in ['', '']) try {for(let y in ['', '']) ( /x/g ); } finally {" + "with({}){} } this.zzz.zzz" ); } catch(ex) { } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-477234.js +++ b/js/src/tests/js1_8/regress/regress-477234.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for (iters = 0; iters < 11500; ++iters) { for each (let x in ['', '', '']){} eval("Object.defineProperty(__proto__, 'x', " + "{" + " enumerable: true, configurable: true," + " get: function(){}" + "});"); @@ -35,16 +34,15 @@ function test() var b = toSource; delete toSource; toSource = b; var c = toString; delete toString; toString = c; } - jit(true); delete __proto__.x; reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-477581.js +++ b/js/src/tests/js1_8/regress/regress-477581.js @@ -16,22 +16,20 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function g() { yield 2; } var iterables = [[1], [], [], [], g()]; for (let i = 0; i < iterables.length; i++) for each (let j in iterables[i]) ; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-478205.js +++ b/js/src/tests/js1_8/regress/regress-478205.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let x in ['', '']) { switch([]) {} } - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-479740.js +++ b/js/src/tests/js1_8/regress/regress-479740.js @@ -7,17 +7,16 @@ var BUGNUMBER = 479740; var summary = 'TM: Do not crash @ TraceRecorder::test_property_cache'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); try { eval( ' function f() {' + ' for ( foobar in (function() {' + ' for (var x = 0; x < 2; ++x) {' + ' if (x % 2 == 1) { yield (this.z.z) = function(){} }' + @@ -27,12 +26,11 @@ try ' function(){}' + ' }' + ' f();' ); } catch(ex) { } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/regress/regress-481800.js +++ b/js/src/tests/js1_8/regress/regress-481800.js @@ -15,18 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); for each (let x in ['', 0, 0, eval]) { y = x } ( function(){} ); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8/regress/regress-483749.js +++ b/js/src/tests/js1_8/regress/regress-483749.js @@ -7,21 +7,19 @@ var BUGNUMBER = 483749; var summary = 'Do not assert: !js_IsActiveWithOrBlock(cx, fp->scopeChain, 0)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); for each (let x in ['']) { for (var b = 0; b < 5; ++b) { if (b % 5 == 3) { with([]) this; } } } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8/regress/regress-532491.js +++ b/js/src/tests/js1_8/regress/regress-532491.js @@ -15,17 +15,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(false); function f(foo) { if (a % 2 == 1) { try { eval(foo); } catch(e) {} } } a = 1;
--- a/js/src/tests/js1_8_1/extensions/regress-452498-162.js +++ b/js/src/tests/js1_8_1/extensions/regress-452498-162.js @@ -11,16 +11,14 @@ var expect = ''; //------- Comment #162 From Gary Kwong printBugNumber(BUGNUMBER); printStatus (summary); // Assertion failure: !OBJ_GET_CLASS(cx, proto)->getObjectOps, at ../jsobj.cpp:2030 -jit(true); this.__defineGetter__("x3", Function); parseInt = x3; parseInt.prototype = []; for (var z = 0; z < 4; ++z) { new parseInt() } -jit(false); reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8_1/extensions/regress-477158.js +++ b/js/src/tests/js1_8_1/extensions/regress-477158.js @@ -14,20 +14,18 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); x = 0; x = x.prop; for each (let [] in ['', '']) { switch(x) { default: (function(){}); } }; - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8_1/jit/math-jit-tests.js +++ b/js/src/tests/js1_8_1/jit/math-jit-tests.js @@ -5,17 +5,16 @@ //----------------------------------------------------------------------------- var BUGNUMBER = 'none'; var summary = 'trace-capability math mini-testsuite'; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); /** * A number of the tests in this file depend on the setting of * HOTLOOP. Define some constants up front, so they're easy to grep * for. */ // The HOTLOOP constant we depend on; only readable from our stats // object in debug builds. @@ -675,15 +674,14 @@ testmath("Math.tan", "Number.POSITIVE_IN testmath("Math.tan", "Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.tan", "Math.PI/4", 1) testmath("Math.tan", "3*Math.PI/4", -1) testmath("Math.tan", "Math.PI", -0) testmath("Math.tan", "5*Math.PI/4", 1) testmath("Math.tan", "7*Math.PI/4", -1) testmath("Infinity/Math.tan", "-0", -Infinity) -jit(false); /* Keep these at the end so that we can see the summary after the trace-debug spew. */ if (0) { print("\npassed:", passes.length && passes.join(",")); print("\nFAILED:", fails.length && fails.join(",")); }
--- a/js/src/tests/js1_8_1/jit/regress-451673.js +++ b/js/src/tests/js1_8_1/jit/regress-451673.js @@ -19,19 +19,17 @@ function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function doTest(enablejit) { if (enablejit) - jit(true); else - jit(false); var n = 1000000; var start = new Date(); var i=0; var j=0; var numprimes=0; var limit=0; numprimes = 1; // 2 is prime @@ -60,17 +58,16 @@ function test() } var end = new Date(); var timetaken = end - start; timetaken = timetaken / 1000; if (enablejit) - jit(false); print((enablejit ? ' JIT' : 'Non-JIT') + ": Number of primes up to: " + n + " is " + numprimes + ", counted in " + timetaken + " secs."); return timetaken; } var timenonjit = doTest(false); var timejit = doTest(true);
--- a/js/src/tests/js1_8_1/jit/regress-451974-01.js +++ b/js/src/tests/js1_8_1/jit/regress-451974-01.js @@ -36,20 +36,17 @@ function loop() f(densearray[i]); } } var stop = new Date(); return stop - start; } -jit(false); var timenonjit = loop(); -jit(true); var timejit = loop(); -jit(false); print('time: nonjit = ' + timenonjit + ', jit = ' + timejit); expect = true; actual = timejit < timenonjit/2; reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8_1/jit/regress-451974-02.js +++ b/js/src/tests/js1_8_1/jit/regress-451974-02.js @@ -44,21 +44,18 @@ function test() f(densearray[i]); } } var stop = new Date(); return stop - start; } - jit(false); var timenonjit = loop(); - jit(true); var timejit = loop(); - jit(false); print('time: nonjit = ' + timenonjit + ', jit = ' + timejit); expect = true; actual = timejit < timenonjit/2; reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8_1/jit/regress-452498-01.js +++ b/js/src/tests/js1_8_1/jit/regress-452498-01.js @@ -33,17 +33,16 @@ function mandelbrotValueOO (aC, aIterMax for (var iter = 0; iter < aIterMax; iter++) { Z = Z.square().add(aC); if (Z.r * Z.r + Z.i * Z.i > 256) { break; } } return iter; } function f(trace) { - jit(trace); var start = Date.now(); const width = 60; const height = 60; const max_iters = 50; var output = []; for (let img_x = 0; img_x < width; img_x++) { for (let img_y = 0; img_y < height; img_y++) { let C = new complex(-2 + (img_x / width) * 3, @@ -51,17 +50,16 @@ function f(trace) { var res = mandelbrotValueOO(C, max_iters); if (output.length > 0 && output[output.length -1][0] == res) { output[output.length-1][1]++; } else { output.push([res, 1]); } } } - jit(false); const reference = "[[2, 6], [3, 17], [4, 6], [5, 1], [50, 1], [5, 1], [4, 6], [3, 17], [2, 10], [3, 17], [4, 6], [5, 1], [6, 1], [50, 1], [6, 1], [5, 1], [4, 6], [3, 17], [2, 8], [3, 17], [4, 6], [5, 2], [6, 1], [50, 1], [6, 1], [5, 2], [4, 6], [3, 17], [2, 6], [3, 17], [4, 6], [5, 2], [6, 1], [7, 1], [50, 1], [7, 1], [6, 1], [5, 2], [4, 6], [3, 17], [2, 4], [3, 17], [4, 7], [5, 2], [6, 1], [8, 1], [50, 1], [8, 1], [6, 1], [5, 2], [4, 7], [3, 17], [2, 2], [3, 17], [4, 7], [5, 3], [6, 1], [9, 1], [50, 1], [9, 1], [6, 1], [5, 3], [4, 7], [3, 17], [2, 1], [3, 16], [4, 7], [5, 3], [6, 2], [8, 1], [50, 1], [8, 1], [6, 2], [5, 3], [4, 7], [3, 32], [4, 7], [5, 4], [6, 1], [7, 1], [8, 1], [50, 1], [8, 1], [7, 1], [6, 1], [5, 4], [4, 7], [3, 31], [4, 7], [5, 3], [6, 2], [7, 1], [8, 1], [50, 1], [8, 1], [7, 1], [6, 2], [5, 3], [4, 7], [3, 30], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [50, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 28], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [10, 1], [50, 1], [10, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 26], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [9, 1], [11, 1], [50, 1], [11, 1], [9, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 25], [4, 6], [5, 3], [6, 3], [7, 1], [8, 1], [18, 1], [13, 1], [15, 1], [50, 1], [15, 1], [13, 1], [18, 1], [8, 1], [7, 1], [6, 3], [5, 3], [4, 6], [3, 24], [4, 7], [5, 2], [6, 2], [7, 3], [8, 1], [10, 1], [14, 1], [50, 3], [14, 1], [10, 1], [8, 1], [7, 3], [6, 2], [5, 2], [4, 7], [3, 23], [4, 6], [5, 3], [7, 1], [8, 1], [9, 1], [8, 2], [10, 1], [11, 1], [15, 1], [50, 3], [15, 1], [11, 1], [10, 1], [8, 2], [9, 1], [8, 1], [7, 1], [5, 3], [4, 6], [3, 22], [4, 7], [5, 2], [6, 1], [7, 1], [14, 1], [16, 1], [11, 1], [10, 1], [12, 1], [20, 1], [23, 1], [46, 1], [50, 1], [46, 1], [23, 1], [20, 1], [12, 1], [10, 1], [11, 1], [16, 1], [14, 1], [7, 1], [6, 1], [5, 2], [4, 7], [3, 20], [4, 7], [5, 3], [6, 1], [7, 1], [8, 1], [10, 1], [17, 1], [16, 1], [20, 1], [50, 7], [20, 1], [16, 1], [17, 1], [10, 1], [8, 1], [7, 1], [6, 1], [5, 3], [4, 7], [3, 19], [4, 7], [5, 3], [6, 2], [7, 1], [10, 1], [21, 1], [50, 11], [21, 1], [10, 1], [7, 1], [6, 2], [5, 3], [4, 7], [3, 18], [4, 7], [5, 4], [6, 1], [7, 1], [8, 1], [9, 1], [13, 1], [25, 1], [50, 9], [25, 1], [13, 1], [9, 1], [8, 1], [7, 1], [6, 1], [5, 4], [4, 7], [3, 17], [4, 7], [5, 4], [6, 1], [7, 1], [8, 1], [14, 2], [50, 11], [14, 2], [8, 1], [7, 1], [6, 1], [5, 4], [4, 7], [3, 16], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [11, 1], [36, 1], [50, 11], [36, 1], [11, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 15], [4, 7], [5, 4], [6, 2], [7, 1], [8, 1], [9, 1], [14, 1], [50, 11], [14, 1], [9, 1], [8, 1], [7, 1], [6, 2], [5, 4], [4, 7], [3, 14], [4, 7], [5, 4], [6, 3], [7, 1], [8, 1], [9, 1], [12, 1], [26, 1], [50, 9], [26, 1], [12, 1], [9, 1], [8, 1], [7, 1], [6, 3], [5, 4], [4, 7], [3, 13], [4, 7], [5, 4], [6, 2], [7, 2], [8, 1], [9, 1], [10, 1], [15, 1], [50, 9], [15, 1], [10, 1], [9, 1], [8, 1], [7, 2], [6, 2], [5, 4], [4, 7], [3, 12], [4, 7], [5, 4], [6, 3], [7, 1], [8, 2], [9, 1], [10, 1], [12, 1], [16, 1], [50, 7], [16, 1], [12, 1], [10, 1], [9, 1], [8, 2], [7, 1], [6, 3], [5, 4], [4, 7], [3, 11], [4, 6], [5, 4], [6, 3], [7, 1], [8, 2], [9, 1], [11, 1], [12, 1], [14, 1], [17, 1], [23, 1], [34, 1], [50, 3], [34, 1], [23, 1], [17, 1], [14, 1], [12, 1], [11, 1], [9, 1], [8, 2], [7, 1], [6, 3], [5, 4], [4, 6], [3, 10], [4, 7], [5, 3], [6, 2], [7, 2], [8, 1], [9, 1], [22, 1], [12, 1], [50, 1], [25, 1], [50, 11], [25, 1], [50, 1], [12, 1], [22, 1], [9, 1], [8, 1], [7, 2], [6, 2], [5, 3], [4, 7], [3, 9], [4, 6], [5, 4], [6, 1], [7, 1], [8, 2], [9, 1], [14, 1], [50, 1], [21, 1], [50, 15], [21, 1], [50, 1], [14, 1], [9, 1], [8, 2], [7, 1], [6, 1], [5, 4], [4, 6], [3, 8], [4, 7], [5, 3], [6, 2], [9, 1], [14, 1], [13, 1], [11, 1], [13, 1], [26, 1], [50, 17], [26, 1], [13, 1], [11, 1], [13, 1], [14, 1], [9, 1], [6, 2], [5, 3], [4, 7], [3, 7], [4, 6], [5, 4], [6, 1], [7, 1], [9, 1], [49, 1], [43, 1], [50, 23], [43, 1], [49, 1], [9, 1], [7, 1], [6, 1], [5, 4], [4, 6], [3, 7], [4, 5], [5, 4], [6, 2], [7, 1], [9, 1], [13, 1], [50, 25], [13, 1], [9, 1], [7, 1], [6, 2], [5, 4], [4, 5], [3, 6], [4, 6], [5, 3], [6, 2], [7, 2], [9, 1], [11, 1], [17, 1], [50, 23], [17, 1], [11, 1], [9, 1], [7, 2], [6, 2], [5, 3], [4, 6], [3, 5], [4, 5], [5, 3], [6, 3], [7, 1], [8, 1], [9, 1], [50, 1], [26, 1], [50, 23], [26, 1], [50, 1], [9, 1], [8, 1], [7, 1], [6, 3], [5, 3], [4, 5], [3, 5], [4, 4], [5, 3], [6, 3], [7, 1], [8, 2], [10, 1], [21, 1], [50, 25], [21, 1], [10, 1], [8, 2], [7, 1], [6, 3], [5, 3], [4, 4], [3, 5], [4, 4], [5, 2], [6, 3], [7, 1], [12, 1], [9, 1], [10, 1], [11, 1], [50, 27], [11, 1], [10, 1], [9, 1], [12, 1], [7, 1], [6, 3], [5, 2], [4, 4], [3, 5], [4, 3], [5, 2], [6, 2], [7, 2], [9, 1], [42, 1], [15, 1], [23, 1], [14, 1], [50, 27], [14, 1], [23, 1], [15, 1], [42, 1], [9, 1], [7, 2], [6, 2], [5, 2], [4, 3], [3, 5], [4, 3], [5, 1], [6, 1], [20, 1], [9, 1], [8, 1], [9, 1], [10, 1], [16, 1], [50, 33], [16, 1], [10, 1], [9, 1], [8, 1], [9, 1], [20, 1], [6, 1], [5, 1], [4, 3], [3, 5], [4, 3], [5, 1], [6, 1], [9, 1], [13, 1], [12, 1], [11, 1], [38, 1], [25, 1], [50, 33], [25, 1], [38, 1], [11, 1], [12, 1], [13, 1], [9, 1], [6, 1], [5, 1], [4, 3], [3, 5], [4, 3], [5, 2], [6, 1], [7, 1], [10, 1], [24, 1], [25, 1], [50, 35], [25, 1], [24, 1], [10, 1], [7, 1], [6, 1], [5, 2], [4, 3], [3, 5], [4, 4], [5, 1], [6, 1], [7, 1], [11, 2], [13, 1], [19, 1], [50, 33], [19, 1], [13, 1], [11, 2], [7, 1], [6, 1], [5, 1], [4, 4], [3, 5], [4, 4], [5, 2], [6, 1], [50, 1], [8, 2], [17, 1], [19, 1], [35, 1], [14, 1], [24, 1], [50, 25], [24, 1], [14, 1], [35, 1], [19, 1], [17, 1], [8, 2], [50, 1], [6, 1], [5, 2], [4, 4], [3, 5], [4, 5], [5, 2], [6, 2], [7, 1], [8, 1], [9, 2], [11, 1], [38, 1], [50, 25], [38, 1], [11, 1], [9, 2], [8, 1], [7, 1], [6, 2], [5, 2], [4, 5], [3, 6], [4, 4], [5, 3], [6, 2], [7, 2], [8, 1], [9, 1], [15, 1], [50, 25], [15, 1], [9, 1], [8, 1], [7, 2], [6, 2], [5, 3], [4, 4], [3, 7], [4, 5], [5, 3], [6, 3], [7, 1], [9, 1], [42, 1], [21, 1], [50, 23], [21, 1], [42, 1], [9, 1], [7, 1], [6, 3], [5, 3], [4, 5], [3, 8], [4, 5], [5, 3], [6, 2], [7, 1], [8, 1], [9, 1], [13, 1], [50, 23], [13, 1], [9, 1], [8, 1], [7, 1], [6, 2], [5, 3], [4, 5], [3, 9], [4, 6], [5, 3], [6, 2], [7, 1], [9, 1], [14, 1], [50, 23], [14, 1], [9, 1], [7, 1], [6, 2], [5, 3], [4, 6], [3, 10], [4, 6], [5, 3], [6, 1], [7, 1], [9, 1], [16, 1], [50, 2], [35, 1], [50, 8], [13, 1], [50, 8], [35, 1], [50, 2], [16, 1], [9, 1], [7, 1], [6, 1], [5, 3], [4, 6], [3, 12], [4, 6], [5, 2], [6, 1], [19, 1], [16, 1], [17, 1], [25, 1], [21, 1], [13, 1], [18, 1], [50, 6], [11, 1], [9, 1], [11, 1], [50, 6], [18, 1], [13, 1], [21, 1], [25, 1], [17, 1], [16, 1], [19, 1], [6, 1], [5, 2], [4, 6], [3, 14], [4, 5], [5, 3], [6, 1], [8, 1], [16, 1], [10, 1], [8, 2], [11, 1], [50, 1], [16, 1], [15, 1], [32, 1], [29, 1], [9, 1], [8, 1], [7, 1], [8, 1], [9, 1], [29, 1], [32, 1], [15, 1], [16, 1], [50, 1], [11, 1], [8, 2], [10, 1], [16, 1], [8, 1], [6, 1], [5, 3], [4, 5], [3, 15], [4, 6], [5, 3], [6, 4], [7, 1], [20, 1], [19, 1], [9, 3], [7, 3], [6, 1], [7, 3], [9, 3], [19, 1], [20, 1], [7, 1], [6, 4], [5, 3], [4, 6], [3, 16], [4, 7], [5, 4], [6, 3], [7, 1], [6, 13], [7, 1], [6, 3], [5, 4], [4, 7], [3, 18], [4, 7], [5, 27], [4, 7], [3, 20], [4, 9], [5, 21], [4, 9], [3, 23], [4, 12], [5, 11], [4, 12], [3, 26], [4, 33], [3, 29], [4, 29], [3, 33], [4, 25], [3, 38], [4, 19], [3, 20], [2, 1], [3, 26], [4, 7], [3, 26], [2, 2], [3, 57], [2, 1]]"; reportCompare(reference, output.toSource(), summary + ': correctness jit=' + trace); return (Date.now() - start); } var timenonjit = f(false); var timejit = f(true);
--- a/js/src/tests/js1_8_1/jit/regress-458838.js +++ b/js/src/tests/js1_8_1/jit/regress-458838.js @@ -14,17 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); function f() { var a = 1; function g() { var b = 0 for (var i = 0; i < 10; ++i) { b += a; } @@ -45,17 +44,16 @@ function test() if (this.tracemonkey && !this.tracemonkey.adaptive) { recorderStarted = this.tracemonkey.recorderStarted; recorderAborted = this.tracemonkey.recorderAborted; traceCompleted = this.tracemonkey.traceCompleted; skip = false; } - jit(false); reportCompare(expect, actual, summary + ': return value 10'); if (!skip) { expect = 'recorderStarted=1, recorderAborted=0, traceCompleted=1'; actual = 'recorderStarted=' + recorderStarted + ', recorderAborted=' + recorderAborted + ', traceCompleted=' + traceCompleted; reportCompare(expect, actual, summary + ': trace');
--- a/js/src/tests/js1_8_1/jit/regress-462459-01.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-01.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace Array()'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { Array(); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-02.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-02.js @@ -7,41 +7,37 @@ var BUGNUMBER = 462459; var summary = 'TM: trace Array(1)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { Array(1); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-03.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-03.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace Array(1, 2)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { Array(1, 2); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-04.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-04.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace Array(1, 2, 3)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { Array(1, 2, 3); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-05.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-05.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace new Array()'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { new Array(); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-06.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-06.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace new Array(1)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { new Array(1); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-07.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-07.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace new Array(1, 2)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { new Array(1, 2); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-08.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-08.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace new Array(1, 2, 3)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { new Array(1, 2, 3); } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-09.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-09.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace []'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { []; } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-10.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-10.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace [1]'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { [1]; } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-11.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-11.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace [1, 2]'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { [1, 2]; } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-462459-12.js +++ b/js/src/tests/js1_8_1/jit/regress-462459-12.js @@ -7,42 +7,38 @@ var BUGNUMBER = 462459; var summary = 'TM: trace [1, 2, 3]'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); if (!this.tracemonkey || this.tracemonkey.adaptive) { - jit(false); expect = actual = 'Test skipped due to lack of tracemonkey jitstats'; reportCompare(expect, actual, summary); } else { - jit(true); expect = 'recorder started, recorder not aborted, trace completed'; actual = ''; var recorderStartedStart = this.tracemonkey.recorderStarted; var recorderAbortedStart = this.tracemonkey.recorderAborted; var traceCompletedStart = this.tracemonkey.traceCompleted; for (var i = 0; i < RUNLOOP; i++) { [1, 2, 3]; } - jit(false); var recorderStartedEnd = this.tracemonkey.recorderStarted; var recorderAbortedEnd = this.tracemonkey.recorderAborted; var traceCompletedEnd = this.tracemonkey.traceCompleted; if (recorderStartedEnd > recorderStartedStart) { actual = 'recorder started, ';
--- a/js/src/tests/js1_8_1/jit/regress-469927.js +++ b/js/src/tests/js1_8_1/jit/regress-469927.js @@ -25,21 +25,18 @@ function test() var start = new Date(); for (let i = 0; i < 500000; ++i) { for (let j = 0; j < 4; ++j) { } } var stop = new Date(); return stop - start; } - jit(false); var timenonjit = letitbe(); - jit(true); var timejit = letitbe(); - jit(false); print('time: nonjit = ' + timenonjit + ', jit = ' + timejit); expect = true; actual = timejit < timenonjit; reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8_1/jit/regress-470739.js +++ b/js/src/tests/js1_8_1/jit/regress-470739.js @@ -27,21 +27,18 @@ function test() var start = new Date(); for(i=0;i<500000;++i) { var r = (void 0) == null; } var stop = new Date(); return stop - start; } - jit(false); var timenonjit = loop(); - jit(true); var timejit = loop(); - jit(false); print('time: nonjit = ' + timenonjit + ', jit = ' + timejit); expect = true; actual = timejit < timenonjit; reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8_1/jit/regress-471635.js +++ b/js/src/tests/js1_8_1/jit/regress-471635.js @@ -14,17 +14,16 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); (function(){ for (var i = 1; i < 20; ++i) { print("#"); } })(); var recorderStarted; @@ -35,17 +34,16 @@ function test() if (this.tracemonkey && !this.tracemonkey.adaptive) { recorderStarted = this.tracemonkey.recorderStarted; recorderAborted = this.tracemonkey.recorderAborted; traceCompleted = this.tracemonkey.traceCompleted; skip = false; } - jit(false); if (!skip) { expect = 'recorderStarted=1, recorderAborted=0, traceCompleted=1'; actual = 'recorderStarted=' + recorderStarted + ', recorderAborted=' + recorderAborted + ', traceCompleted=' + traceCompleted; } else {
--- a/js/src/tests/js1_8_1/jit/regress-489682.js +++ b/js/src/tests/js1_8_1/jit/regress-489682.js @@ -7,27 +7,25 @@ var BUGNUMBER = 489682; var summary = 'TM: wrong number with nested type-unstable loops'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); var v = 0; for each (var a in [0, {}, {}, {}]) { print(v); v = v >>> 0; for each (var b in [{}, {}, new String(''), 42, new String(''), {}, 42]) { } } print(v); -jit(false); expect = '0'; actual = v + ''; reportCompare(expect, actual, summary);
--- a/js/src/tests/js1_8_1/regress/regress-495773.js +++ b/js/src/tests/js1_8_1/regress/regress-495773.js @@ -29,16 +29,14 @@ test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); actual = f(); - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8_1/regress/regress-495907.js +++ b/js/src/tests/js1_8_1/regress/regress-495907.js @@ -21,16 +21,14 @@ actual = o.join(""); finish_test(); //----------------------------------------------------------------------------- function start_test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); - jit(true); } function finish_test() { - jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); }
--- a/js/src/tests/js1_8_1/regress/regress-496922.js +++ b/js/src/tests/js1_8_1/regress/regress-496922.js @@ -11,30 +11,28 @@ var expect = '0,0,1,1,2,2,3,3'; //----------------------------------------------------------------------------- // The code must run as part of the top-level script in order to get the bug. enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); -jit(true); var a = []; { let f = function() { for (let x = 0; x < 4; ++x) { (function() { for (let y = 0; y < 2; ++y) { a.push(x); } })() } }; (function() {})() f(99) } actual = '' + a; -jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); //-----------------------------------------------------------------------------
--- a/js/src/tests/js1_8_1/regress/regress-507053.js +++ b/js/src/tests/js1_8_1/regress/regress-507053.js @@ -7,17 +7,16 @@ var BUGNUMBER = 507053; var summary = 'TM: invalid results with setting a closure variable in a loop' var actual = ''; var expect = '2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,'; //----------------------------------------------------------------------------- start_test(); -jit(true); var f = function() { var p = 1; function g() { for (var i = 0; i < 5; ++i) { p = p * 2; actual += p + ','; @@ -25,17 +24,16 @@ var f = function() { } g(); } for (var i = 0; i < 5; ++i) { f(); } -jit(false); finish_test(); //----------------------------------------------------------------------------- function start_test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary);
--- a/js/src/tests/js1_8_1/regress/regress-507295.js +++ b/js/src/tests/js1_8_1/regress/regress-507295.js @@ -7,29 +7,27 @@ var BUGNUMBER = 507295; var summary = 'TM: assert with using result of assignment to closure var' var actual = ''; var expect = 'do not crash'; //----------------------------------------------------------------------------- start_test(); -jit(true); (function () { var y; (eval("(function () {\ for (var x = 0; x < 3; ++x) {\ ''.replace(/a/, (y = 3))\ }\ });\ "))() })() -jit(false); actual = 'do not crash' finish_test(); //----------------------------------------------------------------------------- function start_test() { enterFunc ('test'); printBugNumber(BUGNUMBER);
--- a/js/src/tests/shell.js +++ b/js/src/tests/shell.js @@ -1,34 +1,156 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// NOTE: If you're adding new test harness functionality -- first, should you +// at all? Most stuff is better in specific tests, or in nested shell.js +// or browser.js. Second, supposing you should, please add it to this +// IIFE for better modularity/resilience against tests that must do +// particularly bizarre things that might break the harness. + +(function(global) { + /********************************************************************** + * CACHED PRIMORDIAL FUNCTIONALITY (before a test might overwrite it) * + **********************************************************************/ + + var Error = global.Error; + var Number = global.Number; + var TypeError = global.TypeError; + + /**************************** + * TESTING FUNCTION EXPORTS * + ****************************/ + + function SameValue(v1, v2) { + // We could |return Object.is(v1, v2);|, but that's less portable. + if (v1 === 0 && v2 === 0) + return 1 / v1 === 1 / v2; + if (v1 !== v1 && v2 !== v2) + return true; + return v1 === v2; + } + + var assertEq = global.assertEq; + if (typeof assertEq !== "function") { + assertEq = function assertEq(actual, expected, message) { + if (!SameValue(actual, expected)) { + throw new TypeError('Assertion failed: got "' + actual + '", ' + + 'expected "' + expected + + (message ? ": " + message : "")); + } + }; + global.assertEq = assertEq; + } + + function assertThrows(f) { + var ok = false; + try { + f(); + } catch (exc) { + ok = true; + } + if (!ok) + throw new Error("Assertion failed: " + f + " did not throw as expected"); + } + global.assertThrows = assertThrows; + + function assertThrowsInstanceOf(f, ctor, msg) { + var fullmsg; + try { + f(); + } catch (exc) { + if (exc instanceof ctor) + return; + fullmsg = + "Assertion failed: expected exception " + ctor.name + ", got " + exc; + } + + if (fullmsg === undefined) { + fullmsg = + "Assertion failed: expected exception " + ctor.name + ", " + + "no exception thrown"; + } + if (msg !== undefined) + fullmsg += " - " + msg; + + throw new Error(fullmsg); + } + global.assertThrowsInstanceOf = assertThrowsInstanceOf; + + /**************************** + * UTILITY FUNCTION EXPORTS * + ****************************/ + + // Eventually this polyfill should be defined here, not in browser.js. For + // now tolerate more-resilient code depending on less-resilient code. + assertEq(typeof global.print, "function", + "print function is pre-existing, either provided by the shell or " + + "the already-executed top-level browser.js"); + + /****************************************************** + * TEST METADATA EXPORTS (these are of dubious value) * + ******************************************************/ + + global.SECTION = ""; + global.VERSION = ""; + global.BUGNUMBER = ""; + + /************************************************************************* + * HARNESS-CENTRIC EXPORTS (we should generally work to eliminate these) * + *************************************************************************/ + + /** Set up test environment. */ + function startTest() { + if (global.BUGNUMBER) + global.print("BUGNUMBER: " + global.BUGNUMBER); + } + global.startTest = startTest; + + /***************************************************** + * RHINO-SPECIFIC EXPORTS (are these used any more?) * + *****************************************************/ + + function inRhino() { + return typeof global.defineClass === "function"; + } + global.inRhino = inRhino; + + function GetContext() { + return global.Packages.com.netscape.javascript.Context.getCurrentContext(); + } + global.GetContext = GetContext; + + function OptLevel(i) { + i = Number(i); + var cx = GetContext(); + cx.setOptimizationLevel(i); + } + global.OptLevel = OptLevel; +})(this); + + var STATUS = "STATUS: "; var VERBOSE = false; var SECT_PREFIX = 'Section '; var SECT_SUFFIX = ' of test - '; var callStack = new Array(); var gDelayTestDriverEnd = false; var gTestcases = new Array(); var gTc = gTestcases.length; -var BUGNUMBER = ''; var summary = ''; var description = ''; var expected = ''; var actual = ''; var msg = ''; -var SECTION = ""; -var VERSION = ""; -var BUGNUMBER = ""; - /* * constant strings */ var GLOBAL = this + ''; var PASSED = " PASSED! "; var FAILED = " FAILED! "; var DEBUG = false; @@ -51,28 +173,16 @@ function testPassesUnlessItThrows() { * wrapper for test case constructor that doesn't require the SECTION * argument. */ function AddTestCase( description, expect, actual ) { new TestCase( SECTION, description, expect, actual ); } -/* - * Set up test environment. - * - */ -function startTest() { - // print out bugnumber - - if ( BUGNUMBER ) { - print ("BUGNUMBER: " + BUGNUMBER ); - } -} - function TestCase(n, d, e, a) { this.name = n; this.description = d; this.expect = e; this.actual = a; this.passed = getTestCaseResult(e, a); this.reason = ''; @@ -215,46 +325,16 @@ function escapeString (str) result += "\\x" + b + a; } } return result; } /* - * assertEq(actual, expected [, message]) - * Throw if the two arguments are not the same. The sameness of two values - * is determined as follows. If both values are zero, they are the same iff - * their signs are the same. Otherwise, if both values are NaN, they are the - * same. Otherwise, they are the same if they compare equal using ===. - * see https://bugzilla.mozilla.org/show_bug.cgi?id=480199 and - * https://bugzilla.mozilla.org/show_bug.cgi?id=515285 - */ -if (typeof assertEq == 'undefined') -{ - var assertEq = - function (actual, expected, message) - { - function SameValue(v1, v2) - { - if (v1 === 0 && v2 === 0) - return 1 / v1 === 1 / v2; - if (v1 !== v1 && v2 !== v2) - return true; - return v1 === v2; - } - if (!SameValue(actual, expected)) - { - throw new TypeError('Assertion failed: got "' + actual + '", expected "' + expected + - (message ? ": " + message : "")); - } - }; -} - -/* * Compare expected result to actual result, if they differ (in value and/or * type) report a failure. If description is provided, include it in the * failure report. */ function reportCompare (expected, actual, description) { var expected_t = typeof expected; var actual_t = typeof actual; var output = ""; @@ -860,70 +940,18 @@ function jsTestDriverEnd() for (var i = 0; i < gTestcases.length; i++) { gTestcases[i].dump(); } } -function jit(on) -{ -} - function assertEqArray(a1, a2) { assertEq(a1.length, a2.length); for (var i = 0; i < a1.length; i++) { try { assertEq(a1[i], a2[i]); } catch (e) { throw new Error("At index " + i + ": " + e); } } } - -function assertThrows(f) { - var ok = false; - try { - f(); - } catch (exc) { - ok = true; - } - if (!ok) - throw new Error("Assertion failed: " + f + " did not throw as expected"); -} - - -function assertThrowsInstanceOf(f, ctor, msg) { - var fullmsg; - try { - f(); - } catch (exc) { - if (exc instanceof ctor) - return; - fullmsg = "Assertion failed: expected exception " + ctor.name + ", got " + exc; - } - if (fullmsg === undefined) - fullmsg = "Assertion failed: expected exception " + ctor.name + ", no exception thrown"; - if (msg !== undefined) - fullmsg += " - " + msg; - throw new Error(fullmsg); -}; - -/* - * Some tests need to know if we are in Rhino as opposed to SpiderMonkey - */ -function inRhino() -{ - return (typeof defineClass == "function"); -} - -/* these functions are useful for running tests manually in Rhino */ - -function GetContext() { - return Packages.com.netscape.javascript.Context.getCurrentContext(); -} -function OptLevel( i ) { - i = Number(i); - var cx = GetContext(); - cx.setOptimizationLevel(i); -} -/* end of Rhino functions */