diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 5a962fb80809..acec12093ab6 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -627,7 +627,9 @@ pref("app.update.socket.maxErrors", 20); pref("app.update.log", true); // SystemUpdate API +#ifdef MOZ_WIDGET_GONK pref("dom.system_update.active", "@mozilla.org/updates/update-prompt;1"); +#endif #else // Explicitly disable the shutdown watchdog. It's enabled by default. // When the updater is disabled, we want to know about shutdown hangs. diff --git a/browser/base/content/test/plugins/browser.ini b/browser/base/content/test/plugins/browser.ini index e01114880f81..a3d633d62255 100644 --- a/browser/base/content/test/plugins/browser.ini +++ b/browser/base/content/test/plugins/browser.ini @@ -55,7 +55,6 @@ skip-if = !crashreporter [browser_CTP_data_urls.js] [browser_CTP_drag_drop.js] [browser_CTP_hide_overlay.js] -skip-if = true # Bug 1160788 [browser_CTP_iframe.js] skip-if = os == 'linux' || os == 'mac' # Bug 984821 [browser_CTP_multi_allow.js] diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 1a6c2921a78a..51b115984fca 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -7212,8 +7212,12 @@ HTMLInputElement::SetFilePickerFiltersFromAccept(nsIFilePicker* filePicker) filterBundle->GetStringFromName(MOZ_UTF16("videoFilter"), getter_Copies(extensionListStr)); } else if (token.First() == '.') { + if (token.FindChar(';') >= 0 || token.FindChar('*') >= 0) { + // Ignore this filter as it contains reserved characters + continue; + } extensionListStr = NS_LITERAL_STRING("*") + token; - filterName = extensionListStr + NS_LITERAL_STRING("; "); + filterName = extensionListStr; atLeastOneFileExtensionFilter = true; } else { //... if no image/audio/video filter is found, check mime types filters @@ -7291,7 +7295,14 @@ HTMLInputElement::SetFilePickerFiltersFromAccept(nsIFilePicker* filePicker) if (i == j) { continue; } - if (FindInReadable(filterToCheck.mFilter, filtersCopy[j].mFilter)) { + // Check if this filter's extension list is a substring of the other one. + // e.g. if filters are "*.jpeg" and "*.jpeg; *.jpg" the first one should + // be removed. + // Add an extra "; " to be sure the check will work and avoid cases like + // "*.xls" being a subtring of "*.xslx" while those are two differents + // filters and none should be removed. + if (FindInReadable(filterToCheck.mFilter + NS_LITERAL_STRING(";"), + filtersCopy[j].mFilter + NS_LITERAL_STRING(";"))) { // We already have a similar, less restrictive filter (i.e. // filterToCheck extensionList is just a subset of another filter // extension list): remove this one diff --git a/dom/html/test/forms/test_input_file_picker.html b/dom/html/test/forms/test_input_file_picker.html index 2b64f7c12c1c..6d3a98631877 100644 --- a/dom/html/test/forms/test_input_file_picker.html +++ b/dom/html/test/forms/test_input_file_picker.html @@ -31,7 +31,16 @@ + + + + + + + + + @@ -91,7 +100,16 @@ var testData = [["a", 1, MockFilePicker.filterImages, 1], ["o", 1, "*.test", 1], ["p", 3, "*.gif; *.csv", 1], ["q", 1, "*.gif", 1], + ["r", 3, "*.prefix; *.prefixPlusSomething", 1], + ["s", 3, "*.xls; *.xlsx", 1], + ["t", 4, "*.mp3; *.wav; *.flac", 1], + ["u", 3, "*.xls; *.xlsx", 1], + ["v", 3, "*.xlsx; *.xls", 1], + ["w", 0, undefined, 0], + ["x", 3, "*.xls; *.xlsx", 1], + ["y", 3, "*.xlsx; *.xls", 1], ["z", 0, undefined, 0], + ["A", 1, "*.xlsx", 1], // Note: mix and mix-ref tests extension lists are checked differently: see SimpleTest.executeSoon below ["mix-ref", undefined, undefined, undefined], ["mix", 1, undefined, 1], diff --git a/dom/media/AudioSink.cpp b/dom/media/AudioSink.cpp index fc18ab49f80e..2fa92604c338 100644 --- a/dom/media/AudioSink.cpp +++ b/dom/media/AudioSink.cpp @@ -86,7 +86,7 @@ AudioSink::HasUnplayedFrames() } void -AudioSink::PrepareToShutdown() +AudioSink::Shutdown() { AssertCurrentThreadInMonitor(); mStopAudioThread = true; @@ -94,11 +94,8 @@ AudioSink::PrepareToShutdown() mAudioStream->Cancel(); } GetReentrantMonitor().NotifyAll(); -} -void -AudioSink::Shutdown() -{ + ReentrantMonitorAutoExit exit(GetReentrantMonitor()); mThread->Shutdown(); mThread = nullptr; if (mAudioStream) { diff --git a/dom/media/AudioSink.h b/dom/media/AudioSink.h index 81fb1b1646aa..8faa03e67e9d 100644 --- a/dom/media/AudioSink.h +++ b/dom/media/AudioSink.h @@ -37,12 +37,8 @@ public: // played. bool HasUnplayedFrames(); - // Tell the AudioSink to stop processing and initiate shutdown. Must be - // called with the decoder monitor held. - void PrepareToShutdown(); - - // Shut down the AudioSink's resources. The decoder monitor must not be - // held during this call, as it may block processing thread event queues. + // Shut down the AudioSink's resources. + // Must be called with the decoder monitor held. void Shutdown(); void SetVolume(double aVolume); diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index ba7bb30e86fd..d7ca62e2b193 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -655,25 +655,6 @@ void MediaDecoder::QueueMetadata(int64_t aPublishTime, mDecoderStateMachine->QueueMetadata(aPublishTime, aInfo, aTags); } -bool -MediaDecoder::IsExpectingMoreData() -{ - ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); - - // If there's no resource, we're probably just getting set up. - if (!mResource) { - return true; - } - - // If we've downloaded anything, we're not waiting for anything. - if (mResource->IsDataCachedToEndOfResource(mDecoderPosition)) { - return false; - } - - // Otherwise, we should be getting data unless the stream is suspended. - return !mResource->IsSuspended(); -} - void MediaDecoder::MetadataLoaded(nsAutoPtr aInfo, nsAutoPtr aTags, MediaDecoderEventVisibility aEventVisibility) diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index f882d028d124..c2a01bb07465 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -622,13 +622,6 @@ public: // the track list. Call on the main thread only. virtual void RemoveMediaTracks() override; - // Returns true if the this decoder is expecting any more data to arrive - // sometime in the not-too-distant future, either from the network or from - // an appendBuffer call on a MediaSource element. - // - // Acquires the monitor. Call from any thread. - virtual bool IsExpectingMoreData(); - // Called when the video has completed playing. // Call on the main thread only. void PlaybackEnded(); diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 23767acdda2f..dba6d0438db9 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1282,9 +1282,6 @@ void MediaDecoderStateMachine::Shutdown() // threads can start exiting cleanly during the Shutdown call. ScheduleStateMachine(); SetState(DECODER_STATE_SHUTDOWN); - if (mAudioSink) { - mAudioSink->PrepareToShutdown(); - } mQueuedSeek.RejectIfExists(__func__); mPendingSeek.RejectIfExists(__func__); @@ -1473,11 +1470,7 @@ void MediaDecoderStateMachine::StopAudioThread() if (mAudioSink) { DECODER_LOG("Shutdown audio thread"); - mAudioSink->PrepareToShutdown(); - { - ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); - mAudioSink->Shutdown(); - } + mAudioSink->Shutdown(); mAudioSink = nullptr; } mAudioSinkPromise.DisconnectIfExists(); @@ -2374,7 +2367,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine() elapsed < TimeDuration::FromSeconds(mBufferingWait * mPlaybackRate) && (mQuickBuffering ? HasLowDecodedData(mQuickBufferingLowDataThresholdUsecs) : HasLowUndecodedData(mBufferingWait * USECS_PER_S)) && - mDecoder->IsExpectingMoreData()) + mResource->IsExpectingMoreData()) { DECODER_LOG("Buffering: wait %ds, timeout in %.3lfs %s", mBufferingWait, mBufferingWait - elapsed.ToSeconds(), @@ -2734,7 +2727,7 @@ void MediaDecoderStateMachine::UpdateRenderedVideoFrames() // If we don't, switch to buffering mode. if (mState == DECODER_STATE_DECODING && mPlayState == MediaDecoder::PLAY_STATE_PLAYING && - mDecoder->IsExpectingMoreData()) { + mResource->IsExpectingMoreData()) { bool shouldBuffer; if (mReader->UseBufferingHeuristics()) { shouldBuffer = HasLowDecodedData(remainingTime + EXHAUSTED_DATA_MARGIN_USECS) && diff --git a/dom/media/MediaResource.h b/dom/media/MediaResource.h index 783c9ca852ab..87d3794e8916 100644 --- a/dom/media/MediaResource.h +++ b/dom/media/MediaResource.h @@ -402,6 +402,15 @@ public: // Returns true if all the data from aOffset to the end of the stream // is in cache. If the end of the stream is not known, we return false. virtual bool IsDataCachedToEndOfResource(int64_t aOffset) = 0; + // Returns true if we are expecting any more data to arrive + // sometime in the not-too-distant future, either from the network or from + // an appendBuffer call on a MediaSource element. + virtual bool IsExpectingMoreData() + { + // MediaDecoder::mDecoderPosition is roughly the same as Tell() which + // returns a position updated by latest Read() or ReadAt(). + return !IsDataCachedToEndOfResource(Tell()) && !IsSuspended(); + } // Returns true if this stream is suspended by the cache because the // cache is full. If true then the decoder should try to start consuming // data, otherwise we may not be able to make progress. diff --git a/dom/media/gmp-plugin/gmp-test-output-protection.h b/dom/media/gmp-plugin/gmp-test-output-protection.h index 4a56f6bd7145..54b4fa739174 100644 --- a/dom/media/gmp-plugin/gmp-test-output-protection.h +++ b/dom/media/gmp-plugin/gmp-test-output-protection.h @@ -49,7 +49,7 @@ static BOOL CALLBACK EnumDisplayMonitorsCallback(HMONITOR hMonitor, HDC hdc, &numVideoOutputs, &opmVideoOutputArray); if (S_OK != hr) { - if (0x8007001f != hr && 0x80070032 != hr) { + if (0x8007001f != hr && 0x80070032 != hr && 0xc02625e5 != hr) { char msg[100]; sprintf(msg, "FAIL OPMGetVideoOutputsFromHMONITOR call failed: HRESULT=0x%08x", hr); failureMsgs->push_back(msg); diff --git a/dom/media/mediasource/MediaSourceDecoder.cpp b/dom/media/mediasource/MediaSourceDecoder.cpp index a8a813753694..9366862d69ec 100644 --- a/dom/media/mediasource/MediaSourceDecoder.cpp +++ b/dom/media/mediasource/MediaSourceDecoder.cpp @@ -215,12 +215,6 @@ MediaSourceDecoder::Ended(bool aEnded) mon.NotifyAll(); } -bool -MediaSourceDecoder::IsExpectingMoreData() -{ - return !mEnded; -} - void MediaSourceDecoder::SetInitialDuration(int64_t aDuration) { diff --git a/dom/media/mediasource/MediaSourceDecoder.h b/dom/media/mediasource/MediaSourceDecoder.h index 43330388d3ee..f79554b0beed 100644 --- a/dom/media/mediasource/MediaSourceDecoder.h +++ b/dom/media/mediasource/MediaSourceDecoder.h @@ -65,7 +65,6 @@ public: void OnTrackBufferConfigured(TrackBuffer* aTrackBuffer, const MediaInfo& aInfo); void Ended(bool aEnded); - bool IsExpectingMoreData() override; // Return the duration of the video in seconds. virtual double GetDuration() override; diff --git a/dom/media/mediasource/MediaSourceResource.h b/dom/media/mediasource/MediaSourceResource.h index b6736124bd3e..7c485f41285c 100644 --- a/dom/media/mediasource/MediaSourceResource.h +++ b/dom/media/mediasource/MediaSourceResource.h @@ -77,6 +77,12 @@ public: mEnded = aEnded; } + virtual bool IsExpectingMoreData() override + { + MonitorAutoLock mon(mMonitor); + return !mEnded; + } + private: virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override { diff --git a/dom/settings/SettingsRequestManager.jsm b/dom/settings/SettingsRequestManager.jsm index 92a015fe952e..416411bdac31 100644 --- a/dom/settings/SettingsRequestManager.jsm +++ b/dom/settings/SettingsRequestManager.jsm @@ -54,8 +54,12 @@ const kAllSettingsWritePermission = "settings" + kSettingsWriteSuffix; // will be allowed depends on the exact permissions the app has. const kSomeSettingsReadPermission = "settings-api" + kSettingsReadSuffix; const kSomeSettingsWritePermission = "settings-api" + kSettingsWriteSuffix; + // Time, in seconds, to consider the API is starting to jam -const kSoftLockupDelta = 30; +let kSoftLockupDelta = 30; +try { + kSoftLockupDelta = Services.prefs.getIntPref("dom.mozSettings.softLockupDelta"); +} catch (ex) { } XPCOMUtils.defineLazyServiceGetter(this, "mrm", "@mozilla.org/memory-reporter-manager;1", diff --git a/dom/storage/DOMStorageManager.cpp b/dom/storage/DOMStorageManager.cpp index 2c658aa533bf..5d0878bfd1fc 100644 --- a/dom/storage/DOMStorageManager.cpp +++ b/dom/storage/DOMStorageManager.cpp @@ -472,34 +472,18 @@ DOMStorageManager::GetLocalStorageForPrincipal(nsIPrincipal* aPrincipal, return CreateStorage(nullptr, aPrincipal, aDocumentURI, aPrivate, aRetval); } -namespace { - -class ClearCacheEnumeratorData +void +DOMStorageManager::ClearCaches(uint32_t aUnloadFlags, + const nsACString& aKeyPrefix) { -public: - explicit ClearCacheEnumeratorData(uint32_t aFlags) - : mUnloadFlags(aFlags) - {} + for (auto iter = mCaches.Iter(); !iter.Done(); iter.Next()) { + DOMStorageCache* cache = iter.Get()->cache(); + nsCString& key = const_cast(cache->Scope()); - uint32_t mUnloadFlags; - nsCString mKeyPrefix; -}; - -} // namespace - -PLDHashOperator -DOMStorageManager::ClearCacheEnumerator(DOMStorageCacheHashKey* aEntry, void* aClosure) -{ - DOMStorageCache* cache = aEntry->cache(); - nsCString& key = const_cast(cache->Scope()); - - ClearCacheEnumeratorData* data = static_cast(aClosure); - - if (data->mKeyPrefix.IsEmpty() || StringBeginsWith(key, data->mKeyPrefix)) { - cache->UnloadItems(data->mUnloadFlags); + if (aKeyPrefix.IsEmpty() || StringBeginsWith(key, aKeyPrefix)) { + cache->UnloadItems(aUnloadFlags); + } } - - return PL_DHASH_NEXT; } nsresult @@ -507,37 +491,27 @@ DOMStorageManager::Observe(const char* aTopic, const nsACString& aScopePrefix) { // Clear everything, caches + database if (!strcmp(aTopic, "cookie-cleared")) { - ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete); - mCaches.EnumerateEntries(ClearCacheEnumerator, &data); - + ClearCaches(DOMStorageCache::kUnloadComplete, EmptyCString()); return NS_OK; } // Clear from caches everything that has been stored // while in session-only mode if (!strcmp(aTopic, "session-only-cleared")) { - ClearCacheEnumeratorData data(DOMStorageCache::kUnloadSession); - data.mKeyPrefix = aScopePrefix; - mCaches.EnumerateEntries(ClearCacheEnumerator, &data); - + ClearCaches(DOMStorageCache::kUnloadSession, aScopePrefix); return NS_OK; } // Clear everything (including so and pb data) from caches and database // for the gived domain and subdomains. if (!strcmp(aTopic, "domain-data-cleared")) { - ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete); - data.mKeyPrefix = aScopePrefix; - mCaches.EnumerateEntries(ClearCacheEnumerator, &data); - + ClearCaches(DOMStorageCache::kUnloadComplete, aScopePrefix); return NS_OK; } // Clear all private-browsing caches if (!strcmp(aTopic, "private-browsing-data-cleared")) { - ClearCacheEnumeratorData data(DOMStorageCache::kUnloadPrivate); - mCaches.EnumerateEntries(ClearCacheEnumerator, &data); - + ClearCaches(DOMStorageCache::kUnloadPrivate, EmptyCString()); return NS_OK; } @@ -549,18 +523,13 @@ DOMStorageManager::Observe(const char* aTopic, const nsACString& aScopePrefix) return NS_OK; } - ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete); - data.mKeyPrefix = aScopePrefix; - mCaches.EnumerateEntries(ClearCacheEnumerator, &data); - + ClearCaches(DOMStorageCache::kUnloadComplete, aScopePrefix); return NS_OK; } if (!strcmp(aTopic, "profile-change")) { // For case caches are still referenced - clear them completely - ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete); - mCaches.EnumerateEntries(ClearCacheEnumerator, &data); - + ClearCaches(DOMStorageCache::kUnloadComplete, EmptyCString()); mCaches.Clear(); return NS_OK; } @@ -588,8 +557,7 @@ DOMStorageManager::Observe(const char* aTopic, const nsACString& aScopePrefix) } // This immediately completely reloads all caches from the database. - ClearCacheEnumeratorData data(DOMStorageCache::kTestReload); - mCaches.EnumerateEntries(ClearCacheEnumerator, &data); + ClearCaches(DOMStorageCache::kTestReload, EmptyCString()); return NS_OK; } diff --git a/dom/storage/DOMStorageManager.h b/dom/storage/DOMStorageManager.h index 385e9f7cdf76..163097f774ec 100644 --- a/dom/storage/DOMStorageManager.h +++ b/dom/storage/DOMStorageManager.h @@ -99,8 +99,7 @@ private: bool mLowDiskSpace; bool IsLowDiskSpace() const { return mLowDiskSpace; }; - static PLDHashOperator ClearCacheEnumerator(DOMStorageCacheHashKey* aCache, - void* aClosure); + void ClearCaches(uint32_t aUnloadFlags, const nsACString& aKeyPrefix); protected: // Keeps usage cache objects for eTLD+1 scopes we have touched. diff --git a/gfx/layers/composite/TiledContentHost.cpp b/gfx/layers/composite/TiledContentHost.cpp index fff477bfb6ad..a1ddf29ca4d7 100644 --- a/gfx/layers/composite/TiledContentHost.cpp +++ b/gfx/layers/composite/TiledContentHost.cpp @@ -296,6 +296,7 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles, } tile.mTextureHost = TextureHost::AsTextureHost(texturedDesc.textureParent()); + tile.mTextureHost->SetCompositor(aCompositor); if (texturedDesc.textureOnWhite().type() == MaybeTexture::TPTextureParent) { tile.mTextureHostOnWhite = diff --git a/js/src/asmjs/AsmJSValidate.cpp b/js/src/asmjs/AsmJSValidate.cpp index 74c0163a701a..b3ed75184d1d 100644 --- a/js/src/asmjs/AsmJSValidate.cpp +++ b/js/src/asmjs/AsmJSValidate.cpp @@ -8497,7 +8497,7 @@ CheckComparison(FunctionBuilder& f, ParseNode* comp, Type* type) } I32 stmt; - if (lhsType.isSigned()) { + if (lhsType.isSigned() && rhsType.isSigned()) { switch (comp->getOp()) { case JSOP_EQ: stmt = I32::EqI32; break; case JSOP_NE: stmt = I32::NeI32; break; @@ -8507,7 +8507,7 @@ CheckComparison(FunctionBuilder& f, ParseNode* comp, Type* type) case JSOP_GE: stmt = I32::SGeI32; break; default: MOZ_CRASH("unexpected comparison op"); } - } else if (lhsType.isUnsigned()) { + } else if (lhsType.isUnsigned() && rhsType.isUnsigned()) { switch (comp->getOp()) { case JSOP_EQ: stmt = I32::EqI32; break; case JSOP_NE: stmt = I32::NeI32; break; diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index b7c38fa568ab..9c334be1bece 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -2651,6 +2651,32 @@ SetGCCallback(JSContext* cx, unsigned argc, Value* vp) return true; } +static bool +SetARMHwCapFlags(JSContext* cx, unsigned argc, Value* vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + + if (args.length() != 1) { + JS_ReportError(cx, "Wrong number of arguments"); + return false; + } + + RootedString flagsListString(cx, JS::ToString(cx, args.get(0))); + if (!flagsListString) + return false; + +#if defined(JS_CODEGEN_ARM) + JSAutoByteString flagsList(cx, flagsListString); + if (!flagsList) + return false; + + jit::ParseARMHwCapFlags(flagsList.ptr()); +#endif + + args.rval().setUndefined(); + return true; +} + static const JSFunctionSpecWithHelp TestingFunctions[] = { JS_FN_HELP("gc", ::GC, 0, 0, "gc([obj] | 'compartment' [, 'shrinking'])", @@ -3081,6 +3107,11 @@ gc::ZealModeHelpText), " 'minorGC' - run a nursery collection\n" " 'majorGC' - run a major collection, nesting up to a given 'depth'\n"), + JS_FN_HELP("setARMHwCapFlags", SetARMHwCapFlags, 1, 0, +"setARMHwCapFlags(\"flag1,flag2 flag3\")", +" On non-ARM, no-op. On ARM, set the hardware capabilities. The list of \n" +" flags is available by calling this function with \"help\" as the flag's name"), + JS_FS_HELP_END }; diff --git a/js/src/jit-test/tests/asm.js/testAtomic-effect.js b/js/src/jit-test/tests/asm.js/testAtomic-effect.js index 632e104fa840..f4b053ebac45 100644 --- a/js/src/jit-test/tests/asm.js/testAtomic-effect.js +++ b/js/src/jit-test/tests/asm.js/testAtomic-effect.js @@ -2,8 +2,9 @@ if (!this.Atomics) quit(); -function m(stdlib, ffi, heap) -{ +load(libdir + "asm.js"); + +var code = ` "use asm"; var HEAP32 = new stdlib.SharedInt32Array(heap); @@ -16,35 +17,33 @@ function m(stdlib, ffi, heap) // kernel is derived from the large test case in that bug. function add_sharedEv(i1) { - i1 = i1 | 0; - var i2 = 0; - var xx = 0; - i2 = i1 + 4 | 0; - i1 = load(HEAP32, i2 >> 2) | 0; - _emscripten_asm_const_int(7, i2 | 0, i1 | 0) | 0; - add(HEAP32, i2 >> 2, 1) | 0; - _emscripten_asm_const_int(8, i2 | 0, load(HEAP32, i2 >> 2) | 0, i1 + 1 | 0) | 0; - return xx|0; + i1 = i1 | 0; + var i2 = 0; + var xx = 0; + i2 = i1 + 4 | 0; + i1 = load(HEAP32, i2 >> 2) | 0; + _emscripten_asm_const_int(7, i2 | 0, i1 | 0) | 0; + add(HEAP32, i2 >> 2, 1) | 0; + _emscripten_asm_const_int(8, i2 | 0, load(HEAP32, i2 >> 2) | 0, i1 + 1 | 0) | 0; + return xx|0; } return {add_sharedEv:add_sharedEv}; -} - -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(m), true); +`; var x; var sab = new SharedArrayBuffer(65536); var ffi = { _emscripten_asm_const_int: - function (...rest) { - //print("OUT: " + rest.join(" ")); - if (rest[0] == 8) - x = rest[2]; - } + function (...rest) { + //print("OUT: " + rest.join(" ")); + if (rest[0] == 8) + x = rest[2]; + } }; -var {add_sharedEv} = m(this, ffi, sab); +var m = asmCompile('stdlib', 'ffi', 'heap', code); +var {add_sharedEv} = asmLink(m, this, ffi, sab); add_sharedEv(13812); assertEq(x, 1); diff --git a/js/src/jit-test/tests/asm.js/testAtomics.js b/js/src/jit-test/tests/asm.js/testAtomics.js index 2d8e15f98d5d..2a183dc3e4f4 100644 --- a/js/src/jit-test/tests/asm.js/testAtomics.js +++ b/js/src/jit-test/tests/asm.js/testAtomics.js @@ -5,9 +5,10 @@ if (!this.SharedArrayBuffer || !this.SharedInt32Array || !this.Atomics) // The code duplication below is very far from elegant but provides // flexibility that comes in handy several places. -function loadModule_int32(stdlib, foreign, heap) { - "use asm"; +load(libdir + "asm.js"); +var loadModule_int32_code = + USE_ASM + ` var atomic_fence = stdlib.Atomics.fence; var atomic_load = stdlib.Atomics.load; var atomic_store = stdlib.Atomics.store; @@ -22,52 +23,52 @@ function loadModule_int32(stdlib, foreign, heap) { var i32a = new stdlib.SharedInt32Array(heap); function do_fence() { - atomic_fence(); + atomic_fence(); } // Load element 0 function do_load() { - var v = 0; - v = atomic_load(i32a, 0)|0; - return v|0; + var v = 0; + v = atomic_load(i32a, 0)|0; + return v|0; } // Load element i function do_load_i(i) { - i = i|0; - var v = 0; - v = atomic_load(i32a, i>>2)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_load(i32a, i>>2)|0; + return v|0; } // Store 37 in element 0 function do_store() { - var v = 0; - v = atomic_store(i32a, 0, 37)|0; - return v|0; + var v = 0; + v = atomic_store(i32a, 0, 37)|0; + return v|0; } // Store 37 in element i function do_store_i(i) { - i = i|0; - var v = 0; - v = atomic_store(i32a, i>>2, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_store(i32a, i>>2, 37)|0; + return v|0; } // Exchange 37 into element 200 function do_xchg() { - var v = 0; - v = atomic_exchange(i32a, 200, 37)|0; - return v|0; + var v = 0; + v = atomic_exchange(i32a, 200, 37)|0; + return v|0; } // Exchange 42 into element i function do_xchg_i(i) { - i = i|0; - var v = 0; - v = atomic_exchange(i32a, i>>2, 42)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_exchange(i32a, i>>2, 42)|0; + return v|0; } // Exchange 1+2 into element 200. This is not called; all we're @@ -75,185 +76,182 @@ function loadModule_int32(stdlib, foreign, heap) { // "intish" (asm.js spec "AdditiveExpression") and this should be // allowed. function do_xchg_intish() { - var v = 0; - v = atomic_exchange(i32a, 200, 1+2)|0; - return v|0; + var v = 0; + v = atomic_exchange(i32a, 200, 1+2)|0; + return v|0; } // Add 37 to element 10 function do_add() { - var v = 0; - v = atomic_add(i32a, 10, 37)|0; - return v|0; + var v = 0; + v = atomic_add(i32a, 10, 37)|0; + return v|0; } // Add 37 to element i function do_add_i(i) { - i = i|0; - var v = 0; - v = atomic_add(i32a, i>>2, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_add(i32a, i>>2, 37)|0; + return v|0; } // As for do_xchg_intish, above. Given the structure of the // compiler, this covers all the binops. function do_add_intish() { - var v = 0; - v = atomic_add(i32a, 10, 1+2)|0; - return v|0; + var v = 0; + v = atomic_add(i32a, 10, 1+2)|0; + return v|0; } // Subtract 148 from element 20 function do_sub() { - var v = 0; - v = atomic_sub(i32a, 20, 148)|0; - return v|0; + var v = 0; + v = atomic_sub(i32a, 20, 148)|0; + return v|0; } // Subtract 148 from element i function do_sub_i(i) { - i = i|0; - var v = 0; - v = atomic_sub(i32a, i>>2, 148)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_sub(i32a, i>>2, 148)|0; + return v|0; } // AND 0x33333333 into element 30 function do_and() { - var v = 0; - v = atomic_and(i32a, 30, 0x33333333)|0; - return v|0; + var v = 0; + v = atomic_and(i32a, 30, 0x33333333)|0; + return v|0; } // AND 0x33333333 into element i function do_and_i(i) { - i = i|0; - var v = 0; - v = atomic_and(i32a, i>>2, 0x33333333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_and(i32a, i>>2, 0x33333333)|0; + return v|0; } // OR 0x33333333 into element 40 function do_or() { - var v = 0; - v = atomic_or(i32a, 40, 0x33333333)|0; - return v|0; + var v = 0; + v = atomic_or(i32a, 40, 0x33333333)|0; + return v|0; } // OR 0x33333333 into element i function do_or_i(i) { - i = i|0; - var v = 0; - v = atomic_or(i32a, i>>2, 0x33333333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_or(i32a, i>>2, 0x33333333)|0; + return v|0; } // XOR 0x33333333 into element 50 function do_xor() { - var v = 0; - v = atomic_xor(i32a, 50, 0x33333333)|0; - return v|0; + var v = 0; + v = atomic_xor(i32a, 50, 0x33333333)|0; + return v|0; } // XOR 0x33333333 into element i function do_xor_i(i) { - i = i|0; - var v = 0; - v = atomic_xor(i32a, i>>2, 0x33333333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_xor(i32a, i>>2, 0x33333333)|0; + return v|0; } // CAS element 100: 0 -> -1 function do_cas1() { - var v = 0; - v = atomic_cmpxchg(i32a, 100, 0, -1)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i32a, 100, 0, -1)|0; + return v|0; } // As for do_xchg_intish, above. Will not be called, is here just // to test that the compiler allows intish arguments. function do_cas_intish() { - var v = 0; - v = atomic_cmpxchg(i32a, 100, 1+2, 2+3)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i32a, 100, 1+2, 2+3)|0; + return v|0; } // CAS element 100: -1 -> 0x5A5A5A5A function do_cas2() { - var v = 0; - v = atomic_cmpxchg(i32a, 100, -1, 0x5A5A5A5A)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i32a, 100, -1, 0x5A5A5A5A)|0; + return v|0; } // CAS element i: 0 -> -1 function do_cas1_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i32a, i>>2, 0, -1)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i32a, i>>2, 0, -1)|0; + return v|0; } // CAS element i: -1 -> 0x5A5A5A5A function do_cas2_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i32a, i>>2, -1, 0x5A5A5A5A)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i32a, i>>2, -1, 0x5A5A5A5A)|0; + return v|0; } return { fence: do_fence, - load: do_load, - load_i: do_load_i, - store: do_store, - store_i: do_store_i, - xchg: do_xchg, - xchg_i: do_xchg_i, - xchg_intish: do_xchg_intish, - add: do_add, - add_i: do_add_i, - add_intish: do_add_intish, - sub: do_sub, - sub_i: do_sub_i, - and: do_and, - and_i: do_and_i, - or: do_or, - or_i: do_or_i, - xor: do_xor, - xor_i: do_xor_i, - cas1: do_cas1, - cas2: do_cas2, - cas_intish: do_cas_intish, - cas1_i: do_cas1_i, - cas2_i: do_cas2_i }; -} + load: do_load, + load_i: do_load_i, + store: do_store, + store_i: do_store_i, + xchg: do_xchg, + xchg_i: do_xchg_i, + xchg_intish: do_xchg_intish, + add: do_add, + add_i: do_add_i, + add_intish: do_add_intish, + sub: do_sub, + sub_i: do_sub_i, + and: do_and, + and_i: do_and_i, + or: do_or, + or_i: do_or_i, + xor: do_xor, + xor_i: do_xor_i, + cas1: do_cas1, + cas2: do_cas2, + cas_intish: do_cas_intish, + cas1_i: do_cas1_i, + cas2_i: do_cas2_i }; +`; -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_int32), true); +var loadModule_int32 = asmCompile('stdlib', 'foreign', 'heap', loadModule_int32_code); // Test that compilation fails without a coercion on the return value. // The module is never created, we use it only for its effect. -function loadModule_int32_return_xchg(stdlib, foreign, heap) { - "use asm"; - +var loadModule_int32_return_xchg_code = + USE_ASM + ` var atomic_exchange = stdlib.Atomics.exchange; var i32a = new stdlib.SharedInt32Array(heap); function do_xchg() { - var v = 0; - v = atomic_exchange(i32a, 200, 37); // Should not be allowed without |0 at the end - return v|0; + var v = 0; + v = atomic_exchange(i32a, 200, 37); // Should not be allowed without |0 at the end + return v|0; } return { xchg: do_xchg } -} +`; -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_int32_return_xchg), false); +assertAsmTypeFail('stdlib', 'foreign', 'heap', loadModule_int32_return_xchg_code); function test_int32(heap) { var i32a = new SharedInt32Array(heap); - var i32m = loadModule_int32(this, {}, heap); + var i32m = asmLink(loadModule_int32, this, {}, heap); var size = SharedInt32Array.BYTES_PER_ELEMENT; @@ -330,9 +328,8 @@ function test_int32(heap) { assertEq(i32m.sub_i(oob), 0); } -function loadModule_uint32(stdlib, foreign, heap) { - "use asm"; - +var loadModule_uint32_code = + USE_ASM + ` var atomic_fence = stdlib.Atomics.fence; var atomic_load = stdlib.Atomics.load; var atomic_store = stdlib.Atomics.store; @@ -348,178 +345,177 @@ function loadModule_uint32(stdlib, foreign, heap) { // Load element 0 function do_load() { - var v = 0; - v = atomic_load(i32a, 0)|0; - return +(v>>>0); + var v = 0; + v = atomic_load(i32a, 0)|0; + return +(v>>>0); } // Load element i function do_load_i(i) { - i = i|0; - var v = 0; - v = atomic_load(i32a, i>>2)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_load(i32a, i>>2)|0; + return +(v>>>0); } // Store 37 in element 0 function do_store() { - var v = 0; - v = atomic_store(i32a, 0, 37)|0; - return +(v>>>0); + var v = 0; + v = atomic_store(i32a, 0, 37)|0; + return +(v>>>0); } // Store 37 in element i function do_store_i(i) { - i = i|0; - var v = 0; - v = atomic_store(i32a, i>>2, 37)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_store(i32a, i>>2, 37)|0; + return +(v>>>0); } // Exchange 37 into element 200 function do_xchg() { - var v = 0; - v = atomic_exchange(i32a, 200, 37)|0; - return v|0; + var v = 0; + v = atomic_exchange(i32a, 200, 37)|0; + return v|0; } // Exchange 42 into element i function do_xchg_i(i) { - i = i|0; - var v = 0; - v = atomic_exchange(i32a, i>>2, 42)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_exchange(i32a, i>>2, 42)|0; + return v|0; } // Add 37 to element 10 function do_add() { - var v = 0; - v = atomic_add(i32a, 10, 37)|0; - return +(v>>>0); + var v = 0; + v = atomic_add(i32a, 10, 37)|0; + return +(v>>>0); } // Add 37 to element i function do_add_i(i) { - i = i|0; - var v = 0; - v = atomic_add(i32a, i>>2, 37)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_add(i32a, i>>2, 37)|0; + return +(v>>>0); } // Subtract 148 from element 20 function do_sub() { - var v = 0; - v = atomic_sub(i32a, 20, 148)|0; - return +(v>>>0); + var v = 0; + v = atomic_sub(i32a, 20, 148)|0; + return +(v>>>0); } // Subtract 148 from element i function do_sub_i(i) { - i = i|0; - var v = 0; - v = atomic_sub(i32a, i>>2, 148)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_sub(i32a, i>>2, 148)|0; + return +(v>>>0); } // AND 0x33333333 into element 30 function do_and() { - var v = 0; - v = atomic_and(i32a, 30, 0x33333333)|0; - return +(v>>>0); + var v = 0; + v = atomic_and(i32a, 30, 0x33333333)|0; + return +(v>>>0); } // AND 0x33333333 into element i function do_and_i(i) { - i = i|0; - var v = 0; - v = atomic_and(i32a, i>>2, 0x33333333)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_and(i32a, i>>2, 0x33333333)|0; + return +(v>>>0); } // OR 0x33333333 into element 40 function do_or() { - var v = 0; - v = atomic_or(i32a, 40, 0x33333333)|0; - return +(v>>>0); + var v = 0; + v = atomic_or(i32a, 40, 0x33333333)|0; + return +(v>>>0); } // OR 0x33333333 into element i function do_or_i(i) { - i = i|0; - var v = 0; - v = atomic_or(i32a, i>>2, 0x33333333)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_or(i32a, i>>2, 0x33333333)|0; + return +(v>>>0); } // XOR 0x33333333 into element 50 function do_xor() { - var v = 0; - v = atomic_xor(i32a, 50, 0x33333333)|0; - return +(v>>>0); + var v = 0; + v = atomic_xor(i32a, 50, 0x33333333)|0; + return +(v>>>0); } // XOR 0x33333333 into element i function do_xor_i(i) { - i = i|0; - var v = 0; - v = atomic_xor(i32a, i>>2, 0x33333333)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_xor(i32a, i>>2, 0x33333333)|0; + return +(v>>>0); } // CAS element 100: 0 -> -1 function do_cas1() { - var v = 0; - v = atomic_cmpxchg(i32a, 100, 0, -1)|0; - return +(v>>>0); + var v = 0; + v = atomic_cmpxchg(i32a, 100, 0, -1)|0; + return +(v>>>0); } // CAS element 100: -1 -> 0x5A5A5A5A function do_cas2() { - var v = 0; - v = atomic_cmpxchg(i32a, 100, -1, 0x5A5A5A5A)|0; - return +(v>>>0); + var v = 0; + v = atomic_cmpxchg(i32a, 100, -1, 0x5A5A5A5A)|0; + return +(v>>>0); } // CAS element i: 0 -> -1 function do_cas1_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i32a, i>>2, 0, -1)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_cmpxchg(i32a, i>>2, 0, -1)|0; + return +(v>>>0); } // CAS element i: -1 -> 0x5A5A5A5A function do_cas2_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i32a, i>>2, -1, 0x5A5A5A5A)|0; - return +(v>>>0); + i = i|0; + var v = 0; + v = atomic_cmpxchg(i32a, i>>2, -1, 0x5A5A5A5A)|0; + return +(v>>>0); } return { load: do_load, - load_i: do_load_i, - store: do_store, - store_i: do_store_i, - xchg: do_xchg, - xchg_i: do_xchg_i, - add: do_add, - add_i: do_add_i, - sub: do_sub, - sub_i: do_sub_i, - and: do_and, - and_i: do_and_i, - or: do_or, - or_i: do_or_i, - xor: do_xor, - xor_i: do_xor_i, - cas1: do_cas1, - cas2: do_cas2, - cas1_i: do_cas1_i, - cas2_i: do_cas2_i }; -} + load_i: do_load_i, + store: do_store, + store_i: do_store_i, + xchg: do_xchg, + xchg_i: do_xchg_i, + add: do_add, + add_i: do_add_i, + sub: do_sub, + sub_i: do_sub_i, + and: do_and, + and_i: do_and_i, + or: do_or, + or_i: do_or_i, + xor: do_xor, + xor_i: do_xor_i, + cas1: do_cas1, + cas2: do_cas2, + cas1_i: do_cas1_i, + cas2_i: do_cas2_i }; +`; -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_uint32), true); +var loadModule_uint32 = asmCompile('stdlib', 'foreign', 'heap', loadModule_uint32_code); function test_uint32(heap) { var i32a = new SharedUint32Array(heap); @@ -598,9 +594,8 @@ function test_uint32(heap) { assertEq(i32m.sub_i(oob), 0); } -function loadModule_int16(stdlib, foreign, heap) { - "use asm"; - +var loadModule_int16_code = + USE_ASM + ` var atomic_fence = stdlib.Atomics.fence; var atomic_load = stdlib.Atomics.load; var atomic_store = stdlib.Atomics.store; @@ -615,184 +610,183 @@ function loadModule_int16(stdlib, foreign, heap) { var i16a = new stdlib.SharedInt16Array(heap); function do_fence() { - atomic_fence(); + atomic_fence(); } // Load element 0 function do_load() { - var v = 0; - v = atomic_load(i16a, 0)|0; - return v|0; + var v = 0; + v = atomic_load(i16a, 0)|0; + return v|0; } // Load element i function do_load_i(i) { - i = i|0; - var v = 0; - v = atomic_load(i16a, i>>1)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_load(i16a, i>>1)|0; + return v|0; } // Store 37 in element 0 function do_store() { - var v = 0; - v = atomic_store(i16a, 0, 37)|0; - return v|0; + var v = 0; + v = atomic_store(i16a, 0, 37)|0; + return v|0; } // Store 37 in element i function do_store_i(i) { - i = i|0; - var v = 0; - v = atomic_store(i16a, i>>1, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_store(i16a, i>>1, 37)|0; + return v|0; } // Exchange 37 into element 200 function do_xchg() { - var v = 0; - v = atomic_exchange(i16a, 200, 37)|0; - return v|0; + var v = 0; + v = atomic_exchange(i16a, 200, 37)|0; + return v|0; } // Exchange 42 into element i function do_xchg_i(i) { - i = i|0; - var v = 0; - v = atomic_exchange(i16a, i>>1, 42)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_exchange(i16a, i>>1, 42)|0; + return v|0; } // Add 37 to element 10 function do_add() { - var v = 0; - v = atomic_add(i16a, 10, 37)|0; - return v|0; + var v = 0; + v = atomic_add(i16a, 10, 37)|0; + return v|0; } // Add 37 to element i function do_add_i(i) { - i = i|0; - var v = 0; - v = atomic_add(i16a, i>>1, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_add(i16a, i>>1, 37)|0; + return v|0; } // Subtract 148 from element 20 function do_sub() { - var v = 0; - v = atomic_sub(i16a, 20, 148)|0; - return v|0; + var v = 0; + v = atomic_sub(i16a, 20, 148)|0; + return v|0; } // Subtract 148 from element i function do_sub_i(i) { - i = i|0; - var v = 0; - v = atomic_sub(i16a, i>>1, 148)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_sub(i16a, i>>1, 148)|0; + return v|0; } // AND 0x3333 into element 30 function do_and() { - var v = 0; - v = atomic_and(i16a, 30, 0x3333)|0; - return v|0; + var v = 0; + v = atomic_and(i16a, 30, 0x3333)|0; + return v|0; } // AND 0x3333 into element i function do_and_i(i) { - i = i|0; - var v = 0; - v = atomic_and(i16a, i>>1, 0x3333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_and(i16a, i>>1, 0x3333)|0; + return v|0; } // OR 0x3333 into element 40 function do_or() { - var v = 0; - v = atomic_or(i16a, 40, 0x3333)|0; - return v|0; + var v = 0; + v = atomic_or(i16a, 40, 0x3333)|0; + return v|0; } // OR 0x3333 into element i function do_or_i(i) { - i = i|0; - var v = 0; - v = atomic_or(i16a, i>>1, 0x3333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_or(i16a, i>>1, 0x3333)|0; + return v|0; } // XOR 0x3333 into element 50 function do_xor() { - var v = 0; - v = atomic_xor(i16a, 50, 0x3333)|0; - return v|0; + var v = 0; + v = atomic_xor(i16a, 50, 0x3333)|0; + return v|0; } // XOR 0x3333 into element i function do_xor_i(i) { - i = i|0; - var v = 0; - v = atomic_xor(i16a, i>>1, 0x3333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_xor(i16a, i>>1, 0x3333)|0; + return v|0; } // CAS element 100: 0 -> -1 function do_cas1() { - var v = 0; - v = atomic_cmpxchg(i16a, 100, 0, -1)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i16a, 100, 0, -1)|0; + return v|0; } // CAS element 100: -1 -> 0x5A5A function do_cas2() { - var v = 0; - v = atomic_cmpxchg(i16a, 100, -1, 0x5A5A)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i16a, 100, -1, 0x5A5A)|0; + return v|0; } // CAS element i: 0 -> -1 function do_cas1_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i16a, i>>1, 0, -1)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i16a, i>>1, 0, -1)|0; + return v|0; } // CAS element i: -1 -> 0x5A5A function do_cas2_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i16a, i>>1, -1, 0x5A5A)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i16a, i>>1, -1, 0x5A5A)|0; + return v|0; } return { fence: do_fence, - load: do_load, - load_i: do_load_i, - store: do_store, - store_i: do_store_i, - xchg: do_xchg, - xchg_i: do_xchg_i, - add: do_add, - add_i: do_add_i, - sub: do_sub, - sub_i: do_sub_i, - and: do_and, - and_i: do_and_i, - or: do_or, - or_i: do_or_i, - xor: do_xor, - xor_i: do_xor_i, - cas1: do_cas1, - cas2: do_cas2, - cas1_i: do_cas1_i, - cas2_i: do_cas2_i }; -} + load: do_load, + load_i: do_load_i, + store: do_store, + store_i: do_store_i, + xchg: do_xchg, + xchg_i: do_xchg_i, + add: do_add, + add_i: do_add_i, + sub: do_sub, + sub_i: do_sub_i, + and: do_and, + and_i: do_and_i, + or: do_or, + or_i: do_or_i, + xor: do_xor, + xor_i: do_xor_i, + cas1: do_cas1, + cas2: do_cas2, + cas1_i: do_cas1_i, + cas2_i: do_cas2_i }; +` -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_int16), true); +var loadModule_int16 = asmCompile('stdlib', 'foreign', 'heap', loadModule_int16_code); function test_int16(heap) { var i16a = new SharedInt16Array(heap); @@ -881,9 +875,8 @@ function test_int16(heap) { assertEq(i16m.sub_i(oob), 0); } -function loadModule_uint16(stdlib, foreign, heap) { - "use asm"; - +var loadModule_uint16_code = + USE_ASM + ` var atomic_load = stdlib.Atomics.load; var atomic_store = stdlib.Atomics.store; var atomic_cmpxchg = stdlib.Atomics.compareExchange; @@ -898,178 +891,177 @@ function loadModule_uint16(stdlib, foreign, heap) { // Load element 0 function do_load() { - var v = 0; - v = atomic_load(i16a, 0)|0; - return v|0; + var v = 0; + v = atomic_load(i16a, 0)|0; + return v|0; } // Load element i function do_load_i(i) { - i = i|0; - var v = 0; - v = atomic_load(i16a, i>>1)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_load(i16a, i>>1)|0; + return v|0; } // Store 37 in element 0 function do_store() { - var v = 0; - v = atomic_store(i16a, 0, 37)|0; - return v|0; + var v = 0; + v = atomic_store(i16a, 0, 37)|0; + return v|0; } // Store 37 in element i function do_store_i(i) { - i = i|0; - var v = 0; - v = atomic_store(i16a, i>>1, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_store(i16a, i>>1, 37)|0; + return v|0; } // Exchange 37 into element 200 function do_xchg() { - var v = 0; - v = atomic_exchange(i16a, 200, 37)|0; - return v|0; + var v = 0; + v = atomic_exchange(i16a, 200, 37)|0; + return v|0; } // Exchange 42 into element i function do_xchg_i(i) { - i = i|0; - var v = 0; - v = atomic_exchange(i16a, i>>1, 42)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_exchange(i16a, i>>1, 42)|0; + return v|0; } // Add 37 to element 10 function do_add() { - var v = 0; - v = atomic_add(i16a, 10, 37)|0; - return v|0; + var v = 0; + v = atomic_add(i16a, 10, 37)|0; + return v|0; } // Add 37 to element i function do_add_i(i) { - i = i|0; - var v = 0; - v = atomic_add(i16a, i>>1, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_add(i16a, i>>1, 37)|0; + return v|0; } // Subtract 148 from element 20 function do_sub() { - var v = 0; - v = atomic_sub(i16a, 20, 148)|0; - return v|0; + var v = 0; + v = atomic_sub(i16a, 20, 148)|0; + return v|0; } // Subtract 148 from element i function do_sub_i(i) { - i = i|0; - var v = 0; - v = atomic_sub(i16a, i>>1, 148)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_sub(i16a, i>>1, 148)|0; + return v|0; } // AND 0x3333 into element 30 function do_and() { - var v = 0; - v = atomic_and(i16a, 30, 0x3333)|0; - return v|0; + var v = 0; + v = atomic_and(i16a, 30, 0x3333)|0; + return v|0; } // AND 0x3333 into element i function do_and_i(i) { - i = i|0; - var v = 0; - v = atomic_and(i16a, i>>1, 0x3333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_and(i16a, i>>1, 0x3333)|0; + return v|0; } // OR 0x3333 into element 40 function do_or() { - var v = 0; - v = atomic_or(i16a, 40, 0x3333)|0; - return v|0; + var v = 0; + v = atomic_or(i16a, 40, 0x3333)|0; + return v|0; } // OR 0x3333 into element i function do_or_i(i) { - i = i|0; - var v = 0; - v = atomic_or(i16a, i>>1, 0x3333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_or(i16a, i>>1, 0x3333)|0; + return v|0; } // XOR 0x3333 into element 50 function do_xor() { - var v = 0; - v = atomic_xor(i16a, 50, 0x3333)|0; - return v|0; + var v = 0; + v = atomic_xor(i16a, 50, 0x3333)|0; + return v|0; } // XOR 0x3333 into element i function do_xor_i(i) { - i = i|0; - var v = 0; - v = atomic_xor(i16a, i>>1, 0x3333)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_xor(i16a, i>>1, 0x3333)|0; + return v|0; } // CAS element 100: 0 -> -1 function do_cas1() { - var v = 0; - v = atomic_cmpxchg(i16a, 100, 0, -1)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i16a, 100, 0, -1)|0; + return v|0; } // CAS element 100: -1 -> 0x5A5A function do_cas2() { - var v = 0; - v = atomic_cmpxchg(i16a, 100, -1, 0x5A5A)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i16a, 100, -1, 0x5A5A)|0; + return v|0; } // CAS element i: 0 -> -1 function do_cas1_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i16a, i>>1, 0, -1)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i16a, i>>1, 0, -1)|0; + return v|0; } // CAS element i: -1 -> 0x5A5A function do_cas2_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i16a, i>>1, -1, 0x5A5A)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i16a, i>>1, -1, 0x5A5A)|0; + return v|0; } return { load: do_load, - load_i: do_load_i, - store: do_store, - store_i: do_store_i, - xchg: do_xchg, - xchg_i: do_xchg_i, - add: do_add, - add_i: do_add_i, - sub: do_sub, - sub_i: do_sub_i, - and: do_and, - and_i: do_and_i, - or: do_or, - or_i: do_or_i, - xor: do_xor, - xor_i: do_xor_i, - cas1: do_cas1, - cas2: do_cas2, - cas1_i: do_cas1_i, - cas2_i: do_cas2_i }; -} + load_i: do_load_i, + store: do_store, + store_i: do_store_i, + xchg: do_xchg, + xchg_i: do_xchg_i, + add: do_add, + add_i: do_add_i, + sub: do_sub, + sub_i: do_sub_i, + and: do_and, + and_i: do_and_i, + or: do_or, + or_i: do_or_i, + xor: do_xor, + xor_i: do_xor_i, + cas1: do_cas1, + cas2: do_cas2, + cas1_i: do_cas1_i, + cas2_i: do_cas2_i }; +` -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_uint16), true); +var loadModule_uint16 = asmCompile('stdlib', 'foreign', 'heap', loadModule_uint16_code); function test_uint16(heap) { var i16a = new SharedUint16Array(heap); @@ -1156,9 +1148,8 @@ function test_uint16(heap) { assertEq(i16m.sub_i(oob), 0); } -function loadModule_int8(stdlib, foreign, heap) { - "use asm"; - +var loadModule_int8_code = + USE_ASM + ` var atomic_load = stdlib.Atomics.load; var atomic_store = stdlib.Atomics.store; var atomic_cmpxchg = stdlib.Atomics.compareExchange; @@ -1173,178 +1164,177 @@ function loadModule_int8(stdlib, foreign, heap) { // Load element 0 function do_load() { - var v = 0; - v = atomic_load(i8a, 0)|0; - return v|0; + var v = 0; + v = atomic_load(i8a, 0)|0; + return v|0; } // Load element i function do_load_i(i) { - i = i|0; - var v = 0; - v = atomic_load(i8a, i)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_load(i8a, i)|0; + return v|0; } // Store 37 in element 0 function do_store() { - var v = 0; - v = atomic_store(i8a, 0, 37)|0; - return v|0; + var v = 0; + v = atomic_store(i8a, 0, 37)|0; + return v|0; } // Store 37 in element i function do_store_i(i) { - i = i|0; - var v = 0; - v = atomic_store(i8a, i, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_store(i8a, i, 37)|0; + return v|0; } // Exchange 37 into element 200 function do_xchg() { - var v = 0; - v = atomic_exchange(i8a, 200, 37)|0; - return v|0; + var v = 0; + v = atomic_exchange(i8a, 200, 37)|0; + return v|0; } // Exchange 42 into element i function do_xchg_i(i) { - i = i|0; - var v = 0; - v = atomic_exchange(i8a, i, 42)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_exchange(i8a, i, 42)|0; + return v|0; } // Add 37 to element 10 function do_add() { - var v = 0; - v = atomic_add(i8a, 10, 37)|0; - return v|0; + var v = 0; + v = atomic_add(i8a, 10, 37)|0; + return v|0; } // Add 37 to element i function do_add_i(i) { - i = i|0; - var v = 0; - v = atomic_add(i8a, i, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_add(i8a, i, 37)|0; + return v|0; } // Subtract 108 from element 20 function do_sub() { - var v = 0; - v = atomic_sub(i8a, 20, 108)|0; - return v|0; + var v = 0; + v = atomic_sub(i8a, 20, 108)|0; + return v|0; } // Subtract 108 from element i function do_sub_i(i) { - i = i|0; - var v = 0; - v = atomic_sub(i8a, i, 108)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_sub(i8a, i, 108)|0; + return v|0; } // AND 0x33 into element 30 function do_and() { - var v = 0; - v = atomic_and(i8a, 30, 0x33)|0; - return v|0; + var v = 0; + v = atomic_and(i8a, 30, 0x33)|0; + return v|0; } // AND 0x33 into element i function do_and_i(i) { - i = i|0; - var v = 0; - v = atomic_and(i8a, i, 0x33)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_and(i8a, i, 0x33)|0; + return v|0; } // OR 0x33 into element 40 function do_or() { - var v = 0; - v = atomic_or(i8a, 40, 0x33)|0; - return v|0; + var v = 0; + v = atomic_or(i8a, 40, 0x33)|0; + return v|0; } // OR 0x33 into element i function do_or_i(i) { - i = i|0; - var v = 0; - v = atomic_or(i8a, i, 0x33)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_or(i8a, i, 0x33)|0; + return v|0; } // XOR 0x33 into element 50 function do_xor() { - var v = 0; - v = atomic_xor(i8a, 50, 0x33)|0; - return v|0; + var v = 0; + v = atomic_xor(i8a, 50, 0x33)|0; + return v|0; } // XOR 0x33 into element i function do_xor_i(i) { - i = i|0; - var v = 0; - v = atomic_xor(i8a, i, 0x33)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_xor(i8a, i, 0x33)|0; + return v|0; } // CAS element 100: 0 -> -1 function do_cas1() { - var v = 0; - v = atomic_cmpxchg(i8a, 100, 0, -1)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i8a, 100, 0, -1)|0; + return v|0; } // CAS element 100: -1 -> 0x5A function do_cas2() { - var v = 0; - v = atomic_cmpxchg(i8a, 100, -1, 0x5A)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i8a, 100, -1, 0x5A)|0; + return v|0; } // CAS element i: 0 -> -1 function do_cas1_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i8a, i, 0, -1)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i8a, i, 0, -1)|0; + return v|0; } // CAS element i: -1 -> 0x5A function do_cas2_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i8a, i, -1, 0x5A)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i8a, i, -1, 0x5A)|0; + return v|0; } return { load: do_load, - load_i: do_load_i, - store: do_store, - store_i: do_store_i, - xchg: do_xchg, - xchg_i: do_xchg_i, - add: do_add, - add_i: do_add_i, - sub: do_sub, - sub_i: do_sub_i, - and: do_and, - and_i: do_and_i, - or: do_or, - or_i: do_or_i, - xor: do_xor, - xor_i: do_xor_i, - cas1: do_cas1, - cas2: do_cas2, - cas1_i: do_cas1_i, - cas2_i: do_cas2_i }; -} + load_i: do_load_i, + store: do_store, + store_i: do_store_i, + xchg: do_xchg, + xchg_i: do_xchg_i, + add: do_add, + add_i: do_add_i, + sub: do_sub, + sub_i: do_sub_i, + and: do_and, + and_i: do_and_i, + or: do_or, + or_i: do_or_i, + xor: do_xor, + xor_i: do_xor_i, + cas1: do_cas1, + cas2: do_cas2, + cas1_i: do_cas1_i, + cas2_i: do_cas2_i }; +` -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_int8), true); +var loadModule_int8 = asmCompile('stdlib', 'foreign', 'heap', loadModule_int8_code); function test_int8(heap) { var i8a = new SharedInt8Array(heap); @@ -1424,9 +1414,8 @@ function test_int8(heap) { assertEq(i8m.sub_i(oob), 0); } -function loadModule_uint8(stdlib, foreign, heap) { - "use asm"; - +var loadModule_uint8_code = + USE_ASM + ` var atomic_load = stdlib.Atomics.load; var atomic_store = stdlib.Atomics.store; var atomic_cmpxchg = stdlib.Atomics.compareExchange; @@ -1441,178 +1430,177 @@ function loadModule_uint8(stdlib, foreign, heap) { // Load element 0 function do_load() { - var v = 0; - v = atomic_load(i8a, 0)|0; - return v|0; + var v = 0; + v = atomic_load(i8a, 0)|0; + return v|0; } // Load element i function do_load_i(i) { - i = i|0; - var v = 0; - v = atomic_load(i8a, i)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_load(i8a, i)|0; + return v|0; } // Store 37 in element 0 function do_store() { - var v = 0; - v = atomic_store(i8a, 0, 37)|0; - return v|0; + var v = 0; + v = atomic_store(i8a, 0, 37)|0; + return v|0; } // Store 37 in element i function do_store_i(i) { - i = i|0; - var v = 0; - v = atomic_store(i8a, i, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_store(i8a, i, 37)|0; + return v|0; } // Exchange 37 into element 200 function do_xchg() { - var v = 0; - v = atomic_exchange(i8a, 200, 37)|0; - return v|0; + var v = 0; + v = atomic_exchange(i8a, 200, 37)|0; + return v|0; } // Exchange 42 into element i function do_xchg_i(i) { - i = i|0; - var v = 0; - v = atomic_exchange(i8a, i, 42)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_exchange(i8a, i, 42)|0; + return v|0; } // Add 37 to element 10 function do_add() { - var v = 0; - v = atomic_add(i8a, 10, 37)|0; - return v|0; + var v = 0; + v = atomic_add(i8a, 10, 37)|0; + return v|0; } // Add 37 to element i function do_add_i(i) { - i = i|0; - var v = 0; - v = atomic_add(i8a, i, 37)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_add(i8a, i, 37)|0; + return v|0; } // Subtract 108 from element 20 function do_sub() { - var v = 0; - v = atomic_sub(i8a, 20, 108)|0; - return v|0; + var v = 0; + v = atomic_sub(i8a, 20, 108)|0; + return v|0; } // Subtract 108 from element i function do_sub_i(i) { - i = i|0; - var v = 0; - v = atomic_sub(i8a, i, 108)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_sub(i8a, i, 108)|0; + return v|0; } // AND 0x33 into element 30 function do_and() { - var v = 0; - v = atomic_and(i8a, 30, 0x33)|0; - return v|0; + var v = 0; + v = atomic_and(i8a, 30, 0x33)|0; + return v|0; } // AND 0x33 into element i function do_and_i(i) { - i = i|0; - var v = 0; - v = atomic_and(i8a, i, 0x33)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_and(i8a, i, 0x33)|0; + return v|0; } // OR 0x33 into element 40 function do_or() { - var v = 0; - v = atomic_or(i8a, 40, 0x33)|0; - return v|0; + var v = 0; + v = atomic_or(i8a, 40, 0x33)|0; + return v|0; } // OR 0x33 into element i function do_or_i(i) { - i = i|0; - var v = 0; - v = atomic_or(i8a, i, 0x33)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_or(i8a, i, 0x33)|0; + return v|0; } // XOR 0x33 into element 50 function do_xor() { - var v = 0; - v = atomic_xor(i8a, 50, 0x33)|0; - return v|0; + var v = 0; + v = atomic_xor(i8a, 50, 0x33)|0; + return v|0; } // XOR 0x33 into element i function do_xor_i(i) { - i = i|0; - var v = 0; - v = atomic_xor(i8a, i, 0x33)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_xor(i8a, i, 0x33)|0; + return v|0; } // CAS element 100: 0 -> -1 function do_cas1() { - var v = 0; - v = atomic_cmpxchg(i8a, 100, 0, -1)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i8a, 100, 0, -1)|0; + return v|0; } // CAS element 100: -1 -> 0x5A function do_cas2() { - var v = 0; - v = atomic_cmpxchg(i8a, 100, -1, 0x5A)|0; - return v|0; + var v = 0; + v = atomic_cmpxchg(i8a, 100, -1, 0x5A)|0; + return v|0; } // CAS element i: 0 -> -1 function do_cas1_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i8a, i, 0, -1)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i8a, i, 0, -1)|0; + return v|0; } // CAS element i: -1 -> 0x5A function do_cas2_i(i) { - i = i|0; - var v = 0; - v = atomic_cmpxchg(i8a, i, -1, 0x5A)|0; - return v|0; + i = i|0; + var v = 0; + v = atomic_cmpxchg(i8a, i, -1, 0x5A)|0; + return v|0; } return { load: do_load, - load_i: do_load_i, - store: do_store, - store_i: do_store_i, - xchg: do_xchg, - xchg_i: do_xchg_i, - add: do_add, - add_i: do_add_i, - sub: do_sub, - sub_i: do_sub_i, - and: do_and, - and_i: do_and_i, - or: do_or, - or_i: do_or_i, - xor: do_xor, - xor_i: do_xor_i, - cas1: do_cas1, - cas2: do_cas2, - cas1_i: do_cas1_i, - cas2_i: do_cas2_i }; -} + load_i: do_load_i, + store: do_store, + store_i: do_store_i, + xchg: do_xchg, + xchg_i: do_xchg_i, + add: do_add, + add_i: do_add_i, + sub: do_sub, + sub_i: do_sub_i, + and: do_and, + and_i: do_and_i, + or: do_or, + or_i: do_or_i, + xor: do_xor, + xor_i: do_xor_i, + cas1: do_cas1, + cas2: do_cas2, + cas1_i: do_cas1_i, + cas2_i: do_cas2_i }; +` -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_uint8), true); +var loadModule_uint8 = asmCompile('stdlib', 'foreign', 'heap', loadModule_uint8_code); function test_uint8(heap) { var i8a = new SharedUint8Array(heap); @@ -1702,60 +1690,58 @@ function test_uint8(heap) { assertEq(i8m.sub_i(oob), 0); } -function loadModule_misc(stdlib, foreign, heap) { - "use asm"; - +var loadModule_misc_code = + USE_ASM + ` var atomic_isLockFree = stdlib.Atomics.isLockFree; function ilf1() { - return atomic_isLockFree(1)|0; + return atomic_isLockFree(1)|0; } function ilf2() { - return atomic_isLockFree(2)|0; + return atomic_isLockFree(2)|0; } function ilf3() { - return atomic_isLockFree(3)|0; + return atomic_isLockFree(3)|0; } function ilf4() { - return atomic_isLockFree(4)|0; + return atomic_isLockFree(4)|0; } function ilf5() { - return atomic_isLockFree(5)|0; + return atomic_isLockFree(5)|0; } function ilf6() { - return atomic_isLockFree(6)|0; + return atomic_isLockFree(6)|0; } function ilf7() { - return atomic_isLockFree(7)|0; + return atomic_isLockFree(7)|0; } function ilf8() { - return atomic_isLockFree(8)|0; + return atomic_isLockFree(8)|0; } function ilf9() { - return atomic_isLockFree(9)|0; + return atomic_isLockFree(9)|0; } return { ilf1: ilf1, - ilf2: ilf2, - ilf3: ilf3, - ilf4: ilf4, - ilf5: ilf5, - ilf6: ilf6, - ilf7: ilf7, - ilf8: ilf8, - ilf9: ilf9 }; -} + ilf2: ilf2, + ilf3: ilf3, + ilf4: ilf4, + ilf5: ilf5, + ilf6: ilf6, + ilf7: ilf7, + ilf8: ilf8, + ilf9: ilf9 }; +` -if (isAsmJSCompilationAvailable()) - assertEq(isAsmJSModule(loadModule_misc), true); +var loadModule_misc = asmCompile('stdlib', 'foreign', 'heap', loadModule_misc_code); function test_misc(heap) { var misc = loadModule_misc(this, {}, heap); @@ -1783,3 +1769,20 @@ test_uint16(heap); test_int32(heap); test_uint32(heap); test_misc(heap); + +// Test that ARM callouts compile. +setARMHwCapFlags('vfp'); + +asmCompile('stdlib', 'ffi', 'heap', + USE_ASM + ` + var atomic_exchange = stdlib.Atomics.exchange; + var i8a = new stdlib.SharedInt8Array(heap); + + function do_xchg() { + var v = 0; + v = atomic_exchange(i8a, 200, 37) | 0; + return v|0; + } + + return { xchg: do_xchg } +`); diff --git a/js/src/jit-test/tests/asm.js/testExpressions.js b/js/src/jit-test/tests/asm.js/testExpressions.js index 1910329c8623..90aef5cfd4cc 100644 --- a/js/src/jit-test/tests/asm.js/testExpressions.js +++ b/js/src/jit-test/tests/asm.js/testExpressions.js @@ -262,6 +262,9 @@ assertAsmTypeFail(USE_ASM + "function f() { var i=42,j=1.1; return +(i?i:j) } re assertEq(asmLink(asmCompile(USE_ASM + "function f() { var i=42,j=1.1; return +(i?+(i|0):j) } return f"))(), 42); assertEq(asmLink(asmCompile(USE_ASM + "function f() { var i=42,j=1; return (i?i:j)|0 } return f"))(), 42); +assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (0 > (-(~~1) >>> 0)) | 0; } return f"))(), 0); +assertEq(asmLink(asmCompile(USE_ASM + "function f() { return 0 < 4294967294 | 0; } return f"))(), 1); + var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; return ((i|0)>(j|0)?(i+10)|0:(j+100)|0)|0 } return f")); assertEq(f(2, 4), 104); assertEq(f(-2, -4), 8); diff --git a/js/src/jit/BytecodeAnalysis.cpp b/js/src/jit/BytecodeAnalysis.cpp index f3065e6558d9..3fd0b0bd0cae 100644 --- a/js/src/jit/BytecodeAnalysis.cpp +++ b/js/src/jit/BytecodeAnalysis.cpp @@ -45,8 +45,10 @@ BytecodeAnalysis::init(TempAllocator& alloc, GSNCache& gsn) if (!infos_.growByUninitialized(script_->length())) return false; - // We need a scope chain if any of the bindings are aliased. - usesScopeChain_ = script_->hasAnyAliasedBindings(); + // We need a scope chain if the function is heavyweight. + usesScopeChain_ = (script_->functionDelazifying() && + script_->functionDelazifying()->isHeavyweight()); + MOZ_ASSERT_IF(script_->hasAnyAliasedBindings(), usesScopeChain_); jsbytecode* end = script_->codeEnd(); diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index da3e24a11c11..ec58d1b33cb1 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -1008,13 +1008,10 @@ CodeGenerator::visitRegExp(LRegExp* lir) callVM(CloneRegExpObjectInfo, lir); } -// The maximum number of pairs we can handle when executing RegExps inline. -static const size_t RegExpMaxPairCount = 6; - // Amount of space to reserve on the stack when executing RegExps inline. static const size_t RegExpReservedStack = sizeof(irregexp::InputOutputData) + sizeof(MatchPairs) - + RegExpMaxPairCount * sizeof(MatchPair); + + RegExpObject::MaxPairCount * sizeof(MatchPair); static size_t RegExpPairsVectorStartOffset(size_t inputOutputDataStartOffset) @@ -1093,7 +1090,7 @@ PrepareAndExecuteRegExp(JSContext* cx, MacroAssembler& masm, Register regexp, Re if (mode == RegExpShared::Normal) { // Don't handle RegExps with excessive parens. masm.load32(Address(temp1, RegExpShared::offsetOfParenCount()), temp2); - masm.branch32(Assembler::AboveOrEqual, temp2, Imm32(RegExpMaxPairCount), failure); + masm.branch32(Assembler::AboveOrEqual, temp2, Imm32(RegExpObject::MaxPairCount), failure); // Fill in the paren count in the MatchPairs on the stack. masm.add32(Imm32(1), temp2); @@ -1342,7 +1339,7 @@ JitCompartment::generateRegExpExecStub(JSContext* cx) // The template object should have enough space for the maximum number of // pairs this stub can handle. - MOZ_ASSERT(ObjectElements::VALUES_PER_HEADER + RegExpMaxPairCount == + MOZ_ASSERT(ObjectElements::VALUES_PER_HEADER + RegExpObject::MaxPairCount == gc::GetGCKindSlots(templateObject->asTenured().getAllocKind())); MacroAssembler masm(cx); diff --git a/js/src/jit/arm/Architecture-arm.cpp b/js/src/jit/arm/Architecture-arm.cpp index f1f41174713e..d320ce8323f1 100644 --- a/js/src/jit/arm/Architecture-arm.cpp +++ b/js/src/jit/arm/Architecture-arm.cpp @@ -50,7 +50,7 @@ ParseARMCpuFeatures(const char* features, bool override = false) uint32_t flags = 0; for (;;) { - char ch = *features; + char ch = *features; if (!ch) { // End of string. break; diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 07d79137dc7e..e41d3a7b1587 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -825,7 +825,8 @@ RegExpCompartment::createMatchResultTemplateObject(JSContext* cx) MOZ_ASSERT(!matchResultTemplateObject_); /* Create template array object */ - RootedArrayObject templateObject(cx, NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject)); + RootedArrayObject templateObject(cx, NewDenseUnallocatedArray(cx, RegExpObject::MaxPairCount, + nullptr, TenuredObject)); if (!templateObject) return matchResultTemplateObject_; // = nullptr diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h index 3c8ce26ce5cc..e6c2817142d9 100644 --- a/js/src/vm/RegExpObject.h +++ b/js/src/vm/RegExpObject.h @@ -360,6 +360,10 @@ class RegExpObject : public NativeObject static const Class class_; + // The maximum number of pairs a MatchResult can have, without having to + // allocate a bigger MatchResult. + static const size_t MaxPairCount = 14; + /* * Note: The regexp statics flags are OR'd into the provided flags, * so this function is really meant for object creation during code diff --git a/netwerk/cache2/CacheFileMetadata.cpp b/netwerk/cache2/CacheFileMetadata.cpp index 5355ce17ff72..9b5f42131624 100644 --- a/netwerk/cache2/CacheFileMetadata.cpp +++ b/netwerk/cache2/CacheFileMetadata.cpp @@ -32,6 +32,9 @@ namespace net { // Initial elements buffer size. #define kInitialBufSize 64 +// Max size of elements in bytes. +#define kMaxElementsSize 64*1024 + #define kCacheEntryVersion 1 #define NOW_SECONDS() (uint32_t(PR_Now() / PR_USEC_PER_SEC)) @@ -236,6 +239,17 @@ CacheFileMetadata::ReadMetadata(CacheFileMetadataListener *aListener) return NS_OK; } +uint32_t +CacheFileMetadata::CalcMetadataSize(uint32_t aElementsSize, uint32_t aHashCount) +{ + return sizeof(uint32_t) + // hash of the metadata + aHashCount * sizeof(CacheHash::Hash16_t) + // array of chunk hashes + sizeof(CacheFileMetadataHeader) + // metadata header + mKey.Length() + 1 + // key with trailing null + aElementsSize + // elements + sizeof(uint32_t); // offset +} + nsresult CacheFileMetadata::WriteMetadata(uint32_t aOffset, CacheFileMetadataListener *aListener) @@ -250,10 +264,11 @@ CacheFileMetadata::WriteMetadata(uint32_t aOffset, mIsDirty = false; - mWriteBuf = static_cast(moz_xmalloc(sizeof(uint32_t) + - mHashCount * sizeof(CacheHash::Hash16_t) + - sizeof(CacheFileMetadataHeader) + mKey.Length() + 1 + - mElementsSize + sizeof(uint32_t))); + mWriteBuf = static_cast(malloc(CalcMetadataSize(mElementsSize, + mHashCount))); + if (!mWriteBuf) { + return NS_ERROR_OUT_OF_MEMORY; + } char *p = mWriteBuf + sizeof(uint32_t); memcpy(p, mHashArray, mHashCount * sizeof(CacheHash::Hash16_t)); @@ -406,6 +421,8 @@ CacheFileMetadata::SetElement(const char *aKey, const char *aValue) MarkDirty(); + nsresult rv; + const uint32_t keySize = strlen(aKey) + 1; char *pos = const_cast(GetElement(aKey)); @@ -431,7 +448,10 @@ CacheFileMetadata::SetElement(const char *aKey, const char *aValue) // Update the value in place newSize -= oldValueSize; - EnsureBuffer(newSize); + rv = EnsureBuffer(newSize); + if (NS_FAILED(rv)) { + return rv; + } // Move the remainder to the right place pos = mBuf + offset; @@ -439,7 +459,10 @@ CacheFileMetadata::SetElement(const char *aKey, const char *aValue) } else { // allocate new meta data element newSize += keySize; - EnsureBuffer(newSize); + rv = EnsureBuffer(newSize); + if (NS_FAILED(rv)) { + return rv; + } // Add after last element pos = mBuf + mElementsSize; @@ -665,7 +688,7 @@ CacheFileMetadata::OnDataRead(CacheFileHandle *aHandle, char *aBuf, if (realOffset >= size) { LOG(("CacheFileMetadata::OnDataRead() - Invalid realOffset, creating " - "empty metadata. [this=%p, realOffset=%d, size=%lld]", this, + "empty metadata. [this=%p, realOffset=%u, size=%lld]", this, realOffset, size)); InitEmptyMetadata(); @@ -675,6 +698,21 @@ CacheFileMetadata::OnDataRead(CacheFileHandle *aHandle, char *aBuf, return NS_OK; } + uint32_t maxHashCount = size / kChunkSize; + uint32_t maxMetadataSize = CalcMetadataSize(kMaxElementsSize, maxHashCount); + if (size - realOffset > maxMetadataSize) { + LOG(("CacheFileMetadata::OnDataRead() - Invalid realOffset, metadata would " + "be too big, creating empty metadata. [this=%p, realOffset=%u, " + "maxMetadataSize=%u, size=%lld]", this, realOffset, maxMetadataSize, + size)); + + InitEmptyMetadata(); + + mListener.swap(listener); + listener->OnMetadataRead(NS_OK); + return NS_OK; + } + uint32_t usedOffset = size - mBufSize; if (realOffset < usedOffset) { @@ -932,9 +970,13 @@ CacheFileMetadata::CheckElements(const char *aBuf, uint32_t aSize) return NS_OK; } -void +nsresult CacheFileMetadata::EnsureBuffer(uint32_t aSize) { + if (aSize > kMaxElementsSize) { + return NS_ERROR_FAILURE; + } + if (mBufSize < aSize) { if (mAllocExactSize) { // If this is not the only allocation, use power of two for following @@ -955,11 +997,17 @@ CacheFileMetadata::EnsureBuffer(uint32_t aSize) aSize = kInitialBufSize; } + char *newBuf = static_cast(realloc(mBuf, aSize)); + if (!newBuf) { + return NS_ERROR_OUT_OF_MEMORY; + } mBufSize = aSize; - mBuf = static_cast(moz_xrealloc(mBuf, mBufSize)); + mBuf = newBuf; DoMemoryReport(MemoryUsage()); } + + return NS_OK; } nsresult diff --git a/netwerk/cache2/CacheFileMetadata.h b/netwerk/cache2/CacheFileMetadata.h index b02eead05767..70a1563571dc 100644 --- a/netwerk/cache2/CacheFileMetadata.h +++ b/netwerk/cache2/CacheFileMetadata.h @@ -121,6 +121,7 @@ public: nsresult GetKey(nsACString &_retval); nsresult ReadMetadata(CacheFileMetadataListener *aListener); + uint32_t CalcMetadataSize(uint32_t aElementsSize, uint32_t aHashCount); nsresult WriteMetadata(uint32_t aOffset, CacheFileMetadataListener *aListener); nsresult SyncReadMetadata(nsIFile *aFile); @@ -171,7 +172,7 @@ private: void InitEmptyMetadata(); nsresult ParseMetadata(uint32_t aMetaOffset, uint32_t aBufOffset, bool aHaveKey); nsresult CheckElements(const char *aBuf, uint32_t aSize); - void EnsureBuffer(uint32_t aSize); + nsresult EnsureBuffer(uint32_t aSize); nsresult ParseKey(const nsACString &aKey); nsRefPtr mHandle; diff --git a/netwerk/cache2/CacheFileOutputStream.cpp b/netwerk/cache2/CacheFileOutputStream.cpp index 9566e32a316d..94af33fdd063 100644 --- a/netwerk/cache2/CacheFileOutputStream.cpp +++ b/netwerk/cache2/CacheFileOutputStream.cpp @@ -103,6 +103,18 @@ CacheFileOutputStream::Write(const char * aBuf, uint32_t aCount, return NS_ERROR_FILE_TOO_BIG; } + // We use 64-bit offset when accessing the file, unfortunatelly we use 32-bit + // metadata offset, so we cannot handle data bigger than 4GB. + if (mPos + aCount > PR_UINT32_MAX) { + LOG(("CacheFileOutputStream::Write() - Entry's size exceeds 4GB while it " + "isn't too big according to CacheObserver::EntryIsTooBig(). Failing " + "and dooming the entry. [this=%p]", this)); + + mFile->DoomLocked(nullptr); + CloseWithStatusLocked(NS_ERROR_FILE_TOO_BIG); + return NS_ERROR_FILE_TOO_BIG; + } + *_retval = aCount; while (aCount) { diff --git a/netwerk/cache2/CacheObserver.cpp b/netwerk/cache2/CacheObserver.cpp index be276e55b9b4..03c85d297560 100644 --- a/netwerk/cache2/CacheObserver.cpp +++ b/netwerk/cache2/CacheObserver.cpp @@ -65,11 +65,11 @@ bool CacheObserver::sSmartCacheSizeEnabled = kDefaultSmartCacheSizeEnabled; static uint32_t const kDefaultPreloadChunkCount = 4; uint32_t CacheObserver::sPreloadChunkCount = kDefaultPreloadChunkCount; -static uint32_t const kDefaultMaxMemoryEntrySize = 4 * 1024; // 4 MB -uint32_t CacheObserver::sMaxMemoryEntrySize = kDefaultMaxMemoryEntrySize; +static int32_t const kDefaultMaxMemoryEntrySize = 4 * 1024; // 4 MB +int32_t CacheObserver::sMaxMemoryEntrySize = kDefaultMaxMemoryEntrySize; -static uint32_t const kDefaultMaxDiskEntrySize = 50 * 1024; // 50 MB -uint32_t CacheObserver::sMaxDiskEntrySize = kDefaultMaxDiskEntrySize; +static int32_t const kDefaultMaxDiskEntrySize = 50 * 1024; // 50 MB +int32_t CacheObserver::sMaxDiskEntrySize = kDefaultMaxDiskEntrySize; static uint32_t const kDefaultMaxDiskChunksMemoryUsage = 10 * 1024; // 10MB uint32_t CacheObserver::sMaxDiskChunksMemoryUsage = kDefaultMaxDiskChunksMemoryUsage; @@ -170,9 +170,9 @@ CacheObserver::AttachToPreferences() mozilla::Preferences::AddUintVarCache( &sPreloadChunkCount, "browser.cache.disk.preload_chunk_count", kDefaultPreloadChunkCount); - mozilla::Preferences::AddUintVarCache( + mozilla::Preferences::AddIntVarCache( &sMaxDiskEntrySize, "browser.cache.disk.max_entry_size", kDefaultMaxDiskEntrySize); - mozilla::Preferences::AddUintVarCache( + mozilla::Preferences::AddIntVarCache( &sMaxMemoryEntrySize, "browser.cache.memory.max_entry_size", kDefaultMaxMemoryEntrySize); mozilla::Preferences::AddUintVarCache( @@ -472,9 +472,12 @@ CacheStorageEvictHelper::ClearStorage(bool const aPrivate, bool const CacheObserver::EntryIsTooBig(int64_t aSize, bool aUsingDisk) { // If custom limit is set, check it. - int64_t preferredLimit = aUsingDisk - ? static_cast(sMaxDiskEntrySize) << 10 - : static_cast(sMaxMemoryEntrySize) << 10; + int64_t preferredLimit = aUsingDisk ? sMaxDiskEntrySize : sMaxMemoryEntrySize; + + // do not convert to bytes when the limit is -1, which means no limit + if (preferredLimit > 0) { + preferredLimit <<= 10; + } if (preferredLimit != -1 && aSize > preferredLimit) return true; diff --git a/netwerk/cache2/CacheObserver.h b/netwerk/cache2/CacheObserver.h index deeed2f9aba3..20148b4b7659 100644 --- a/netwerk/cache2/CacheObserver.h +++ b/netwerk/cache2/CacheObserver.h @@ -90,8 +90,8 @@ private: static uint32_t sDiskFreeSpaceHardLimit; static bool sSmartCacheSizeEnabled; static uint32_t sPreloadChunkCount; - static uint32_t sMaxMemoryEntrySize; - static uint32_t sMaxDiskEntrySize; + static int32_t sMaxMemoryEntrySize; + static int32_t sMaxDiskEntrySize; static uint32_t sMaxDiskChunksMemoryUsage; static uint32_t sMaxDiskPriorityChunksMemoryUsage; static uint32_t sCompressionLevel; diff --git a/security/manager/ssl/IntolerantFallbackList.inc b/security/manager/ssl/IntolerantFallbackList.inc index b9dfb2d1d8ea..e13b64df81c3 100644 --- a/security/manager/ssl/IntolerantFallbackList.inc +++ b/security/manager/ssl/IntolerantFallbackList.inc @@ -19,7 +19,6 @@ static const char* const kIntolerantFallbackList[] = "access.boekhuis.nl", // bug 1151580 "account.61.com.tw", "acs.sia.eu", // RC4 - "actiononline.stpete.org", "adman.you.gr", "adminweb.uthscsa.edu", "airportwifi.com", // bug 1116891 @@ -47,10 +46,10 @@ static const char* const kIntolerantFallbackList[] = "ap.meitetsuunyu.co.jp", "apply.hkbn.net", // bug 1138451 "apps.amerch.com", - "apps.fpcu.org", "apps.sasken.com", "apps.state.or.us", // bug 1130472 "appsrv.restat.com", + "arcgames.com", // bug 1182932 "ascii.jp", "asko.fi", // bug 1158584 "b2b.feib.com.tw", @@ -70,11 +69,11 @@ static const char* const kIntolerantFallbackList[] = "buttons.verticalresponse.com", "c2g.jupiter.fl.us", "canadaca.geotrust.com", // bug 1137677 + "car2go.com", // bug 1185080 "cbsfnotes1.blood.org.tw", "central.acadiau.ca", // bug 1152377 "cherry.de", // bug 1141521 "civilization.com", // bug 1156004 - "click2gov.sanangelotexas.us", "clientes.chilectra.cl", "club.guosen.com.cn", "coagov.aurora-il.org", @@ -90,7 +89,6 @@ static const char* const kIntolerantFallbackList[] = "cwu.edu", "dbank.hxb.com.cn", "dealer.autobytel.com", - "dealer.autoc-one.jp", "dheb.delavska-hranilnica.si", "digibet.com", "digitalsecurity.intel.com", // bug 1148744 @@ -107,18 +105,14 @@ static const char* const kIntolerantFallbackList[] = "ebpp.airtel.lk", "ebspay.boc.cn", // bug 1155567 "ec-line.cn", - "ecams.geico.com", // bug 1138613 "echo.com", "echotrak.com", "ecom.morethangourmet.com", "ecourses.uthscsa.edu", - "egov.leaguecity.com", "egov.town-menasha.com", // bug 1157536 "emaildvla.direct.gov.uk", // bug 1116891 - "embroiderydesignsplus.com", "epicreg.com", "eremit.sbising.com", - "escrowrefills.com", "eservices.palomar.edu", "essentialsupplies.com", "event.kasite.net", @@ -135,10 +129,8 @@ static const char* const kIntolerantFallbackList[] = "fubar.com", "gateway.halton.gov.uk", "gbe-bund.de", - "geico.com", // bug 1138613 "gestionesytramites.madrid.org", "giftcertificates.com", - "hbk.bb.com.br", // bug 1135966 "hercle.com", "hpshop.gr", "ibusiness.shacombank.com.hk", // bug 1141989 @@ -153,26 +145,20 @@ static const char* const kIntolerantFallbackList[] = "jbclick.jaxbchfl.net", // bug 1158465 "jifenpay.com", "jst.doded.mil", // bug 1152627 - "juror.fairfaxcounty.gov", "keirin.jp", "kjp.keinet.ne.jp", "kjp.oo.kawai-juku.ac.jp", - "learn.ou.edu", - "learn.swosu.edu", "lewisham.gov.uk", "lm-order.de", "login.chicagopolice.org", "login.ermis.gov.gr", "m.e-hon.ne.jp", - "macif.fr", // bug 1167893 + "m.safari.cwu.edu", // bug 1143035 "mail.izhnet.ru", "map.infonavit.org.mx", - "marketday.com", // bug 1092998 - "matkahuolto.fi", // bug 1174957 "mchrono.com", "mecsumai.com", "member.edenredticket.com", - "mercernet.fr", // bug 1147649 "merchant.edenredticket.com", "meta-ehealth.com", "mobile.aa.com", // bug 1141604 @@ -193,7 +179,6 @@ static const char* const kIntolerantFallbackList[] = "myaccount3.westnet.com.au", // bug 1157139 "mybank.nbcb.com.cn", "myhancock.hancockcollege.edu", - "myntc.ntc.edu", "myuws.uws.edu.au", "mywebreservations.com", "na.aiononline.com", // bug 1139782 @@ -208,13 +193,11 @@ static const char* const kIntolerantFallbackList[] = "online.newindia.co.in", "online.sainsburysbank.co.uk", "openwebosproject.org", // bug 1151990 - "opi.emersonclimate.com", "opus.pinellascounty.org", "owa.byui.edu", "ozone.ou.edu", "parents.ou.edu", "partnerweb.vmware.com", // bug 1142187 - "paslists.com", // for port 9211, bug 1155712 "payment.condor.com", // bug 1152347 "payment.safepass.cn", "payments.virginmedia.com", // bug 1129887 @@ -227,6 +210,7 @@ static const char* const kIntolerantFallbackList[] = "publicjobs.ie", "publicrecords.com", "racenet.codemasters.com", // bug 1163716 + "rapidscansecure.com", // bug 1177212 "recoup.com", "registration.o2.co.uk", "regonline.com", // bug 1139783 @@ -236,40 +220,27 @@ static const char* const kIntolerantFallbackList[] = "reputation.com", "research-report.uws.edu.au", "reservations.usairways.com", // bug 1165400 - "rezstream.net", "rietumu.lv", - "rotr.com", "roxyaffiliates.com", "sales.newchinalife.com", "sbank.hxb.com.cn", "sboseweb.mcpsweb.org", - "school.keystoneschoolonline.com", "secure-checkout.t-mobile.com", // bug 1133648 "secure.bg-mania.jp", "secure.crbonline.gov.uk", // bug 1166644 "secure.fortisbc.com", "secure.ncsoft.com", // bug 1139782 "secure.smartcart.com", - "secure2.i-doxs.net", // bug 1140876 - "secure3.i-doxs.net", // bug 1140876 - "secure4.i-doxs.net", // bug 1140876 - "secure6.i-doxs.net", // bug 1140876 - "secure7.i-doxs.net", // bug 1140876 - "secure8.i-doxs.net", // bug 1140876 "secureonline.dwp.gov.uk", "sems.hrd.ccsd.net", - "service.autoc-one.jp", "services.apvma.gov.au", "services.geotrust.com", // bug 1137677 "servizionline.infogroup.it", - "shop.autoc-one.jp", "shop.kagome.co.jp", "shop.nanairo.coop", // bug 1128318 "shop.wildstar-online.com", // bug 1139782 - "sisweb.ucd.ie", "slovanet.sk", "smartcart.com", - "smarticon.geotrust.com", // bug 1137677 "socialclub.rockstargames.com", // bug 1138673 "soeasy.sodexo.be", // bug 1117157 "ss2.sfcollege.edu", @@ -280,16 +251,15 @@ static const char* const kIntolerantFallbackList[] = "stenhouse.com", "store.moxa.com", "svrch13.sugarlandtx.gov", + "swdownloads.blackberry.com", // bug 1182997 "syzygy.co.uk", "tarjetacencosud.cl", "tele2.hr", "tienda.boe.es", "tiendas.mediamarkt.es", - "trueblue.jetblue.com", "uralsg.megafon.ru", // bug 1153168 "usacycling.org", // bug 1163791 "userdoor.com", - "uslugi.beeline.am", "utradehub.or.kr", "vod.skyperfectv.co.jp", "watch.sportsnet.ca", // bug 1144769 @@ -340,6 +310,7 @@ static const char* const kIntolerantFallbackList[] = "www.ancelutil.com.uy", "www.animate-onlineshop.jp", // bug 1126652 "www.apeasternpower.com", + "www.arcgames.com", // bug 1182932 "www.asko.fi", // bug 1158584 "www.auroragov.org", "www.bancocredichile.cl", @@ -362,10 +333,10 @@ static const char* const kIntolerantFallbackList[] = "www.bredbandsbolaget.se", // bug 1158755 "www.businessdirect.bt.com", "www.cafedumonde.jp", + "www.car2go.com", // bug 1185080 "www.careers.asio.gov.au", "www.cherry.de", // bug 1141521 "www.chinapay.com", // bug 1137983 - "www.cihi.ca", "www.cipd.co.uk", "www.civilization.com", // bug 1156004 "www.club-animate.jp", @@ -389,14 +360,12 @@ static const char* const kIntolerantFallbackList[] = "www.ec-line.cn", "www.echo.com", "www.echotrak.com", - "www.embroiderydesignsplus.com", "www.epicreg.com", "www.ermis.gov.gr", "www.esadealumni.net", "www.esavingsaccount.co.uk", "www.escrowrefills.com", "www.essentialsupplies.com", - "www.euronext.com", // bug 1136091 "www.everyd.com", "www.ezpay.com.tw", "www.fhsaa.org", @@ -405,17 +374,13 @@ static const char* const kIntolerantFallbackList[] = "www.fontainebleau.com", "www.foundersc.com", "www.fubar.com", - "www.fundsupermart.co.in", "www.gamers-onlineshop.jp", // bug 1126654 "www.gbe-bund.de", "www.giftcertificates.com", - "www.golfersland.net", "www.gtja.com", - "www.hankyu-club.com", "www.haynes.co.uk", "www.hercle.com", "www.hn.10086.cn", - "www.hotel-story.ne.jp", "www.hpshop.gr", "www.hsbank.cc", "www.hx168.com.cn", @@ -426,9 +391,6 @@ static const char* const kIntolerantFallbackList[] = "www.jifenpay.com", "www.kasite.net", "www.khan.co.kr", - "www.komatsu-kenki.co.jp", - "www.komatsu.co.jp", - "www.komatsu.com", "www.kredodirect.com.ua", // bug 1095507 "www.law888.com.tw", "www.lewisham.gov.uk", @@ -436,19 +398,12 @@ static const char* const kIntolerantFallbackList[] = "www.libraryvideo.com", "www.lm-order.de", "www.londonstockexchange.com", - "www.macif.fr", // bug 1167893 - "www.marketday.com", // bug 1092998 - "www.matkahuolto.fi", // bug 1174957 "www.matkahuolto.info", "www.matrics.or.jp", "www.mchrono.com", "www.mecsumai.com", - "www.mercatoneuno.com", - "www.mercernet.fr", // bug 1147649 "www.meta-ehealth.com", "www.misterdonut.jp", - "www.mizuno.jp", - "www.monclick.it", "www.mp2.aeroport.fr", "www.mpay.co.th", "www.mtsindia.in", // RC4 @@ -462,34 +417,30 @@ static const char* const kIntolerantFallbackList[] = "www.nishi.or.jp", "www.ocbcwhhk.com", // bug 1141746 "www.openwebosproject.org", // bug 1151990 - "www.paslists.com", // for port 9211, bug 1155712 "www.pen-kanagawa.ed.jp", "www.polla.cl", "www.publicjobs.ie", "www.publicrecords.com", "www.pwcrecruiting.com", + "www.rapidscansecure.com", // bug 1177212 "www.razorgator.com", "www.recoup.com", "www.regonline.com", // bug 1139783 "www.renaultcredit.com.ar", "www.reputation.com", - "www.rezstream.net", "www.rietumu.lv", "www.rimac.com.pe", "www.riversendtrading.com", - "www.rotr.com", "www.roxyaffiliates.com", "www.s-book.net", "www.safepass.cn", "www.session.ne.jp", - "www.shacombank.com.hk", // bug 1141989 "www.shacomsecurities.com.hk", // bug 1141989 "www.shop.bt.com", "www.slovanet.sk", "www.smartcart.com", "www.smartoffice.jp", "www.sokamocka.com", - "www.sports-nakama.com", "www.starbucks.com", // bug 1167190 "www.stenhouse.com", "www.sunderland.gov.uk", @@ -515,15 +466,11 @@ static const char* const kIntolerantFallbackList[] = "www1.aeroplan.com", // bug 1137543 "www1.isracard.co.il", // bug 1165582 "www2.aeroplan.com", // bug 1137543 - "www2.bancobrasil.com.br", // bug 1135966 "www2.wou.edu", - "www28.bb.com.br", // bug 1135966 "www3.aeroplan.com", // bug 1137543 "www3.ibac.co.jp", "www3.taiheiyo-ferry.co.jp", "www4.aeroplan.com", // bug 1137543 - "www41.bb.com.br", // bug 1135966 - "www73.bb.com.br", // bug 1135966 "wwws.kadokawa.co.jp", "xyk.cebbank.com", // bug 1145524 "zenfolio.com", diff --git a/security/manager/ssl/nsNSSIOLayer.cpp b/security/manager/ssl/nsNSSIOLayer.cpp index b788aaa84c2d..4fd8a121bc1b 100644 --- a/security/manager/ssl/nsNSSIOLayer.cpp +++ b/security/manager/ssl/nsNSSIOLayer.cpp @@ -1737,7 +1737,6 @@ private: static const char* const kFallbackWildcardList[] = { ".kuronekoyamato.co.jp", // bug 1128366 - ".userstorage.mega.co.nz", // bug 1133496 ".wildcard.test", }; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 77b7c6f9f3e9..c24fd9568d1b 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -2994,8 +2994,16 @@ nsWindow::PrepareForFullscreenTransition(nsISupports** aData) { FullscreenTransitionInitData initData; nsCOMPtr screen = GetWidgetScreen(); - screen->GetRectDisplayPix(&initData.mBounds.x, &initData.mBounds.y, - &initData.mBounds.width, &initData.mBounds.height); + int32_t x, y, width, height; + screen->GetRectDisplayPix(&x, &y, &width, &height); + MOZ_ASSERT(BoundsUseDisplayPixels(), + "Should only be called on top-level window"); + CSSToLayoutDeviceScale scale = GetDefaultScale(); + initData.mBounds.x = NSToIntRound(x * scale.scale); + initData.mBounds.y = NSToIntRound(y * scale.scale); + initData.mBounds.width = NSToIntRound(width * scale.scale); + initData.mBounds.height = NSToIntRound(height * scale.scale); + // Create a semaphore for synchronizing the window handle which will // be created by the transition thread and used by the main thread for // posting the transition messages.