Merge last green changeset of mozilla-inbound to mozilla-central
authorEd Morley <bmo@edmorley.co.uk>
Fri, 14 Oct 2011 10:58:43 +0100
changeset 78725 ca73f057dab701a1e5531744e3349351113ad0bd
parent 78688 9545b88eed827dacf620f5ce4e90a8ab23f4c221 (current diff)
parent 78724 d2a037d0354d354b2d683518ce5c6c297d1b7af8 (diff)
child 78726 68799855e85331cf0d0112fe1b3aa8f11f6f7d9e
push id21326
push userbmo@edmorley.co.uk
push dateFri, 14 Oct 2011 10:00:06 +0000
treeherdermozilla-central@ca73f057dab7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge last green changeset of mozilla-inbound to mozilla-central
dom/plugins/test/mochitest/test_defaultValue.html
js/src/jsstaticcheck.h
media/libvpx/vp8/common/arm/vpx_asm_offsets.c
media/libvpx/vp8/common/filter_c.c
media/libvpx/vp8/common/predictdc.c
media/libvpx/vp8/common/predictdc.h
media/libvpx/vp8/common/preproc.h
media/libvpx/vp8/common/vpxerrors.h
media/libvpx/vp8/decoder/arm/dboolhuff_arm.h
media/libvpx/vp8/decoder/arm/detokenize.asm
media/libvpx/vp8/decoder/arm/detokenize_arm.h
media/libvpx/vpx_ports/x86_abi_support_win32.asm
media/libvpx/vpx_scale/generic/scalesystemdependant.c
testing/mozmill/Makefile.in
testing/mozmill/README.txt
testing/mozmill/installmozmill.py
testing/mozmill/jsbridge/MANIFEST.in
testing/mozmill/jsbridge/jsbridge/__init__.py
testing/mozmill/jsbridge/jsbridge/extension/chrome.manifest
testing/mozmill/jsbridge/jsbridge/extension/chrome/content/overlay.js
testing/mozmill/jsbridge/jsbridge/extension/chrome/content/overlay.xul
testing/mozmill/jsbridge/jsbridge/extension/components/cmdarg.js
testing/mozmill/jsbridge/jsbridge/extension/install.rdf
testing/mozmill/jsbridge/jsbridge/extension/resource/modules/events.js
testing/mozmill/jsbridge/jsbridge/extension/resource/modules/init.js
testing/mozmill/jsbridge/jsbridge/extension/resource/modules/json2.js
testing/mozmill/jsbridge/jsbridge/extension/resource/modules/server.js
testing/mozmill/jsbridge/jsbridge/jsobjects.py
testing/mozmill/jsbridge/jsbridge/network.py
testing/mozmill/jsbridge/setup.py
testing/mozmill/mozmill/MANIFEST.in
testing/mozmill/mozmill/docs/Makefile
testing/mozmill/mozmill/docs/_build/doctrees/environment.pickle
testing/mozmill/mozmill/docs/_build/doctrees/index.doctree
testing/mozmill/mozmill/docs/_build/html/_sources/index.txt
testing/mozmill/mozmill/docs/_build/html/_static/contents.png
testing/mozmill/mozmill/docs/_build/html/_static/default.css
testing/mozmill/mozmill/docs/_build/html/_static/doctools.js
testing/mozmill/mozmill/docs/_build/html/_static/file.png
testing/mozmill/mozmill/docs/_build/html/_static/jquery.js
testing/mozmill/mozmill/docs/_build/html/_static/minus.png
testing/mozmill/mozmill/docs/_build/html/_static/navigation.png
testing/mozmill/mozmill/docs/_build/html/_static/plus.png
testing/mozmill/mozmill/docs/_build/html/_static/pygments.css
testing/mozmill/mozmill/docs/_build/html/_static/rightsidebar.css
testing/mozmill/mozmill/docs/_build/html/_static/searchtools.js
testing/mozmill/mozmill/docs/_build/html/_static/sphinxdoc.css
testing/mozmill/mozmill/docs/_build/html/_static/stickysidebar.css
testing/mozmill/mozmill/docs/_build/html/_static/traditional.css
testing/mozmill/mozmill/docs/_build/html/genindex.html
testing/mozmill/mozmill/docs/_build/html/index.html
testing/mozmill/mozmill/docs/_build/html/modindex.html
testing/mozmill/mozmill/docs/_build/html/objects.inv
testing/mozmill/mozmill/docs/_build/html/search.html
testing/mozmill/mozmill/docs/_build/html/searchindex.js
testing/mozmill/mozmill/docs/conf.py
testing/mozmill/mozmill/docs/index.rst
testing/mozmill/mozmill/mozmill/__init__.py
testing/mozmill/mozmill/mozmill/extension/build.xml
testing/mozmill/mozmill/mozmill/extension/chrome-jar.manifest
testing/mozmill/mozmill/mozmill/extension/chrome.manifest
testing/mozmill/mozmill/mozmill/extension/content/chrome.js
testing/mozmill/mozmill/mozmill/extension/content/css/fg.menu.css
testing/mozmill/mozmill/mozmill/extension/content/css/mozmill.css
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-icons_222222_256x240.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-icons_2e83ff_256x240.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-icons_454545_256x240.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-icons_888888_256x240.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/images/ui-icons_cd0a0a_256x240.png
testing/mozmill/mozmill/mozmill/extension/content/css/smoothness/jquery-ui-1.7.1.custom.css
testing/mozmill/mozmill/mozmill/extension/content/dx.js
testing/mozmill/mozmill/mozmill/extension/content/dxwindow.xul
testing/mozmill/mozmill/mozmill/extension/content/editor/bespin/BespinEmbedded.css
testing/mozmill/mozmill/mozmill/extension/content/editor/bespin/BespinEmbedded.js
testing/mozmill/mozmill/mozmill/extension/content/editor/bespin/BespinMain.js
testing/mozmill/mozmill/mozmill/extension/content/editor/bespin/BespinWorker.js
testing/mozmill/mozmill/mozmill/extension/content/editor/bespin/resources/screen_theme/theme.less
testing/mozmill/mozmill/mozmill/extension/content/editor/editor.js
testing/mozmill/mozmill/mozmill/extension/content/img/wmIcon.png
testing/mozmill/mozmill/mozmill/extension/content/inspector.js
testing/mozmill/mozmill/mozmill/extension/content/jquery/fg.menu.css
testing/mozmill/mozmill/mozmill/extension/content/jquery/fg.menu.js
testing/mozmill/mozmill/mozmill/extension/content/jquery/jquery-1.3.2.min.js
testing/mozmill/mozmill/mozmill/extension/content/jquery/jquery-ui-1.7.1.custom.min.js
testing/mozmill/mozmill/mozmill/extension/content/jquery/jquery.ui.core.js
testing/mozmill/mozmill/mozmill/extension/content/jquery/jquery.ui.menu.js
testing/mozmill/mozmill/mozmill/extension/content/menus.js
testing/mozmill/mozmill/mozmill/extension/content/mozmill.html
testing/mozmill/mozmill/mozmill/extension/content/mozmill.js
testing/mozmill/mozmill/mozmill/extension/content/mozmill.xul
testing/mozmill/mozmill/mozmill/extension/content/output.js
testing/mozmill/mozmill/mozmill/extension/content/overlay.js
testing/mozmill/mozmill/mozmill/extension/content/overlay.xul
testing/mozmill/mozmill/mozmill/extension/content/overlay_tb.xul
testing/mozmill/mozmill/mozmill/extension/content/prefs.xul
testing/mozmill/mozmill/mozmill/extension/content/rec.js
testing/mozmill/mozmill/mozmill/extension/content/shell.js
testing/mozmill/mozmill/mozmill/extension/content/shortcuts.js
testing/mozmill/mozmill/mozmill/extension/content/testwindow.xul
testing/mozmill/mozmill/mozmill/extension/content/ui.js
testing/mozmill/mozmill/mozmill/extension/defaults/preferences/debug.js
testing/mozmill/mozmill/mozmill/extension/install.rdf
testing/mozmill/mozmill/mozmill/extension/locale/en-US/mozmill.dtd
testing/mozmill/mozmill/mozmill/extension/locale/en-US/overlay.dtd
testing/mozmill/mozmill/mozmill/extension/readme.txt
testing/mozmill/mozmill/mozmill/extension/resource/modules/controller.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/elementslib.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/events.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/frame.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/init.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/inspection.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/jum.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/mozmill.js
testing/mozmill/mozmill/mozmill/extension/resource/modules/utils.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/EventUtils.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/arrays.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/dom.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/httpd.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/json2.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/objects.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/os.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/securable-module.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/strings.js
testing/mozmill/mozmill/mozmill/extension/resource/stdlib/withs.js
testing/mozmill/mozmill/mozmill/extension/skin/chrome.css
testing/mozmill/mozmill/mozmill/extension/skin/overlay.css
testing/mozmill/mozmill/mozmill/extension/zipexclude.lst
testing/mozmill/mozmill/patches/eventUtils.patch
testing/mozmill/mozmill/patches/httpd.patch
testing/mozmill/mozmill/scripts/songmill.py
testing/mozmill/mozmill/scripts/sync_dependencies.py
testing/mozmill/mozmill/setup.py
testing/mozmill/mozmill/test/commonjs/modules1/moda.js
testing/mozmill/mozmill/test/commonjs/modules1/modb.js
testing/mozmill/mozmill/test/commonjs/modules2/modc.js
testing/mozmill/mozmill/test/commonjs/tests/test_require.js
testing/mozmill/mozmill/test/elementLib-UnitTest.js
testing/mozmill/mozmill/test/first_sunbird_test.js
testing/mozmill/mozmill/test/first_thunderbird_test.js
testing/mozmill/mozmill/test/restart/test_browser/testPost.js
testing/mozmill/mozmill/test/restart/test_browser/testPre.js
testing/mozmill/mozmill/test/restart/test_fails/testPost.js
testing/mozmill/mozmill/test/restart/test_fails/testPre.js
testing/mozmill/mozmill/test/restart/test_multi_restart/test1.js
testing/mozmill/mozmill/test/restart/test_multi_restart/test2.js
testing/mozmill/mozmill/test/restart/test_multi_restart/test3.js
testing/mozmill/mozmill/test/restart/test_multi_restart/test4.js
testing/mozmill/mozmill/test/restart/test_multi_restart/test5.js
testing/mozmill/mozmill/test/restart/test_nothing/testPost.js
testing/mozmill/mozmill/test/restart/test_nothing/testPre.js
testing/mozmill/mozmill/test/restart/test_python_callback/callbacks.py
testing/mozmill/mozmill/test/restart/test_python_callback/testPost.js
testing/mozmill/mozmill/test/restart/test_python_callback/testPre.js
testing/mozmill/mozmill/test/restart/test_user_restart/test1.js
testing/mozmill/mozmill/test/restart/test_user_restart/test2.js
testing/mozmill/mozmill/test/restart/test_user_restart/test3.js
testing/mozmill/mozmill/test/restart/test_user_restart/test4.js
testing/mozmill/mozmill/test/restart/test_user_restart/test5.js
testing/mozmill/mozmill/test/test_assert.js
testing/mozmill/mozmill/test/test_demo.js
testing/mozmill/mozmill/test/test_diggIterator.js
testing/mozmill/mozmill/test/test_focus.js
testing/mozmill/mozmill/test/test_git.js
testing/mozmill/mozmill/test/test_googleIterator.js
testing/mozmill/mozmill/test/test_menu.js
testing/mozmill/mozmill/test/test_prefs.js
testing/mozmill/mozmill/test/test_property.js
testing/mozmill/mozmill/test/test_python_callbacks.js
testing/mozmill/mozmill/test/test_python_callbacks_callbacks.py
testing/mozmill/mozmill/test/test_something/test_parents.js
testing/mozmill/mozmill/test/test_something/test_sub/test_deps.js
testing/mozmill/mozmill/test/test_synthesizeEvents.js
testing/mozmill/mozmill/test/test_unit.js
testing/mozmill/mozmill/test/test_usershutdown.js
testing/mozmill/mozmill/test/test_waitForPageLoad.js
testing/mozmill/mozrunner/mozrunner/__init__.py
testing/mozmill/mozrunner/mozrunner/killableprocess.py
testing/mozmill/mozrunner/mozrunner/qijo.py
testing/mozmill/mozrunner/mozrunner/winprocess.py
testing/mozmill/mozrunner/mozrunner/wpk.py
testing/mozmill/mozrunner/setup.py
testing/mozmill/mozrunner/tests/debub_settings.py
testing/mozmill/mozrunner/tests/jss_settings.py
testing/mozmill/simplejson-2.1.1/CHANGES.txt
testing/mozmill/simplejson-2.1.1/LICENSE.txt
testing/mozmill/simplejson-2.1.1/PKG-INFO
testing/mozmill/simplejson-2.1.1/conf.py
testing/mozmill/simplejson-2.1.1/docs/_sources/index.txt
testing/mozmill/simplejson-2.1.1/docs/_static/contents.png
testing/mozmill/simplejson-2.1.1/docs/_static/default.css
testing/mozmill/simplejson-2.1.1/docs/_static/doctools.js
testing/mozmill/simplejson-2.1.1/docs/_static/file.png
testing/mozmill/simplejson-2.1.1/docs/_static/interface.js
testing/mozmill/simplejson-2.1.1/docs/_static/jquery.js
testing/mozmill/simplejson-2.1.1/docs/_static/minus.png
testing/mozmill/simplejson-2.1.1/docs/_static/navigation.png
testing/mozmill/simplejson-2.1.1/docs/_static/plus.png
testing/mozmill/simplejson-2.1.1/docs/_static/pygments.css
testing/mozmill/simplejson-2.1.1/docs/_static/rightsidebar.css
testing/mozmill/simplejson-2.1.1/docs/_static/searchtools.js
testing/mozmill/simplejson-2.1.1/docs/_static/sphinxdoc.css
testing/mozmill/simplejson-2.1.1/docs/_static/stickysidebar.css
testing/mozmill/simplejson-2.1.1/docs/_static/traditional.css
testing/mozmill/simplejson-2.1.1/docs/genindex.html
testing/mozmill/simplejson-2.1.1/docs/index.html
testing/mozmill/simplejson-2.1.1/docs/objects.inv
testing/mozmill/simplejson-2.1.1/docs/search.html
testing/mozmill/simplejson-2.1.1/docs/searchindex.js
testing/mozmill/simplejson-2.1.1/docs/searchindex.json
testing/mozmill/simplejson-2.1.1/ez_setup.py
testing/mozmill/simplejson-2.1.1/index.rst
testing/mozmill/simplejson-2.1.1/scripts/make_docs.py
testing/mozmill/simplejson-2.1.1/setup.cfg
testing/mozmill/simplejson-2.1.1/setup.py
testing/mozmill/simplejson-2.1.1/simplejson/__init__.py
testing/mozmill/simplejson-2.1.1/simplejson/_speedups.c
testing/mozmill/simplejson-2.1.1/simplejson/decoder.py
testing/mozmill/simplejson-2.1.1/simplejson/encoder.py
testing/mozmill/simplejson-2.1.1/simplejson/ordered_dict.py
testing/mozmill/simplejson-2.1.1/simplejson/scanner.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/__init__.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_check_circular.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_decimal.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_decode.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_default.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_dump.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_encode_basestring_ascii.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_encode_for_html.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_fail.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_float.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_indent.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_pass1.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_pass2.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_pass3.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_recursion.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_scanstring.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_separators.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_speedups.py
testing/mozmill/simplejson-2.1.1/simplejson/tests/test_unicode.py
testing/mozmill/simplejson-2.1.1/simplejson/tool.py
testing/mozmill/tests/firefox/restartTests/readme.txt
testing/mozmill/tests/firefox/restartTests/testDummyTest/test1.js
testing/mozmill/tests/firefox/test-files/awesomebar/copypaste.html
testing/mozmill/tests/firefox/test-files/cookies/cookie_single.html
testing/mozmill/tests/firefox/test-files/downloading/unknown_type.fmtd
testing/mozmill/tests/firefox/test-files/downloading/unknown_type.mtdl
testing/mozmill/tests/firefox/test-files/downloading/unknown_type_pb.stbf
testing/mozmill/tests/firefox/test-files/form_manager/form.html
testing/mozmill/tests/firefox/test-files/geolocation/position.html
testing/mozmill/tests/firefox/test-files/images/firefox_favicon.ico
testing/mozmill/tests/firefox/test-files/images/mozilla_favicon.ico
testing/mozmill/tests/firefox/test-files/images/mozilla_logo.jpg
testing/mozmill/tests/firefox/test-files/images/seamonkey_favicon.ico
testing/mozmill/tests/firefox/test-files/images/thunderbird_favicon.ico
testing/mozmill/tests/firefox/test-files/layout/mozilla.html
testing/mozmill/tests/firefox/test-files/layout/mozilla_community.html
testing/mozmill/tests/firefox/test-files/layout/mozilla_contribute.html
testing/mozmill/tests/firefox/test-files/layout/mozilla_governance.html
testing/mozmill/tests/firefox/test-files/layout/mozilla_grants.html
testing/mozmill/tests/firefox/test-files/layout/mozilla_mission.html
testing/mozmill/tests/firefox/test-files/layout/mozilla_organizations.html
testing/mozmill/tests/firefox/test-files/layout/mozilla_projects.html
testing/mozmill/tests/firefox/test-files/password_manager/login_form.html
testing/mozmill/tests/firefox/test-files/plugins/default_plugin.html
testing/mozmill/tests/firefox/test-files/popups/popup.html
testing/mozmill/tests/firefox/test-files/popups/popups_2.html
testing/mozmill/tests/firefox/test-files/search/mozsearch.html
testing/mozmill/tests/firefox/test-files/search/mozsearch.xml
testing/mozmill/tests/firefox/test-files/search/opensearch.html
testing/mozmill/tests/firefox/test-files/search/opensearch.xml
testing/mozmill/tests/firefox/test-files/search/searchresults.html
testing/mozmill/tests/firefox/test-files/tabbedbrowsing/openinnewtab.html
testing/mozmill/tests/firefox/test-files/tabbedbrowsing/openinnewtab_target.html
testing/mozmill/tests/firefox/testAwesomeBar/testFaviconInAutocomplete.js
testing/mozmill/tests/firefox/testAwesomeBar/testGoButton.js
testing/mozmill/tests/firefox/testPreferences/testSetToCurrentPage.js
testing/mozmill/tests/firefox/testPrivateBrowsing/testCloseWindow.js
testing/mozmill/tests/firefox/testSessionStore/testUndoTabFromContextMenu.js
testing/mozmill/tests/firefox/testTechnicalTools/testAccessPageInfoDialog.js
testing/mozmill/tests/firefox/testToolbar/testBackForwardButtons.js
testing/mozmill/tests/shared-modules/readme.txt
testing/mozmill/tests/shared-modules/testAddonsAPI.js
testing/mozmill/tests/shared-modules/testDOMUtilsAPI.js
testing/mozmill/tests/shared-modules/testDownloadsAPI.js
testing/mozmill/tests/shared-modules/testModalDialogAPI.js
testing/mozmill/tests/shared-modules/testPlacesAPI.js
testing/mozmill/tests/shared-modules/testPrefsAPI.js
testing/mozmill/tests/shared-modules/testPrivateBrowsingAPI.js
testing/mozmill/tests/shared-modules/testSearchAPI.js
testing/mozmill/tests/shared-modules/testSessionStoreAPI.js
testing/mozmill/tests/shared-modules/testSoftwareUpdateAPI.js
testing/mozmill/tests/shared-modules/testTabbedBrowsingAPI.js
testing/mozmill/tests/shared-modules/testToolbarAPI.js
testing/mozmill/tests/shared-modules/testUtilsAPI.js
testing/mozmill/tests/shared-modules/testWidgetsAPI.js
testing/mozmill/virtualenv/MANIFEST.in
testing/mozmill/virtualenv/PKG-INFO
testing/mozmill/virtualenv/docs/_build/_sources/index.txt
testing/mozmill/virtualenv/docs/_build/_sources/license.txt
testing/mozmill/virtualenv/docs/_build/_sources/news.txt
testing/mozmill/virtualenv/docs/index.txt
testing/mozmill/virtualenv/docs/license.txt
testing/mozmill/virtualenv/docs/news.txt
testing/mozmill/virtualenv/scripts/virtualenv
testing/mozmill/virtualenv/setup.cfg
testing/mozmill/virtualenv/setup.py
testing/mozmill/virtualenv/virtualenv.py
testing/mozmill/virtualenv/virtualenv_support/__init__.py
testing/mozmill/virtualenv/virtualenv_support/distribute-0.6.8.tar.gz
testing/mozmill/virtualenv/virtualenv_support/pip-0.7.1.tar.gz
testing/mozmill/virtualenv/virtualenv_support/setuptools-0.6c11-py2.4.egg
testing/mozmill/virtualenv/virtualenv_support/setuptools-0.6c11-py2.5.egg
testing/mozmill/virtualenv/virtualenv_support/setuptools-0.6c11-py2.6.egg
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -205,18 +205,20 @@ NotificationController::WillRefresh(mozi
   // Any generic notifications should be queued if we're processing content
   // insertions or generic notifications.
   mObservingState = eRefreshProcessingForUpdate;
 
   // Initial accessible tree construction.
   if (!mDocument->HasLoadState(nsDocAccessible::eTreeConstructed)) {
     // If document is not bound to parent at this point then the document is not
     // ready yet (process notifications later).
-    if (!mDocument->IsBoundToParent())
+    if (!mDocument->IsBoundToParent()) {
+      mObservingState = eRefreshObserving;
       return;
+    }
 
 #ifdef DEBUG_NOTIFICATIONS
     printf("\ninitial tree created, document: %p, document node: %p\n",
            mDocument.get(), mDocument->GetDocumentNode());
 #endif
 
     mDocument->DoInitialUpdate();
 
--- a/browser/components/preferences/advanced.js
+++ b/browser/components/preferences/advanced.js
@@ -17,16 +17,17 @@
 # The Initial Developer of the Original Code is
 # Ben Goodger.
 # Portions created by the Initial Developer are Copyright (C) 2005
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
 #   Ben Goodger <ben@mozilla.org>
 #   Jeff Walden <jwalden+code@mit.edu>
+#   Steffen Wilberg <steffen.wilberg@web.de>
 #
 # Alternatively, the contents of this file may be used under the terms of
 # either the GNU General Public License Version 2 or later (the "GPL"), or
 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 # in which case the provisions of the GPL or the LGPL are applicable instead
 # of those above. If you wish to allow use of your version of this file only
 # under the terms of either the GPL or the LGPL, and not to allow others to
 # use your version of this file under the terms of the MPL, indicate your
@@ -56,19 +57,17 @@ var gAdvancedPane = {
       advancedPrefs.selectedTab = document.getElementById(extraArgs["advancedTab"]);
     } else {
       var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
       if (preference.value !== null)
         advancedPrefs.selectedIndex = preference.value;
     }
 
 #ifdef MOZ_UPDATER
-    this.updateAppUpdateItems();
-    this.updateAutoItems();
-    this.updateModeItems();
+    this.updateReadPrefs();
 #endif
     this.updateOfflineApps();
 #ifdef MOZ_CRASHREPORTER
     this.initSubmitCrashes();
 #endif
     this.updateActualCacheSize();
   },
 
@@ -454,92 +453,100 @@ var gAdvancedPane = {
    * app.update.mode
    * - an integer:
    *     0    do not warn if an update will disable extensions or themes
    *     1    warn if an update will disable extensions or themes
    *     2    warn if an update will disable extensions or themes *or* if the
    *          update is a major update
    */
 
+#ifdef MOZ_UPDATER
   /**
-   * Enables and disables various UI preferences as necessary to reflect locked,
-   * disabled, and checked/unchecked states.
+   * Selects the item of the radiogroup, and sets the warnIncompatible checkbox
+   * based on the pref values and locked states.
    *
    * UI state matrix for update preference conditions
    * 
-   * UI Components:                                     Preferences
-   * 1 = Firefox checkbox                               i   = app.update.enabled
-   * 2 = When updates for Firefox are found label       ii  = app.update.auto
-   * 3 = Automatic Radiogroup (Ask vs. Automatically)   iii = app.update.mode
-   * 4 = Warn before disabling extensions checkbox
-   * 
-   * States:
-   * Element     p   val     locked    Disabled 
-   * 1           i   t/f     f         false
-   *             i   t/f     t         true
-   *             ii  t/f     t/f       false
-   *             iii 0/1/2   t/f       false
-   * 2,3         i   t       t/f       false
-   *             i   f       t/f       true
-   *             ii  t/f     f         false
-   *             ii  t/f     t         true
-   *             iii 0/1/2   t/f       false
-   * 4           i   t       t/f       false
-   *             i   f       t/f       true
-   *             ii  t       t/f       false
-   *             ii  f       t/f       true
-   *             iii 0/1/2   f         false
-   *             iii 0/1/2   t         true   
-   * 
+   * UI Components:                              Preferences
+   * Radiogroup                                  i   = app.update.enabled
+   * Warn before disabling extensions checkbox   ii  = app.update.auto
+   *                                             iii = app.update.mode
+   *
+   * Disabled states:
+   * Element           pref  value  locked  disabled
+   * radiogroup        i     t/f    f       false
+   *                   i     t/f    *t*     *true*
+   *                   ii    t/f    f       false
+   *                   ii    t/f    *t*     *true*
+   *                   iii   0/1/2  t/f     false
+   * warnIncompatible  i     t      f       false
+   *                   i     t      *t*     *true*
+   *                   i     *f*    t/f     *true*
+   *                   ii    t      f       false
+   *                   ii    t      *t*     *true*
+   *                   ii    *f*    t/f     *true*
+   *                   iii   0/1/2  f       false
+   *                   iii   0/1/2  *t*     *true*
    */
-#ifdef MOZ_UPDATER
-  updateAppUpdateItems: function () 
+  updateReadPrefs: function ()
   {
-    var aus = 
-        Components.classes["@mozilla.org/updates/update-service;1"].
-        getService(Components.interfaces.nsIApplicationUpdateService);
+    var enabledPref = document.getElementById("app.update.enabled");
+    var autoPref = document.getElementById("app.update.auto");
+    var radiogroup = document.getElementById("updateRadioGroup");
+
+    if (!enabledPref.value)   // Don't care for autoPref.value in this case.
+      radiogroup.value="manual"     // 3. Never check for updates.
+    else if (autoPref.value)  // enabledPref.value && autoPref.value
+      radiogroup.value="auto";      // 1. Automatically install updates
+    else                      // enabledPref.value && !autoPref.value
+      radiogroup.value="checkOnly"; // 2. Check, but let me choose
 
-    var enabledPref = document.getElementById("app.update.enabled");
-    var enableAppUpdate = document.getElementById("enableAppUpdate");
+    var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
+                     getService(Components.interfaces.nsIApplicationUpdateService).
+                     canCheckForUpdates;
+    // canCheck is false if the enabledPref is false and locked,
+    // or the binary platform or OS version is not known.
+    // A locked pref is sufficient to disable the radiogroup.
+    radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
 
-    enableAppUpdate.disabled = !aus.canCheckForUpdates || enabledPref.locked;
+    var modePref = document.getElementById("app.update.mode");
+    var warnIncompatible = document.getElementById("warnIncompatible");
+    // the warnIncompatible checkbox value is set by readAddonWarn
+    warnIncompatible.disabled = radiogroup.disabled || modePref.locked ||
+                                !enabledPref.value || !autoPref.value;
   },
 
   /**
-   * Enables/disables UI for "when updates are found" based on the values,
-   * and "locked" states of associated preferences.
+   * Sets the pref values based on the selected item of the radiogroup,
+   * and sets the disabled state of the warnIncompatible checkbox accordingly.
    */
-  updateAutoItems: function () 
+  updateWritePrefs: function ()
   {
     var enabledPref = document.getElementById("app.update.enabled");
     var autoPref = document.getElementById("app.update.auto");
-    
-    var updateModeLabel = document.getElementById("updateModeLabel");
-    var updateMode = document.getElementById("updateMode");
-    
-    var disable = enabledPref.locked || !enabledPref.value ||
-                  autoPref.locked;
-    updateModeLabel.disabled = updateMode.disabled = disable;
-  },
+    var radiogroup = document.getElementById("updateRadioGroup");
+    switch (radiogroup.value) {
+      case "auto":      // 1. Automatically install updates
+        enabledPref.value = true;
+        autoPref.value = true;
+        break;
+      case "checkOnly": // 2. Check, but let me choose
+        enabledPref.value = true;
+        autoPref.value = false;
+        break;
+      case "manual":    // 3. Never check for updates.
+        enabledPref.value = false;
+        autoPref.value = false;
+    }
 
-  /**
-   * Enables/disables the "warn if incompatible extensions/themes exist" UI
-   * based on the values and "locked" states of various preferences.
-   */
-  updateModeItems: function () 
-  {
-    var enabledPref = document.getElementById("app.update.enabled");
-    var autoPref = document.getElementById("app.update.auto");
+    var warnIncompatible = document.getElementById("warnIncompatible");
     var modePref = document.getElementById("app.update.mode");
-    
-    var warnIncompatible = document.getElementById("warnIncompatible");
-    
-    var disable = enabledPref.locked || !enabledPref.value || autoPref.locked ||
-                  !autoPref.value || modePref.locked;
-    warnIncompatible.disabled = disable;
+    warnIncompatible.disabled = enabledPref.locked || !enabledPref.value ||
+                                autoPref.locked || !autoPref.value ||
+                                modePref.locked;
   },
 
   /**
    * Stores the value of the app.update.mode preference, which is a tristate
    * integer preference.  We store the value here so that we can properly
    * restore the preference value if the UI reflecting the preference value
    * is in a state which can represent either of two integer values (as
    * opposed to only one possible value in the other UI state).
@@ -548,28 +555,28 @@ var gAdvancedPane = {
 
   /**
    * Reads the app.update.mode preference and converts its value into a
    * true/false value for use in determining whether the "Warn me if this will
    * disable extensions or themes" checkbox is checked.  We also save the value
    * of the preference so that the preference value can be properly restored if
    * the user's preferences cannot adequately be expressed by a single checkbox.
    *
-   * app.update.modee         Checkbox State    Meaning
+   * app.update.mode          Checkbox State    Meaning
    * 0                        Unchecked         Do not warn
    * 1                        Checked           Warn if there are incompatibilities
    * 2                        Checked           Warn if there are incompatibilities,
    *                                            or the update is major.
    */
   readAddonWarn: function ()
   {
     var preference = document.getElementById("app.update.mode");
-    var doNotWarn = preference.value != 0;
-    gAdvancedPane._modePreference = doNotWarn ? preference.value : 1;
-    return doNotWarn;
+    var warn = preference.value != 0;
+    gAdvancedPane._modePreference = warn ? preference.value : 1;
+    return warn;
   },
 
   /**
    * Converts the state of the "Warn me if this will disable extensions or
    * themes" checkbox into the integer preference which represents it,
    * returning that value.
    */
   writeAddonWarn: function ()
@@ -586,26 +593,26 @@ var gAdvancedPane = {
     var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
                              .createInstance(Components.interfaces.nsIUpdatePrompt);
     prompter.showUpdateHistory(window);
   },
 #endif
 
   /**
    * The Extensions checkbox and button are disabled only if the enable Addon
-   * update preference is locked. 
+   * update preference is locked.
    */
   updateAddonUpdateUI: function ()
   {
     var enabledPref = document.getElementById("extensions.update.enabled");
     var enableAddonUpdate = document.getElementById("enableAddonUpdate");
 
     enableAddonUpdate.disabled = enabledPref.locked;
-  },  
-  
+  },
+
   // ENCRYPTION TAB
 
   /*
    * Preferences:
    *
    * security.enable_ssl3
    * - true if SSL 3 encryption is enabled, false otherwise
    * security.enable_tls
--- a/browser/components/preferences/advanced.xul
+++ b/browser/components/preferences/advanced.xul
@@ -20,16 +20,17 @@
 # Ben Goodger.
 # Portions created by the Initial Developer are Copyright (C) 2005
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
 #   Ben Goodger <ben@mozilla.org>
 #   Jeff Walden <jwalden+code@mit.edu>
 #   Ehsan Akhgari <ehsan.akhgari@gmail.com>
+#   Steffen Wilberg <steffen.wilberg@web.de>
 #
 # Alternatively, the contents of this file may be used under the terms of
 # either the GNU General Public License Version 2 or later (the "GPL"), or
 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 # in which case the provisions of the GPL or the LGPL are applicable instead
 # of those above. If you wish to allow use of your version of this file only
 # under the terms of either the GPL or the LGPL, and not to allow others to
 # use your version of this file under the terms of the MPL, indicate your
@@ -95,25 +96,19 @@
  
       <preference id="browser.cache.disk.smart_size.enabled"
                   name="browser.cache.disk.smart_size.enabled"
                   inverted="true"
                   type="bool"/>
  
      <!-- Update tab -->
 #ifdef MOZ_UPDATER
-      <preference id="app.update.enabled"              name="app.update.enabled"              type="bool"
-                  onchange="gAdvancedPane.updateAppUpdateItems();
-                            gAdvancedPane.updateAutoItems();
-                            gAdvancedPane.updateModeItems();"/>
-      <preference id="app.update.auto"                 name="app.update.auto"                 type="bool"
-                  onchange="gAdvancedPane.updateAutoItems();
-                            gAdvancedPane.updateModeItems();"/>
-      <preference id="app.update.mode"                 name="app.update.mode"                 type="int"
-                  onchange="gAdvancedPane.updateModeItems();"/>
+      <preference id="app.update.enabled"              name="app.update.enabled"              type="bool"/>
+      <preference id="app.update.auto"                 name="app.update.auto"                 type="bool"/>
+      <preference id="app.update.mode"                 name="app.update.mode"                 type="int"/>
 
       <preference id="app.update.disable_button.showUpdateHistory"
                   name="app.update.disable_button.showUpdateHistory"
                   type="bool"/>
 #endif
 
       <preference id="extensions.update.enabled"       name="extensions.update.enabled"       type="bool"
                   onchange="gAdvancedPane.updateAddonUpdateUI();"/>
@@ -294,65 +289,61 @@
                         accesskey="&offlineAppsListRemove.accesskey;" 
                         oncommand="gAdvancedPane.removeOfflineApp();"/>
               </vbox>
             </hbox>
           </groupbox>
         </tabpanel>
 
         <!-- Update -->
-        <tabpanel id="updatePanel" orient="vertical" align="start">
-          <label control="autoUpdateGroup">&autoCheck.label;</label>
-          <vbox class="indent" id="autoUpdateGroup" role="group">
+        <tabpanel id="updatePanel" orient="vertical">
 #ifdef MOZ_UPDATER
-            <checkbox id="enableAppUpdate"
-                      label="&enableAppUpdate.label;"
-                      accesskey="&enableAppUpdate.accesskey;"
-                      preference="app.update.enabled"/>
+          <groupbox id="updateApp">
+            <caption label="&updateApp.label;"/>
+            <radiogroup id="updateRadioGroup"
+                        oncommand="gAdvancedPane.updateWritePrefs();">
+              <radio value="auto"
+                     label="&updateAuto.label;"
+                     accesskey="&updateAuto.accesskey;"/>
+              <hbox class="indent">
+                <checkbox id="warnIncompatible"
+                          label="&updateAutoAddonWarn.label;"
+                          accesskey="&updateAutoAddonWarn.accesskey;"
+                          preference="app.update.mode"
+                          onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
+                          onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
+              </hbox>
+              <radio value="checkOnly"
+                     label="&updateCheck.label;"
+                     accesskey="&updateCheck.accesskey;"/>
+              <radio value="manual"
+                     label="&updateManual.label;"
+                     accesskey="&updateManual.accesskey;"/>
+            </radiogroup>
+
+            <hbox>
+              <button id="showUpdateHistory"
+                      label="&updateHistory.label;"
+                      accesskey="&updateHistory.accesskey;"
+                      preference="app.update.disable_button.showUpdateHistory"
+                      oncommand="gAdvancedPane.showUpdates();"/>
+            </hbox>
+          </groupbox>
 #endif
+          <groupbox id="updateOthers">
+            <caption label="&updateOthers.label;"/>
             <checkbox id="enableAddonUpdate"
-                      label="&enableAddonsUpdate2.label;"
-                      accesskey="&enableAddonsUpdate2.accesskey;"
+                      label="&enableAddonsUpdate3.label;"
+                      accesskey="&enableAddonsUpdate3.accesskey;"
                       preference="extensions.update.enabled"/>
             <checkbox id="enableSearchUpdate"
                       label="&enableSearchUpdate.label;"
                       accesskey="&enableSearchUpdate.accesskey;"
                       preference="browser.search.update"/>
-          </vbox>
-
-#ifdef MOZ_UPDATER
-          <separator id="updateSeparator1"/>
-
-          <label id="updateModeLabel" control="updateMode">&whenUpdatesFound.label;</label>
-          <radiogroup id="updateMode" class="indent"
-                      preference="app.update.auto">
-            <radio id="ask" value="false"
-                   label="&askMe.label;"
-                   accesskey="&askMe.accesskey;"/>
-            <radio id="automatic" value="true"
-                   label="&modeAutomatic.label;"
-                   accesskey="&modeAutomatic.accesskey;"/>
-            <hbox class="indent">
-              <checkbox id="warnIncompatible" 
-                        label="&modeAutoAddonWarn.label;" accesskey="&modeAutoAddonWarn.accesskey;"
-                        preference="app.update.mode"
-                        onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
-                        onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
-            </hbox>
-          </radiogroup>
-
-          <separator id="updateSeparator2"/>
-
-          <hbox>
-            <button id="showUpdateHistory" 
-                    label="&updateHistory.label;" accesskey="&updateHistory.accesskey;"
-                    preference="app.update.disable_button.showUpdateHistory"
-                    oncommand="gAdvancedPane.showUpdates();"/>
-          </hbox>
-#endif
+          </groupbox>
         </tabpanel>
 
         <!-- Encryption -->
         <tabpanel id="encryptionPanel" orient="vertical">
 
           <!-- Protocols -->
           <groupbox id="protocolsGroup">
             <caption label="&protocols.label;"/>
--- a/browser/components/shell/src/nsWindowsShellService.cpp
+++ b/browser/components/shell/src/nsWindowsShellService.cpp
@@ -435,44 +435,49 @@ nsWindowsShellService::SetDefaultBrowser
   }
 
   return LaunchHelper(appHelperPath);
 }
 
 NS_IMETHODIMP
 nsWindowsShellService::GetShouldCheckDefaultBrowser(bool* aResult)
 {
+  NS_ENSURE_ARG_POINTER(aResult);
+
   // If we've already checked, the browser has been started and this is a 
   // new window open, and we don't want to check again.
   if (mCheckedThisSession) {
     *aResult = PR_FALSE;
     return NS_OK;
   }
 
   nsCOMPtr<nsIPrefBranch> prefs;
-  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
-  if (pserve)
-    pserve->GetBranch("", getter_AddRefs(prefs));
+  nsresult rv;
+  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
+  NS_ENSURE_SUCCESS(rv, rv);
 
-  prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
+  rv = pserve->GetBranch("", getter_AddRefs(prefs));
+  NS_ENSURE_SUCCESS(rv, rv);
 
-  return NS_OK;
+  return prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
 }
 
 NS_IMETHODIMP
 nsWindowsShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
 {
   nsCOMPtr<nsIPrefBranch> prefs;
-  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
-  if (pserve)
-    pserve->GetBranch("", getter_AddRefs(prefs));
+  nsresult rv;
 
-  prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
+  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
+  NS_ENSURE_SUCCESS(rv, rv);
+  
+  rv = pserve->GetBranch("", getter_AddRefs(prefs));
+  NS_ENSURE_SUCCESS(rv, rv);
 
-  return NS_OK;
+  return prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
 }
 
 static nsresult
 WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
 {
   nsRefPtr<gfxImageSurface> image;
   nsresult rv = aImage->CopyFrame(imgIContainer::FRAME_FIRST,
                                   imgIContainer::FLAG_SYNC_DECODE,
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_595934_message_categories.js
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_595934_message_categories.js
@@ -45,60 +45,61 @@ const TESTS = [
     matchString: "no element found",
   },
   { // #6
     file: "test-bug-595934-svg.xhtml",
     category: "SVG",
     matchString: "fooBarSVG",
   },
   { // #7
-    file: "test-bug-595934-workers.html",
-    category: "Web Worker",
-    matchString: "fooBarWorker",
-  },
-  { // #8
     file: "test-bug-595934-dom-html-external.html",
     category: "DOM:HTML",
     matchString: "document.all",
   },
-  { // #9
+  { // #8
     file: "test-bug-595934-dom-events-external2.html",
     category: "DOM Events",
     matchString: "preventBubble()",
   },
-  { // #10
+  { // #9
     file: "test-bug-595934-canvas.html",
     category: "Canvas",
     matchString: "strokeStyle",
   },
-  { // #11
+  { // #10
     file: "test-bug-595934-css-parser.html",
     category: "CSS Parser",
     matchString: "foobarCssParser",
   },
-  { // #12
+  { // #11
     file: "test-bug-595934-malformedxml-external.html",
     category: "malformed-xml",
     matchString: "</html>",
   },
-  { // #13
+  { // #12
     file: "test-bug-595934-empty-getelementbyid.html",
     category: "DOM",
     matchString: "getElementById",
   },
-  { // #14
+  { // #13
     file: "test-bug-595934-canvas-css.html",
     category: "CSS Parser",
     matchString: "foobarCanvasCssParser",
   },
-  { // #16
+  { // #14
     file: "test-bug-595934-image.html",
     category: "Image",
     matchString: "corrupt",
   },
+  /* Disabled until bug 675221 lands.
+  { // #7
+    file: "test-bug-595934-workers.html",
+    category: "Web Worker",
+    matchString: "fooBarWorker",
+  },*/
 ];
 
 let pos = -1;
 
 let foundCategory = false;
 let foundText = false;
 let output = null;
 let jsterm = null;
--- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
@@ -53,32 +53,35 @@
 <!ENTITY limitCacheSizeAfter.label       "MB of space">
 <!ENTITY clearCacheNow.label             "Clear Now">
 <!ENTITY clearCacheNow.accesskey         "C">
 <!ENTITY overrideSmartCacheSize.label    "Override automatic cache management">
 <!ENTITY overrideSmartCacheSize.accesskey "O">
 
 <!ENTITY updateTab.label                 "Update">
 
-<!ENTITY autoCheck.label                 "Automatically check for updates to:">
-<!ENTITY enableAppUpdate.label           "&brandShortName;">
-<!ENTITY enableAppUpdate.accesskey       "F">
-<!ENTITY enableAddonsUpdate2.label       "Add-ons">
-<!ENTITY enableAddonsUpdate2.accesskey   "n">
+<!ENTITY updateApp.label                 "&brandShortName; updates:">
+<!ENTITY updateAuto.label                "Automatically install updates (recommended: improved security)">
+<!ENTITY updateAuto.accesskey            "A">
+<!ENTITY updateCheck.label               "Check for updates, but let me choose whether to install them">
+<!ENTITY updateCheck.accesskey           "C">
+<!ENTITY updateManual.label              "Never check for updates (not recommended: security risk)">
+<!ENTITY updateManual.accesskey          "N">
+
+<!ENTITY updateAutoAddonWarn.label       "Warn me if this will disable any of my add-ons">
+<!ENTITY updateAutoAddonWarn.accesskey   "W">
+
+<!ENTITY updateHistory.label             "Show Update History">
+<!ENTITY updateHistory.accesskey         "p">
+
+<!ENTITY updateOthers.label              "Automatically update:">
+<!ENTITY enableAddonsUpdate3.label       "Add-ons">
+<!ENTITY enableAddonsUpdate3.accesskey   "o">
 <!ENTITY enableSearchUpdate.label        "Search Engines">
 <!ENTITY enableSearchUpdate.accesskey    "E">
-<!ENTITY whenUpdatesFound.label          "When updates to &brandShortName; are found:">
-<!ENTITY askMe.label                     "Ask me what I want to do">
-<!ENTITY askMe.accesskey                 "k">
-<!ENTITY modeAutomatic.label             "Automatically download and install the update">
-<!ENTITY modeAutomatic.accesskey         "d">
-<!ENTITY modeAutoAddonWarn.label         "Warn me if this will disable any of my add-ons">
-<!ENTITY modeAutoAddonWarn.accesskey     "W">
-<!ENTITY updateHistory.label             "Show Update History">
-<!ENTITY updateHistory.accesskey         "p">
 
 <!ENTITY offlineNotify.label             "Tell me when a website asks to store data for offline use">
 <!ENTITY offlineNotify.accesskey         "T">
 <!ENTITY offlineNotifyExceptions.label   "Exceptions…">
 <!ENTITY offlineNotifyExceptions.accesskey "x">
 
 <!ENTITY offlineAppsList.label           "The following websites have stored data for offline use:">
 <!ENTITY offlineAppsList.height          "7em">
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -148,23 +148,26 @@ MOZ_ZIPWRITER = @MOZ_ZIPWRITER@
 MOZ_OGG = @MOZ_OGG@
 MOZ_RAW = @MOZ_RAW@
 MOZ_SYDNEYAUDIO = @MOZ_SYDNEYAUDIO@
 MOZ_WAVE = @MOZ_WAVE@
 MOZ_MEDIA = @MOZ_MEDIA@
 MOZ_VORBIS = @MOZ_VORBIS@
 MOZ_TREMOR = @MOZ_TREMOR@
 MOZ_WEBM = @MOZ_WEBM@
+MOZ_VP8_ERROR_CONCEALMENT = @MOZ_VP8_ERROR_CONCEALMENT@
+MOZ_VP8_ENCODER = @MOZ_VP8_ENCODER@
 VPX_AS = @VPX_AS@
 VPX_ASFLAGS = @VPX_ASFLAGS@
 VPX_DASH_C_FLAG = @VPX_DASH_C_FLAG@
 VPX_AS_CONVERSION = @VPX_AS_CONVERSION@
 VPX_ASM_SUFFIX = @VPX_ASM_SUFFIX@
 VPX_X86_ASM = @VPX_X86_ASM@
 VPX_ARM_ASM = @VPX_ARM_ASM@
+VPX_NEED_OBJ_INT_EXTRACT = @VPX_NEED_OBJ_INT_EXTRACT@
 LIBJPEG_TURBO_AS = @LIBJPEG_TURBO_AS@
 LIBJPEG_TURBO_ASFLAGS = @LIBJPEG_TURBO_ASFLAGS@
 LIBJPEG_TURBO_X86_ASM = @LIBJPEG_TURBO_X86_ASM@
 LIBJPEG_TURBO_X64_ASM = @LIBJPEG_TURBO_X64_ASM@
 NS_PRINTING = @NS_PRINTING@
 MOZ_PDF_PRINTING = @MOZ_PDF_PRINTING@
 MOZ_CRASHREPORTER = @MOZ_CRASHREPORTER@
 MOZ_HELP_VIEWER = @MOZ_HELP_VIEWER@
@@ -640,17 +643,17 @@ MOZ_MAEMO_LIBLOCATION 	= @MOZ_MAEMO_LIBL
 MOZ_ENABLE_LIBCONIC = @MOZ_ENABLE_LIBCONIC@
 LIBCONIC_CFLAGS     = @LIBCONIC_CFLAGS@
 LIBCONIC_LIBS       = @LIBCONIC_LIBS@
 
 MACOS_SDK_DIR	= @MACOS_SDK_DIR@
 NEXT_ROOT	= @NEXT_ROOT@
 GCC_VERSION	= @GCC_VERSION@
 UNIVERSAL_BINARY= @UNIVERSAL_BINARY@
-MOZ_CAN_RUN_PROGRAMS = MOZ_CAN_RUN_PROGRAMS@
+MOZ_CAN_RUN_PROGRAMS = @MOZ_CAN_RUN_PROGRAMS@
 HAVE_DTRACE= @HAVE_DTRACE@
 
 VISIBILITY_FLAGS = @VISIBILITY_FLAGS@
 WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@
 
 HAVE_ARM_SIMD = @HAVE_ARM_SIMD@
 HAVE_ARM_NEON = @HAVE_ARM_NEON@
 HAVE_GCC_ALIGN_ARG_POINTER = @HAVE_GCC_ALIGN_ARG_POINTER@
--- a/configure.in
+++ b/configure.in
@@ -4320,16 +4320,18 @@ MOZ_AUTH_EXTENSION=1
 MOZ_OGG=1
 MOZ_RAW=
 MOZ_SYDNEYAUDIO=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_MEDIA=
 MOZ_WEBM=1
+MOZ_VP8_ERROR_CONCEALMENT=
+MOZ_VP8_ENCODER=
 VPX_AS=
 VPX_ASFLAGS=
 VPX_AS_DASH_C_FLAG=
 VPX_AS_CONVERSION=
 VPX_ASM_SUFFIX=
 VPX_X86_ASM=
 VPX_ARM_ASM=
 LIBJPEG_TURBO_AS=
@@ -5341,36 +5343,67 @@ MOZ_ARG_WITH_STRING(system-libvpx,
     LIBVPX_DIR=$withval)
 
 MOZ_NATIVE_LIBVPX=
 MOZ_LIBVPX_INCLUDES=
 MOZ_LIBVPX_LIBS=
 
 if test -n "$MOZ_WEBM"; then
     AC_DEFINE(MOZ_WEBM)
+    if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
+        AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
+    fi
+    if test -n "$MOZ_VP8_ENCODER" ; then
+        AC_DEFINE(MOZ_VP8_ENCODER)
+    fi
 
     if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
         _SAVE_CFLAGS=$CFLAGS
         _SAVE_LDFLAGS=$LDFLAGS
         _SAVE_LIBS=$LIBS
         if test "${LIBVPX_DIR}" = "yes"; then
             LIBVPX_DIR=/usr
         fi
         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
+        MOZ_NATIVE_LIBVPX_DEC_TEST=
         MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
             [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
              AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
             fi],
             AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
-                     [MOZ_NATIVE_LIBVPX=1
-                      MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
-                      MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
+                     [MOZ_NATIVE_LIBVPX_DEC_TEST=1],
                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
+        if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
+            AC_MSG_CHECKING([for libvpx version >= v0.9.7])
+            dnl We need at least v0.9.7 to fix several crash bugs (for which we
+            dnl had local patches prior to v0.9.7).
+            dnl
+            dnl This is a terrible test for the library version, but we don't
+            dnl have a good one. There is no version number in a public header,
+            dnl and testing the headers still doesn't guarantee we link against
+            dnl the right version. While we could call vpx_codec_version() at
+            dnl run-time, that would break cross-compiling. There are no
+            dnl additional exported symbols between the v0.9.7 release and the
+            dnl v0.9.6 one to check for.
+            AC_TRY_COMPILE([
+                #include <vpx/vpx_decoder.h>
+                #if !defined(VPX_CODEC_USE_INPUT_PARTITION)
+                    #error "test failed."
+                #endif
+                ],
+                [return 0;],
+                [AC_MSG_RESULT([yes])
+                 MOZ_NATIVE_LIBVPX=1
+                 MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
+                 MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
+                [AC_MSG_RESULT([no])
+                 AC_MSG_ERROR([--with-system-libvpx requested but it is not v0.9.7 or later])])
+        fi
         CFLAGS=$_SAVE_CFLAGS
         LDFLAGS=$_SAVE_LDFLAGS
         LIBS=$_SAVE_LIBS
     fi
 fi
 
 AC_SUBST(MOZ_NATIVE_LIBVPX)
 AC_SUBST(MOZ_LIBVPX_INCLUDES)
@@ -5389,16 +5422,17 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIV
     esac
 
 
     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
     dnl We currently require gcc on all arm platforms.
     VPX_AS=$YASM
     VPX_ASM_SUFFIX=asm
+    VPX_NEED_OBJ_INT_EXTRACT=
 
     dnl See if we have assembly on this platform.
     case "$OS_ARCH:$CPU_ARCH" in
     Linux:x86)
       VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
       VPX_X86_ASM=1
     ;;
     Linux:x86_64)
@@ -5432,16 +5466,17 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIV
         dnl Check for yasm 1.1 or greater.
         if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
           AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed.  Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
         elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
           AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
         else
           VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
           VPX_X86_ASM=1
+          dnl The encoder needs obj_int_extract to get asm offsets.
         fi
       fi
     ;;
     *:arm*)
       if test -n "$GNU_AS" ; then
         VPX_AS=$AS
         dnl These flags are a lie; they're just used to enable the requisite
         dnl opcodes; actual arch detection is done at runtime.
@@ -5452,16 +5487,26 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIV
         VPX_ARM_ASM=1
       fi
     esac
 
     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
       AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
     fi
 
+    if test -n "$MOZ_VP8_ENCODER" -a \
+            -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
+      dnl We prefer to get asm offsets using inline assembler, which the above
+      dnl compilers can do. When we're not using one of those, we have to fall
+      dnl back to obj_int_extract, which reads them from a compiled object
+      dnl file. Unfortunately, that only works if we're compiling on a system
+      dnl with the header files for the appropriate object file format.
+      VPX_NEED_OBJ_INT_EXTRACT=1
+    fi
+
     if test -n "$VPX_X86_ASM"; then
       AC_DEFINE(VPX_X86_ASM)
     elif test -n "$VPX_ARM_ASM"; then
       AC_DEFINE(VPX_ARM_ASM)
     else
       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
     fi
 fi
@@ -8465,25 +8510,28 @@ AC_SUBST(MOZ_APP_COMPONENT_LIBS)
 AC_SUBST(MOZ_APP_EXTRA_LIBS)
 
 AC_SUBST(MOZ_MEDIA)
 AC_SUBST(MOZ_SYDNEYAUDIO)
 AC_SUBST(MOZ_WAVE)
 AC_SUBST(MOZ_VORBIS)
 AC_SUBST(MOZ_TREMOR)
 AC_SUBST(MOZ_WEBM)
+AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
+AC_SUBST(MOZ_VP8_ENCODER)
 AC_SUBST(MOZ_OGG)
 AC_SUBST(MOZ_ALSA_LIBS)
 AC_SUBST(VPX_AS)
 AC_SUBST(VPX_ASFLAGS)
 AC_SUBST(VPX_DASH_C_FLAG)
 AC_SUBST(VPX_AS_CONVERSION)
 AC_SUBST(VPX_ASM_SUFFIX)
 AC_SUBST(VPX_X86_ASM)
 AC_SUBST(VPX_ARM_ASM)
+AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
 AC_SUBST(LIBJPEG_TURBO_AS)
 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
 
 AC_MSG_CHECKING([for posix_fallocate])
 AC_TRY_LINK([#define _XOPEN_SOURCE 600
--- a/content/base/src/ThirdPartyUtil.cpp
+++ b/content/base/src/ThirdPartyUtil.cpp
@@ -52,56 +52,16 @@ ThirdPartyUtil::Init()
 {
   NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_NOT_AVAILABLE);
 
   nsresult rv;
   mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
   return rv;
 }
 
-// Get the base domain for aHostURI; e.g. for "www.bbc.co.uk", this would be
-// "bbc.co.uk". Only properly-formed URI's are tolerated, though a trailing
-// dot may be present. If aHostURI is an IP address, an alias such as
-// 'localhost', an eTLD such as 'co.uk', or the empty string, aBaseDomain will
-// be the exact host. The result of this function should only be used in exact
-// string comparisons, since substring comparisons will not be valid for the
-// special cases elided above.
-nsresult
-ThirdPartyUtil::GetBaseDomain(nsIURI* aHostURI,
-                              nsCString& aBaseDomain)
-{
-  // Get the base domain. this will fail if the host contains a leading dot,
-  // more than one trailing dot, or is otherwise malformed.
-  nsresult rv = mTLDService->GetBaseDomain(aHostURI, 0, aBaseDomain);
-  if (rv == NS_ERROR_HOST_IS_IP_ADDRESS ||
-      rv == NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS) {
-    // aHostURI is either an IP address, an alias such as 'localhost', an eTLD
-    // such as 'co.uk', or the empty string. Uses the normalized host in such
-    // cases.
-    rv = aHostURI->GetAsciiHost(aBaseDomain);
-  }
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // aHostURI (and thus aBaseDomain) may be the string '.'. If so, fail.
-  if (aBaseDomain.Length() == 1 && aBaseDomain.Last() == '.')
-    return NS_ERROR_INVALID_ARG;
-
-  // Reject any URIs without a host that aren't file:// URIs. This makes it the
-  // only way we can get a base domain consisting of the empty string, which
-  // means we can safely perform foreign tests on such URIs where "not foreign"
-  // means "the involved URIs are all file://".
-  if (aBaseDomain.IsEmpty()) {
-    bool isFileURI = false;
-    aHostURI->SchemeIs("file", &isFileURI);
-    NS_ENSURE_TRUE(isFileURI, NS_ERROR_INVALID_ARG);
-  }
-
-  return NS_OK;
-}
-
 // Determine if aFirstDomain is a different base domain to aSecondURI; or, if
 // the concept of base domain does not apply, determine if the two hosts are not
 // string-identical.
 nsresult
 ThirdPartyUtil::IsThirdPartyInternal(const nsCString& aFirstDomain,
                                      nsIURI* aSecondURI,
                                      bool* aResult)
 {
@@ -311,8 +271,47 @@ ThirdPartyUtil::IsThirdPartyChannel(nsIC
     ourWin = parentWin;
   }
 
   // Check the window hierarchy. This covers most cases for an ordinary page
   // load from the location bar.
   return IsThirdPartyWindow(ourWin, channelURI, aResult);
 }
 
+// Get the base domain for aHostURI; e.g. for "www.bbc.co.uk", this would be
+// "bbc.co.uk". Only properly-formed URI's are tolerated, though a trailing
+// dot may be present. If aHostURI is an IP address, an alias such as
+// 'localhost', an eTLD such as 'co.uk', or the empty string, aBaseDomain will
+// be the exact host. The result of this function should only be used in exact
+// string comparisons, since substring comparisons will not be valid for the
+// special cases elided above.
+NS_IMETHODIMP
+ThirdPartyUtil::GetBaseDomain(nsIURI* aHostURI,
+                              nsACString& aBaseDomain)
+{
+  // Get the base domain. this will fail if the host contains a leading dot,
+  // more than one trailing dot, or is otherwise malformed.
+  nsresult rv = mTLDService->GetBaseDomain(aHostURI, 0, aBaseDomain);
+  if (rv == NS_ERROR_HOST_IS_IP_ADDRESS ||
+      rv == NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS) {
+    // aHostURI is either an IP address, an alias such as 'localhost', an eTLD
+    // such as 'co.uk', or the empty string. Uses the normalized host in such
+    // cases.
+    rv = aHostURI->GetAsciiHost(aBaseDomain);
+  }
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  // aHostURI (and thus aBaseDomain) may be the string '.'. If so, fail.
+  if (aBaseDomain.Length() == 1 && aBaseDomain.Last() == '.')
+    return NS_ERROR_INVALID_ARG;
+
+  // Reject any URIs without a host that aren't file:// URIs. This makes it the
+  // only way we can get a base domain consisting of the empty string, which
+  // means we can safely perform foreign tests on such URIs where "not foreign"
+  // means "the involved URIs are all file://".
+  if (aBaseDomain.IsEmpty()) {
+    bool isFileURI = false;
+    aHostURI->SchemeIs("file", &isFileURI);
+    NS_ENSURE_TRUE(isFileURI, NS_ERROR_INVALID_ARG);
+  }
+
+  return NS_OK;
+}
--- a/content/base/src/ThirdPartyUtil.h
+++ b/content/base/src/ThirdPartyUtil.h
@@ -51,17 +51,16 @@ class ThirdPartyUtil : public mozIThirdP
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZITHIRDPARTYUTIL
 
   nsresult Init();
 
 private:
-  nsresult GetBaseDomain(nsIURI* aHostURI, nsCString& aBaseDomain);
   nsresult IsThirdPartyInternal(const nsCString& aFirstDomain,
     nsIURI* aSecondURI, bool* aResult);
   static already_AddRefed<nsIURI> GetURIFromWindow(nsIDOMWindow* aWin);
 
   nsCOMPtr<nsIEffectiveTLDService> mTLDService;
 };
 
 #endif
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -960,16 +960,20 @@ bool WebGLContext::IsExtensionSupported(
 
     return isSupported;
 }
 
 NS_IMETHODIMP
 WebGLContext::GetExtension(const nsAString& aName, nsIWebGLExtension **retval)
 {
     *retval = nsnull;
+    
+    if (mDisableExtensions) {
+        return NS_OK;
+    }
 
     // handle simple extensions that don't need custom objects first
     WebGLExtensionID ei = WebGLExtensionID_Max;
     if (aName.EqualsLiteral("OES_texture_float")) {
         if (IsExtensionSupported(WebGL_OES_texture_float))
             ei = WebGL_OES_texture_float;
     }
     else if (aName.EqualsLiteral("OES_standard_derivatives")) {
@@ -1296,16 +1300,22 @@ WebGLActiveInfo::GetName(nsAString & aNa
 {
     aName = mName;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::GetSupportedExtensions(nsIVariant **retval)
 {
+    *retval = nsnull;
+    
+    if (mDisableExtensions) {
+        return NS_OK;
+    }
+    
     nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
     NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
 
     nsTArray<const char *> extList;
 
     if (IsExtensionSupported(WebGL_OES_texture_float))
         extList.InsertElementAt(extList.Length(), "OES_texture_float");
     if (IsExtensionSupported(WebGL_OES_standard_derivatives))
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -58,16 +58,34 @@
 #include "nsIJSNativeInitializer.h"
 #include "nsIMemoryReporter.h"
 
 #include "GLContextProvider.h"
 #include "Layers.h"
 
 #include "CheckedInt.h"
 
+/* 
+ * Minimum value constants defined in 6.2 State Tables of OpenGL ES - 2.0.25
+ *   https://bugzilla.mozilla.org/show_bug.cgi?id=686732
+ * 
+ * Exceptions: some of the following values are set to higher values than in the spec because
+ * the values in the spec are ridiculously low. They are explicitly marked below
+*/
+#define MINVALUE_GL_MAX_TEXTURE_SIZE                  1024  // Different from the spec, which sets it to 64 on page 162
+#define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE         512   // Different from the spec, which sets it to 16 on page 162
+#define MINVALUE_GL_MAX_VERTEX_ATTRIBS                8     // Page 164
+#define MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS      16    // Page 164
+#define MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS        128   // Page 164
+#define MINVALUE_GL_MAX_VARYING_VECTORS               8     // Page 164
+#define MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS           8     // Page 164
+#define MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS    0     // Page 164
+#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE             1024  // Different from the spec, which sets it to 1 on page 164
+#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS  8     // Page 164
+
 class nsIDocShell;
 class nsIPropertyBag;
 
 namespace mozilla {
 
 class WebGLTexture;
 class WebGLBuffer;
 class WebGLProgram;
@@ -410,16 +428,20 @@ public:
     }
     
     // checks for GL errors, clears any pending GL error,
     // and stores the current GL error into mWebGLError if it doesn't already have an error set
     void UpdateWebGLErrorAndClearGLError() {
         GLenum currentGLError;
         UpdateWebGLErrorAndClearGLError(&currentGLError);
     }
+    
+    bool MinCapabilityMode() const {
+        return mMinCapability;
+    }
 
 protected:
     void SetDontKnowIfNeedFakeBlack() {
         mFakeBlackStatus = DontKnowIfNeedFakeBlack;
     }
 
     bool NeedFakeBlack();
     void BindFakeBlackTextures();
@@ -451,16 +473,18 @@ protected:
     CheckedUint32 mGeneration;
 
     WebGLContextOptions mOptions;
 
     bool mInvalidated;
     bool mResetLayer;
     bool mVerbose;
     bool mOptionsFrozen;
+    bool mMinCapability;
+    bool mDisableExtensions;
 
     WebGLuint mActiveTexture;
     WebGLenum mWebGLError;
 
     // whether shader validation is supported
     bool mShaderValidation;
 
     // some GL constants
@@ -2081,20 +2105,18 @@ public:
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(WebGLExtension, WEBGLACTIVEINFO_PRIVATE_IID)
 
 /**
  ** Template implementations
  **/
 
-/* Helper function taking a BaseInterfaceType pointer and check that
- * it matches the required concrete implementation type (if it's
- * non-null), that it's not null/deleted unless we allowed it to, and
- * obtain a pointer to the concrete object.
+/* Helper function taking a BaseInterfaceType pointer, casting it to
+ * ConcreteObjectType and performing some checks along the way.
  *
  * By default, null (respectively: deleted) aInterface pointers are
  * not allowed, but if you pass a non-null isNull (respectively:
  * isDeleted) pointer, then they become allowed and the value at
  * isNull (respecively isDeleted) is overwritten.
  *
  * If generateErrors is true (which is the default) then upon errors,
  * GL errors are synthesized and error messages are printed, prepended by
@@ -2122,22 +2144,28 @@ WebGLContext::GetConcreteObject(const ch
                 ErrorInvalidValue("%s: null object passed as argument", info);
             return PR_FALSE;
         }
     }
 
     if (isNull)
         *isNull = PR_FALSE;
 
-    nsresult rv;
-    nsCOMPtr<ConcreteObjectType> tmp(do_QueryInterface(aInterface, &rv));
-    if (NS_FAILED(rv))
-        return PR_FALSE;
-
-    *aConcreteObject = tmp;
+#ifdef DEBUG
+    {
+        // once bug 694114 is implemented, we want to replace this by a static assertion, without #ifdef DEBUG
+        nsresult rv;
+        do_QueryInterface(aInterface, &rv);
+        NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv),
+                          "QueryInterface failed. WebGL objects are builtinclass, so this should never happen. "
+                          "Please file a bug at bugzilla.mozilla.org -> Core -> Canvas:WebGL and link to the present page.");
+    }
+#endif
+    
+    *aConcreteObject = static_cast<ConcreteObjectType*>(aInterface);
 
     if (!(*aConcreteObject)->IsCompatibleWithContext(this)) {
         // the object doesn't belong to this WebGLContext
         if (generateErrors)
             ErrorInvalidOperation("%s: object from different WebGL context (or older generation of this one) "
                                   "passed as argument", info);
         return PR_FALSE;
     }
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -1895,17 +1895,71 @@ NS_IMETHODIMP
 WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
 {
     *retval = nsnull;
 
     nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
     NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
 
     MakeContextCurrent();
-
+    
+    if (MinCapabilityMode()) {
+        bool override = true;
+        switch(pname) {
+            //
+            // Single-value params
+            //
+                
+// int
+            case LOCAL_GL_MAX_VERTEX_ATTRIBS:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_VERTEX_ATTRIBS);
+                break;
+            
+            case LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS);
+                break;
+            
+            case LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS);
+                break;
+            
+            case LOCAL_GL_MAX_VARYING_VECTORS:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_VARYING_VECTORS);
+                break;
+            
+            case LOCAL_GL_MAX_TEXTURE_SIZE:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_TEXTURE_SIZE);
+                break;
+            
+            case LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE);
+                break;
+            
+            case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS);
+                break;
+            
+            case LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+                break;
+                
+            case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
+                wrval->SetAsInt32(MINVALUE_GL_MAX_RENDERBUFFER_SIZE);
+                break;
+            
+            default:
+                override = false;
+        }
+        
+        if (override) {
+            *retval = wrval.forget().get();
+            return NS_OK;
+        }
+    }
+    
     switch (pname) {
         //
         // String params
         //
 
         case LOCAL_GL_VENDOR:
             wrval->SetAsDOMString(NS_LITERAL_STRING("Mozilla"));
             break;
--- a/content/canvas/src/WebGLContextValidate.cpp
+++ b/content/canvas/src/WebGLContextValidate.cpp
@@ -58,17 +58,21 @@ bool
 WebGLProgram::UpdateInfo(gl::GLContext *gl)
 {
     gl->fGetProgramiv(mName, LOCAL_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &mAttribMaxNameLength);
     gl->fGetProgramiv(mName, LOCAL_GL_ACTIVE_UNIFORM_MAX_LENGTH, &mUniformMaxNameLength);
     gl->fGetProgramiv(mName, LOCAL_GL_ACTIVE_UNIFORMS, &mUniformCount);
     gl->fGetProgramiv(mName, LOCAL_GL_ACTIVE_ATTRIBUTES, &mAttribCount);
 
     GLint numVertexAttribs;
-    gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs);
+    if (mContext->MinCapabilityMode())  {
+        numVertexAttribs = MINVALUE_GL_MAX_VERTEX_ATTRIBS;
+    } else {
+        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs);
+    }
     mAttribsInUse.clear();
     mAttribsInUse.resize(numVertexAttribs);
 
     nsAutoArrayPtr<char> nameBuf(new char[mAttribMaxNameLength]);
 
     for (int i = 0; i < mAttribCount; ++i) {
         GLint attrnamelen;
         GLint attrsize;
@@ -498,16 +502,19 @@ WebGLContext::InitAndValidateGL()
     if (!gl) return PR_FALSE;
 
     GLenum error = gl->fGetError();
     if (error != LOCAL_GL_NO_ERROR) {
         LogMessage("GL error 0x%x occurred during OpenGL context initialization, before WebGL initialization!", error);
         return PR_FALSE;
     }
 
+    mMinCapability = Preferences::GetBool("webgl.min_capability_mode", false);
+    mDisableExtensions = Preferences::GetBool("webgl.disable-extensions", false);
+
     mActiveTexture = 0;
     mWebGLError = LOCAL_GL_NO_ERROR;
 
     mAttribBuffers.Clear();
 
     mUniformTextures.Clear();
     mBound2DTextures.Clear();
     mBoundCubeMapTextures.Clear();
@@ -528,89 +535,109 @@ WebGLContext::InitAndValidateGL()
 
     MakeContextCurrent();
 
     // on desktop OpenGL, we always keep vertex attrib 0 array enabled
     if (!gl->IsGLES2()) {
         gl->fEnableVertexAttribArray(0);
     }
 
-    gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &mGLMaxVertexAttribs);
+    if (MinCapabilityMode()) {
+        mGLMaxVertexAttribs = MINVALUE_GL_MAX_VERTEX_ATTRIBS;
+    } else {
+        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &mGLMaxVertexAttribs);
+    }
     if (mGLMaxVertexAttribs < 8) {
         LogMessage("GL_MAX_VERTEX_ATTRIBS: %d is < 8!", mGLMaxVertexAttribs);
-        return PR_FALSE;
+        return false;
     }
 
     mAttribBuffers.SetLength(mGLMaxVertexAttribs);
 
     // Note: GL_MAX_TEXTURE_UNITS is fixed at 4 for most desktop hardware,
     // even though the hardware supports much more.  The
     // GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS value is the accurate value.
-    gl->fGetIntegerv(LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mGLMaxTextureUnits);
+    if (MinCapabilityMode()) {
+        mGLMaxTextureUnits = MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS;
+    } else {
+        gl->fGetIntegerv(LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mGLMaxTextureUnits);
+    }
     if (mGLMaxTextureUnits < 8) {
         LogMessage("GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: %d is < 8!", mGLMaxTextureUnits);
-        return PR_FALSE;
+        return false;
     }
 
     mBound2DTextures.SetLength(mGLMaxTextureUnits);
     mBoundCubeMapTextures.SetLength(mGLMaxTextureUnits);
 
-    gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mGLMaxTextureSize);
-    gl->fGetIntegerv(LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE, &mGLMaxCubeMapTextureSize);
+    if (MinCapabilityMode()) {
+        mGLMaxTextureSize = MINVALUE_GL_MAX_TEXTURE_SIZE;
+        mGLMaxCubeMapTextureSize = MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE;
+        mGLMaxTextureImageUnits = MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS;
+        mGLMaxVertexTextureImageUnits = MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS;
+    } else {
+        gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mGLMaxTextureSize);
+        gl->fGetIntegerv(LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE, &mGLMaxCubeMapTextureSize);
+        gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, &mGLMaxTextureImageUnits);
+        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &mGLMaxVertexTextureImageUnits);
+    }
     
 #ifdef XP_MACOSX
     if (gl->Vendor() == gl::GLContext::VendorIntel) {
         // bug 684882, corruption in large cube maps on Intel Mac driver.
         // Is reported to only affect Mac OS < 10.7.2 but don't want to rely on that yet.
         mGLMaxCubeMapTextureSize = NS_MIN(mGLMaxCubeMapTextureSize, 512);
     }
 #endif
 
-    gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, &mGLMaxTextureImageUnits);
-    gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &mGLMaxVertexTextureImageUnits);
-
-    if (gl->HasES2Compatibility()) {
-        gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, &mGLMaxFragmentUniformVectors);
-        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, &mGLMaxVertexUniformVectors);
-        gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, &mGLMaxVaryingVectors);
+    if (MinCapabilityMode()) {
+        mGLMaxFragmentUniformVectors = MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS;
+        mGLMaxVertexUniformVectors = MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS;
+        mGLMaxVaryingVectors = MINVALUE_GL_MAX_VARYING_VECTORS;
     } else {
-        gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &mGLMaxFragmentUniformVectors);
-        mGLMaxFragmentUniformVectors /= 4;
-        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, &mGLMaxVertexUniformVectors);
-        mGLMaxVertexUniformVectors /= 4;
+        if (gl->HasES2Compatibility()) {
+            gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, &mGLMaxFragmentUniformVectors);
+            gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, &mGLMaxVertexUniformVectors);
+            gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, &mGLMaxVaryingVectors);
+        } else {
+            gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &mGLMaxFragmentUniformVectors);
+            mGLMaxFragmentUniformVectors /= 4;
+            gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, &mGLMaxVertexUniformVectors);
+            mGLMaxVertexUniformVectors /= 4;
 
-        // we are now going to try to read GL_MAX_VERTEX_OUTPUT_COMPONENTS and GL_MAX_FRAGMENT_INPUT_COMPONENTS,
-        // however these constants only entered the OpenGL standard at OpenGL 3.2. So we will try reading,
-        // and check OpenGL error for INVALID_ENUM.
+            // we are now going to try to read GL_MAX_VERTEX_OUTPUT_COMPONENTS and GL_MAX_FRAGMENT_INPUT_COMPONENTS,
+            // however these constants only entered the OpenGL standard at OpenGL 3.2. So we will try reading,
+            // and check OpenGL error for INVALID_ENUM.
 
-        // before we start, we check that no error already occurred, to prevent hiding it in our subsequent error handling
-        error = gl->GetAndClearError();
-        if (error != LOCAL_GL_NO_ERROR) {
-            LogMessage("GL error 0x%x occurred during WebGL context initialization!", error);
-            return PR_FALSE;
-        }
+            // before we start, we check that no error already occurred, to prevent hiding it in our subsequent error handling
+            error = gl->GetAndClearError();
+            if (error != LOCAL_GL_NO_ERROR) {
+                LogMessage("GL error 0x%x occurred during WebGL context initialization!", error);
+                return false;
+            }
 
-        // On the public_webgl list, "problematic GetParameter pnames" thread, the following formula was given:
-        //   mGLMaxVaryingVectors = min (GL_MAX_VERTEX_OUTPUT_COMPONENTS, GL_MAX_FRAGMENT_INPUT_COMPONENTS) / 4
-        GLint maxVertexOutputComponents,
-              minFragmentInputComponents;
-        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &maxVertexOutputComponents);
-        gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS, &minFragmentInputComponents);
+            // On the public_webgl list, "problematic GetParameter pnames" thread, the following formula was given:
+            //   mGLMaxVaryingVectors = min (GL_MAX_VERTEX_OUTPUT_COMPONENTS, GL_MAX_FRAGMENT_INPUT_COMPONENTS) / 4
+            GLint maxVertexOutputComponents,
+                  minFragmentInputComponents;
+            gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &maxVertexOutputComponents);
+            gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS, &minFragmentInputComponents);
 
-        error = gl->fGetError();
-        switch (error) {
-            case LOCAL_GL_NO_ERROR:
-                mGLMaxVaryingVectors = NS_MIN(maxVertexOutputComponents, minFragmentInputComponents) / 4;
-                break;
-            case LOCAL_GL_INVALID_ENUM:
-                mGLMaxVaryingVectors = 16; // = 64/4, 64 is the min value for maxVertexOutputComponents in OpenGL 3.2 spec
-                break;
-            default:
-                LogMessage("GL error 0x%x occurred during WebGL context initialization!", error);
-                return PR_FALSE;
+            error = gl->GetAndClearError();
+            switch (error) {
+                case LOCAL_GL_NO_ERROR:
+                    mGLMaxVaryingVectors = NS_MIN(maxVertexOutputComponents, minFragmentInputComponents) / 4;
+                    break;
+                case LOCAL_GL_INVALID_ENUM:
+                    mGLMaxVaryingVectors = 16; // = 64/4, 64 is the min value for maxVertexOutputComponents in OpenGL 3.2 spec
+                    break;
+                default:
+                    LogMessage("GL error 0x%x occurred during WebGL context initialization!", error);
+                    return false;
+            }   
         }
     }
 
     // Always 1 for GLES2
     mMaxFramebufferColorAttachments = 1;
 
     if (!gl->IsGLES2()) {
         // gl_PointSize is always available in ES2 GLSL, but has to be
--- a/content/canvas/test/webgl/failing_tests_linux.txt
+++ b/content/canvas/test/webgl/failing_tests_linux.txt
@@ -12,10 +12,9 @@ conformance/gl-uniform-bool.html
 conformance/glsl-conformance.html
 conformance/glsl-long-variable-names.html
 conformance/premultiplyalpha-test.html
 conformance/read-pixels-test.html
 conformance/uninitialized-test.html
 conformance/more/conformance/quickCheckAPI.html
 conformance/more/functions/copyTexImage2D.html
 conformance/more/functions/copyTexSubImage2D.html
-conformance/more/functions/deleteBufferBadArgs.html
 conformance/more/functions/uniformfArrayLen1.html
--- a/content/canvas/test/webgl/failing_tests_mac.txt
+++ b/content/canvas/test/webgl/failing_tests_mac.txt
@@ -8,11 +8,10 @@ conformance/glsl-long-variable-names.htm
 conformance/premultiplyalpha-test.html
 conformance/program-test.html
 conformance/read-pixels-test.html
 conformance/tex-input-validation.html
 conformance/texture-npot.html
 conformance/more/conformance/quickCheckAPI.html
 conformance/more/functions/copyTexImage2D.html
 conformance/more/functions/copyTexSubImage2D.html
-conformance/more/functions/deleteBufferBadArgs.html
 conformance/more/functions/uniformfBadArgs.html
 conformance/more/functions/uniformiBadArgs.html
--- a/content/canvas/test/webgl/failing_tests_windows.txt
+++ b/content/canvas/test/webgl/failing_tests_windows.txt
@@ -3,10 +3,9 @@ conformance/drawingbuffer-test.html
 conformance/framebuffer-object-attachment.html
 conformance/glsl-conformance.html
 conformance/glsl-long-variable-names.html
 conformance/premultiplyalpha-test.html
 conformance/read-pixels-test.html
 conformance/more/conformance/quickCheckAPI.html
 conformance/more/functions/copyTexImage2D.html
 conformance/more/functions/copyTexSubImage2D.html
-conformance/more/functions/deleteBufferBadArgs.html
 conformance/more/functions/uniformfArrayLen1.html
new file mode 100644
--- /dev/null
+++ b/dom/base/crashtests/693894.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script>
+
+var nodeList = document.getElementsByName("html");
+nodeList.__proto__ = null;
+nodeList.x;
+
+</script>
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -24,8 +24,9 @@ load 502617.html
 asserts(1-2) load 504224.html # bug 564098
 load 603531.html
 load 601247.html
 load 609560-1.xhtml
 load 612018-1.html
 load 637116.html
 load 666869.html
 load 675621-1.html
+load 693894.html
--- a/dom/base/nsDOMClassInfoID.h
+++ b/dom/base/nsDOMClassInfoID.h
@@ -82,18 +82,22 @@ DOMCI_CASTABLE_INTERFACE(nsIContent, nsI
 DOMCI_CASTABLE_INTERFACE(nsIDocument, nsIDocument, 2, _extra)                 \
 DOMCI_CASTABLE_INTERFACE(nsINodeList, nsINodeList, 3, _extra)                 \
 DOMCI_CASTABLE_INTERFACE(nsICSSDeclaration, nsICSSDeclaration, 4, _extra)     \
 DOMCI_CASTABLE_INTERFACE(nsDocument, nsIDocument, 5, _extra)                  \
 DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsGenericHTMLElement, 6,       \
                          _extra)                                              \
 DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 7, _extra)              \
 DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra)         \
-DOMCI_CASTABLE_INTERFACE(nsSVGStylableElement, nsIContent, 9, _extra)
-
+DOMCI_CASTABLE_INTERFACE(nsSVGStylableElement, nsIContent, 9, _extra)         \
+DOMCI_CASTABLE_INTERFACE(nsIDOMWebGLRenderingContext,                         \
+                         nsIDOMWebGLRenderingContext, 10, _extra)             \
+DOMCI_CASTABLE_INTERFACE(nsIWebGLUniformLocation,                             \
+                         nsIWebGLUniformLocation, 11, _extra)
+ 
 // Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
 // have been declared.
 #define DOMCI_CASTABLE_INTERFACE(_interface, _u1, _u2, _u3) class _interface;
 DOMCI_CASTABLE_INTERFACES(unused)
 #undef DOMCI_CASTABLE_INTERFACE
 
 #ifdef _IMPL_NS_LAYOUT
 
--- a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
+++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
@@ -69,97 +69,97 @@ struct TypedArray;
 %}
 
 [ptr] native WebGLJSObjectPtr (JSObject);
 
 //
 // OpenGL object wrappers
 //
 
-[scriptable, uuid(0df9f4ed-f5ff-4e51-a6ff-2bd9785a7639)]
+[scriptable, builtinclass, uuid(0df9f4ed-f5ff-4e51-a6ff-2bd9785a7639)]
 interface nsIWebGLTexture : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(9eca9c32-8305-11de-b89b-000c29206271)]
+[scriptable, builtinclass, uuid(9eca9c32-8305-11de-b89b-000c29206271)]
 interface nsIWebGLBuffer : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(a6a19e74-8305-11de-9ce9-000c29206271)]
+[scriptable, builtinclass, uuid(a6a19e74-8305-11de-9ce9-000c29206271)]
 interface nsIWebGLProgram : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(ac7440a4-8305-11de-807b-000c29206271)]
+[scriptable, builtinclass, uuid(ac7440a4-8305-11de-807b-000c29206271)]
 interface nsIWebGLShader : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(beea4b38-3094-4e8d-b6e6-8b21d07e8994)]
+[scriptable, builtinclass, uuid(beea4b38-3094-4e8d-b6e6-8b21d07e8994)]
 interface nsIWebGLShaderArray : nsISupports
 {
     readonly attribute unsigned long length;
     nsIWebGLShader item(in unsigned long index);
 };
 
-[scriptable, uuid(bce8be60-8305-11de-9f3c-000c29206271)]
+[scriptable, builtinclass, uuid(bce8be60-8305-11de-9f3c-000c29206271)]
 interface nsIWebGLFramebuffer : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(c82eacd0-8305-11de-9de9-000c29206271)]
+[scriptable, builtinclass, uuid(c82eacd0-8305-11de-9de9-000c29206271)]
 interface nsIWebGLRenderbuffer : nsISupports
 {
   [noscript] attribute WebGLuint name;
 };
 
-[scriptable, uuid(a85d4fd0-5b9f-4cb8-aeee-5a2c5c5bad76)]
+[scriptable, builtinclass, uuid(a85d4fd0-5b9f-4cb8-aeee-5a2c5c5bad76)]
 interface nsIWebGLActiveInfo : nsISupports
 {
     readonly attribute WebGLint size;
     readonly attribute WebGLenum type;
     readonly attribute DOMString name;
 };
 
-[scriptable, uuid(d38b0467-623e-4c82-9140-5f14a3bd1bad)]
+[scriptable, builtinclass, uuid(d38b0467-623e-4c82-9140-5f14a3bd1bad)]
 interface nsIWebGLUniformLocation : nsISupports
 {
     [noscript] attribute WebGLint location;
 };
 
 /* Base class for all WebGL extensions, and for those without
  * any additional tokens/methods.
  */
-[scriptable, uuid(70814f32-a5c5-4b95-83d5-ac653bac3316)]
+[scriptable, builtinclass, uuid(70814f32-a5c5-4b95-83d5-ac653bac3316)]
 interface nsIWebGLExtension : nsISupports
 {
 };
 
 /* Classes that extend on nsIWebGLExtension and provide
  * extra tokens, functions, etc.
  */
-[scriptable, uuid(3de3dfd9-864a-4e4c-989b-2977eaa80b7b)]
+[scriptable, builtinclass, uuid(3de3dfd9-864a-4e4c-989b-2977eaa80b7b)]
 interface nsIWebGLExtensionStandardDerivatives : nsIWebGLExtension
 {
   //
   //  CONSTANTS
   //
 
   /* Fragment shader hint */
   const WebGLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES   = 0x8B8B;
 };
 
 
-[scriptable, uuid(ef15ae85-4670-4dc4-848d-51ca81e8397a)]
+[scriptable, builtinclass, uuid(ef15ae85-4670-4dc4-848d-51ca81e8397a)]
 interface nsIDOMWebGLRenderingContext : nsISupports
 {
   //
   //  CONSTANTS
   //
 
   /* ClearBufferMask */
   const unsigned long DEPTH_BUFFER_BIT               = 0x00000100;
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -155,16 +155,19 @@ NPObjWrapper_GetProperty(JSContext *cx, 
 static JSBool
 NPObjWrapper_newEnumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
                           jsval *statep, jsid *idp);
 
 static JSBool
 NPObjWrapper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                         JSObject **objp);
 
+static JSBool
+NPObjWrapper_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
+
 static void
 NPObjWrapper_Finalize(JSContext *cx, JSObject *obj);
 
 static JSBool
 NPObjWrapper_Call(JSContext *cx, uintN argc, jsval *vp);
 
 static JSBool
 NPObjWrapper_Construct(JSContext *cx, uintN argc, jsval *vp);
@@ -175,17 +178,17 @@ CreateNPObjectMember(NPP npp, JSContext 
 
 static JSClass sNPObjectJSWrapperClass =
   {
     NPRUNTIME_JSCLASS_NAME,
     JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE,
     NPObjWrapper_AddProperty, NPObjWrapper_DelProperty,
     NPObjWrapper_GetProperty, NPObjWrapper_SetProperty,
     (JSEnumerateOp)NPObjWrapper_newEnumerate,
-    (JSResolveOp)NPObjWrapper_NewResolve, JS_ConvertStub,
+    (JSResolveOp)NPObjWrapper_NewResolve, NPObjWrapper_Convert,
     NPObjWrapper_Finalize, nsnull, nsnull, NPObjWrapper_Call,
     NPObjWrapper_Construct, nsnull, nsnull
   };
 
 typedef struct NPObjectMemberPrivate {
     JSObject *npobjWrapper;
     jsval fieldValue;
     NPIdentifier methodName;
@@ -1675,16 +1678,28 @@ NPObjWrapper_NewResolve(JSContext *cx, J
 
     return fnc != nsnull;
   }
 
   // no property or method
   return JS_TRUE;
 }
 
+static JSBool
+NPObjWrapper_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
+{
+  // The sole reason we implement this hook is to prevent the JS
+  // engine from calling valueOf() on NPObject's. Some NPObject's may
+  // actually implement a method named valueOf, but it's unlikely to
+  // behave as the JS engine expects it to. IOW, this is an empty hook
+  // that overrides what the default hook does.
+
+  return JS_TRUE;
+}
+
 static void
 NPObjWrapper_Finalize(JSContext *cx, JSObject *obj)
 {
   NPObject *npobj = (NPObject *)::JS_GetPrivate(cx, obj);
   if (npobj) {
     if (sNPObjWrappers.ops) {
       PL_DHashTableOperate(&sNPObjWrappers, npobj, PL_DHASH_REMOVE);
     }
@@ -2175,19 +2190,16 @@ NPObjectMember_Convert(JSContext *cx, JS
 
   switch (type) {
   case JSTYPE_VOID:
   case JSTYPE_STRING:
   case JSTYPE_NUMBER:
   case JSTYPE_BOOLEAN:
   case JSTYPE_OBJECT:
     *vp = memberPrivate->fieldValue;
-    if (!JSVAL_IS_PRIMITIVE(*vp)) {
-      return JS_ConvertStub(cx, JSVAL_TO_OBJECT(*vp), type, vp);
-    }
     return JS_TRUE;
   case JSTYPE_FUNCTION:
     // Leave this to NPObjectMember_Call.
     return JS_TRUE;
   default:
     NS_ERROR("illegal operation on JSObject prototype object");
     return JS_FALSE;
   }
--- a/dom/plugins/test/mochitest/Makefile.in
+++ b/dom/plugins/test/mochitest/Makefile.in
@@ -41,17 +41,16 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = dom/plugins/test
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _MOCHITEST_FILES = \
   utils.js \
-  test_defaultValue.html \
   test_getauthenticationinfo.html \
   test_npobject_getters.html \
   test_npruntime_npnevaluate.html \
   test_npruntime_npninvoke.html \
   test_npruntime_npninvokedefault.html \
   test_npruntime_identifiers.html \
   npruntime_identifiers_subpage.html \
   loremipsum.txt \
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_defaultValue.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<html>
-  <head>
-    <title>NPObject [[DefaultValue]] implementation</title>
-
-    <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  </head>
-
-  <body onload="run()">
-
-    <embed id="plugin" type="application/x-test" wmode="window"></embed>
-
-    <script class="testbody" type="application/javascript">
-      SimpleTest.waitForExplicitFinish();
-
-      function run() {
-        var plugin = document.getElementById("plugin");
-        var pluginProto = Object.getPrototypeOf(plugin);
-
-        plugin.propertyAndMethod = {};
-        plugin.propertyAndMethod + "baz";
-        ok(true, "|plugin.propertyAndMethod + \"baz\"| shouldn't assert");
-        pluginProto.propertyAndMethod = {};
-        pluginProto.propertyAndMethod + "quux";
-        ok(true, "|pluginProto.propertyAndMethod + \"quux\"| shouldn't assert");
-
-        plugin + "foo";
-        ok(true, "|plugin + \"foo\"| shouldn't assert");
-        pluginProto + "bar";
-        ok(true, "|pluginProto + \"bar\"| shouldn't assert");
-
-        SimpleTest.finish();
-      }
-    </script>
-  </body>
-</html>
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -34,21 +34,21 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "WorkerPrivate.h"
 
+#include "mozIThirdPartyUtil.h"
 #include "nsIClassInfo.h"
 #include "nsIConsoleService.h"
 #include "nsIDOMFile.h"
 #include "nsIDocument.h"
-#include "nsIEffectiveTLDService.h"
 #include "nsIJSContextStack.h"
 #include "nsIMemoryReporter.h"
 #include "nsIScriptError.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsITextToSubURI.h"
 #include "nsITimer.h"
@@ -2331,24 +2331,24 @@ WorkerPrivate::Create(JSContext* aCx, JS
           return nsnull;
         }
 
         if (isFile) {
           // XXX Fix this, need a real domain here.
           domain = file;
         }
         else {
-          nsCOMPtr<nsIEffectiveTLDService> tldService =
-            do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
-          if (!tldService) {
-            JS_ReportError(aCx, "Could not get TLD service!");
+          nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
+            do_GetService(THIRDPARTYUTIL_CONTRACTID);
+          if (!thirdPartyUtil) {
+            JS_ReportError(aCx, "Could not get third party helper service!");
             return nsnull;
           }
 
-          if (NS_FAILED(tldService->GetBaseDomain(codebase, 0, domain))) {
+          if (NS_FAILED(thirdPartyUtil->GetBaseDomain(codebase, domain))) {
             JS_ReportError(aCx, "Could not get domain!");
             return nsnull;
           }
         }
       }
     }
     else {
       // Not a window
--- a/dom/workers/test/test_errorPropagation.html
+++ b/dom/workers/test/test_errorPropagation.html
@@ -39,36 +39,27 @@
         else {
           ok(false, "Bad event type: " + event.type);
         }
 
         is(event.data.message, errorMessage, "Correct message event.message");
         is(event.data.filename, errorFilename,
            "Correct message event.filename");
         is(event.data.lineno, errorLineno, "Correct message event.lineno");
-      }
 
-      function consoleListener(message) {
-        is(message,
-           "[JavaScript Error: \"" + errorMessage + "\" {file: \"" +
-           errorFilename + "\" line: " + errorLineno + "}]",
-           "Correct message in error console");
-
-        is(scopeErrorCount, workerCount, "Good number of scope errors");
-        is(workerErrorCount, workerCount, "Good number of worker errors");
-        is(windowErrorCount, 1, "Good number of window errors");
-
-        workerFrame.stop();
-        SpecialPowers.removeErrorConsoleListener(consoleListener);
-        SimpleTest.finish();
+        if (windowErrorCount == 1) {
+          is(scopeErrorCount, workerCount, "Good number of scope errors");
+          is(workerErrorCount, workerCount, "Good number of worker errors");
+          workerFrame.stop();
+          SimpleTest.finish();
+        }
       }
 
       function workerFrameLoaded() {
         workerFrame = document.getElementById("workerFrame").contentWindow;
-        SpecialPowers.addErrorConsoleListener(consoleListener);
         workerFrame.start(workerCount, messageListener);
       }
 
       SimpleTest.waitForExplicitFinish();
     </script>
   </body>
 </html>
 
--- a/embedding/android/GeckoSurfaceView.java
+++ b/embedding/android/GeckoSurfaceView.java
@@ -218,23 +218,25 @@ class GeckoSurfaceView
                 return;
             c.drawBitmap(bitmap, 0, 0, null);
             holder.unlockCanvasAndPost(c);
         }
     }
 
     public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
 
-        // Force exactly one frame to render
-        // because the surface change is only seen after we
-        // have swapped the back buffer.
-        // The buffer size only changes after the next swap buffer.
-        // We need to make sure the Gecko's view resize when Android's 
-        // buffer resizes.
-        if (mDrawMode == DRAW_GLES_2) {
+        // On pre-Honeycomb, force exactly one frame of the previous size
+        // to render because the surface change is only seen by GLES after we
+        // have swapped the back buffer (i.e. the buffer size only changes 
+        // after the next swap buffer). We need to make sure Gecko's view 
+        // resizes when Android's buffer resizes.
+        // In Honeycomb, the buffer size changes immediately, so rendering a
+        // frame of the previous size is unnecessary (and wrong).
+        if (mDrawMode == DRAW_GLES_2 && 
+            (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)) {
             // When we get a surfaceChange event, we have 0 to n paint events 
             // waiting in the Gecko event queue. We will make the first
             // succeed and the abort the others.
             mDrawSingleFrame = true;
             if (!mInDrawing) { 
                 // Queue at least one paint event in case none are queued.
                 GeckoAppShell.scheduleRedraw();
             }
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -211,17 +211,16 @@ INSTALLED_HEADERS = \
 		jsprf.h \
 		jspropertycache.h \
 		jspropertytree.h \
 		jsproto.tbl \
 		jsprvtd.h \
 		jspubtd.h \
 		jsreflect.h \
 		jsscan.h \
-		jsstaticcheck.h \
 		jsstdint.h \
 		jsstr.h \
 		jstracer.h \
 		jstypedarray.h \
 		jstypes.h \
 		jsutil.h \
 		jsversion.h \
 		jswrapper.h \
--- a/js/src/config/autoconf.mk.in
+++ b/js/src/config/autoconf.mk.in
@@ -321,17 +321,17 @@ MOZ_UTILS_PROGRAM_LDFLAGS = @MOZ_UTILS_P
 MOZ_MAPINFO	= @MOZ_MAPINFO@
 
 QEMU_CANT_RUN_JS_SHELL = @QEMU_CANT_RUN_JS_SHELL@
 
 MACOS_SDK_DIR	= @MACOS_SDK_DIR@
 NEXT_ROOT	= @NEXT_ROOT@
 GCC_VERSION	= @GCC_VERSION@
 UNIVERSAL_BINARY= @UNIVERSAL_BINARY@
-MOZ_CAN_RUN_PROGRAMS = MOZ_CAN_RUN_PROGRAMS@
+MOZ_CAN_RUN_PROGRAMS = @MOZ_CAN_RUN_PROGRAMS@
 HAVE_DTRACE= @HAVE_DTRACE@
 
 VISIBILITY_FLAGS = @VISIBILITY_FLAGS@
 WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@
 
 ENABLE_TRACEJIT = @ENABLE_TRACEJIT@
 ENABLE_METHODJIT = @ENABLE_METHODJIT@
 NANOJIT_ARCH = @NANOJIT_ARCH@
--- a/js/src/jsalloc.h
+++ b/js/src/jsalloc.h
@@ -36,17 +36,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef jsalloc_h_
 #define jsalloc_h_
 
 #include "jspubtd.h"
 #include "jsutil.h"
-#include "jsstaticcheck.h"
 
 namespace js {
 
 /*
  * Allocation policies.  These model the concept:
  *  - public copy constructor, assignment, destructor
  *  - void *malloc_(size_t)
  *      Responsible for OOM reporting on NULL return value.
--- a/js/src/jsapi-tests/Makefile.in
+++ b/js/src/jsapi-tests/Makefile.in
@@ -82,20 +82,24 @@ CPPSRCS = \
   testScriptInfo.cpp \
   testScriptObject.cpp \
   testSetProperty.cpp \
   testStringBuffer.cpp \
   testThreadGC.cpp \
   testThreads.cpp \
   testTrap.cpp \
   testUTF8.cpp \
+  testValueABI.cpp \
   testVersion.cpp \
   testXDR.cpp \
   $(NULL)
 
+CSRCS = \
+  valueABI.c
+
 # Disabled: an entirely unrelated test seems to cause this to fail.  Moreover,
 # given the test's dependence on interactions between the compiler, the GC, and
 # conservative stack scanning, the fix isn't obvious: more investigation
 # needed.
 #CPPSRCS += \
 #  testRegExpInstanceProperties.cpp \
 #  $(NULL)
 
new file mode 100644
--- /dev/null
+++ b/js/src/jsapi-tests/testValueABI.cpp
@@ -0,0 +1,35 @@
+#include "tests.h"
+
+/*
+ * Bug 689101 - jsval is technically a non-POD type because it has a private
+ * data member. On gcc, this doesn't seem to matter. On MSVC, this prevents
+ * returning a jsval from a function between C and C++ because it will use a
+ * retparam in C++ and a direct return value in C.
+ */
+
+extern "C" {
+
+extern JSBool
+C_ValueToObject(JSContext *cx, jsval v, JSObject **obj);
+
+extern jsval
+C_GetEmptyStringValue(JSContext *cx);
+
+}
+
+BEGIN_TEST(testValueABI)
+{
+    JSObject* obj = JS_GetGlobalObject(cx);
+    jsval v = OBJECT_TO_JSVAL(obj);
+    obj = NULL;
+    CHECK(C_ValueToObject(cx, v, &obj));
+    JSBool equal;
+    CHECK(JS_StrictlyEqual(cx, v, OBJECT_TO_JSVAL(obj), &equal));
+    CHECK(equal);
+
+    v = C_GetEmptyStringValue(cx);
+    CHECK(JSVAL_IS_STRING(v));
+
+    return true;
+}
+END_TEST(testValueABI)
new file mode 100644
--- /dev/null
+++ b/js/src/jsapi-tests/valueABI.c
@@ -0,0 +1,12 @@
+#include "jsapi.h"
+
+JSBool C_ValueToObject(JSContext *cx, jsval v, JSObject **obj)
+{
+    return JS_ValueToObject(cx, v, obj);
+}
+
+jsval
+C_GetEmptyStringValue(JSContext *cx)
+{
+    return JS_GetEmptyStringValue(cx);
+}
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -77,17 +77,16 @@
 #include "jsparse.h"
 #include "jsprobes.h"
 #include "jsproxy.h"
 #include "jsscope.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #include "jstracer.h"
 #include "prmjtime.h"
-#include "jsstaticcheck.h"
 #include "jsweakmap.h"
 #include "jswrapper.h"
 #include "jstypedarray.h"
 
 #include "ds/LifoAlloc.h"
 #include "builtin/RegExp.h"
 
 #include "jsatominlines.h"
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -658,27 +658,35 @@ class Value
     const size_t *payloadWord() const {
 #if JS_BITS_PER_WORD == 32
         return &data.s.payload.word;
 #elif JS_BITS_PER_WORD == 64
         return &data.asWord;
 #endif
     }
 
+#ifndef _MSC_VER
+  /* To make jsval binary compatible when linking across C and C++ with MSVC,
+   * JS::Value needs to be POD. Otherwise, jsval will be passed in memory
+   * in C++ but by value in C (bug 645111).
+   */
+  private:
+#endif
+
+    jsval_layout data;
+
   private:
     void staticAssertions() {
         JS_STATIC_ASSERT(sizeof(JSValueType) == 1);
         JS_STATIC_ASSERT(sizeof(JSValueTag) == 4);
         JS_STATIC_ASSERT(sizeof(JSBool) == 4);
         JS_STATIC_ASSERT(sizeof(JSWhyMagic) <= 4);
         JS_STATIC_ASSERT(sizeof(Value) == 8);
     }
 
-    jsval_layout data;
-
     friend jsval_layout (::JSVAL_TO_IMPL)(Value);
     friend Value (::IMPL_TO_JSVAL)(jsval_layout l);
 } JSVAL_ALIGNMENT;
 
 /************************************************************************/
 
 static JS_ALWAYS_INLINE Value
 NullValue()
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -118,17 +118,16 @@
 #include "jsgcmark.h"
 #include "jsinterp.h"
 #include "jsiter.h"
 #include "jslock.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsscope.h"
 #include "jsstr.h"
-#include "jsstaticcheck.h"
 #include "jstracer.h"
 #include "jswrapper.h"
 #include "methodjit/MethodJIT.h"
 #include "methodjit/StubCalls.h"
 #include "methodjit/StubCalls-inl.h"
 
 #include "vm/ArgumentsObject.h"
 
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -75,17 +75,16 @@
 #include "jsnativestack.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jspubtd.h"
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 #include "jsstr.h"
 #include "jstracer.h"
 
 #ifdef JS_METHODJIT
 # include "assembler/assembler/MacroAssembler.h"
 #endif
 #include "frontend/ParseMaps.h"
 
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -49,17 +49,16 @@
 #include "jsprvtd.h"
 #include "jsatom.h"
 #include "jsclist.h"
 #include "jsdhash.h"
 #include "jsgc.h"
 #include "jsgcchunk.h"
 #include "jspropertycache.h"
 #include "jspropertytree.h"
-#include "jsstaticcheck.h"
 #include "jsutil.h"
 #include "prmjtime.h"
 
 #include "ds/LifoAlloc.h"
 #include "gc/Statistics.h"
 #include "js/HashTable.h"
 #include "js/Vector.h"
 #include "vm/StackSpace.h"
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -40,17 +40,16 @@
 
 #ifndef jscntxtinlines_h___
 #define jscntxtinlines_h___
 
 #include "jscntxt.h"
 #include "jscompartment.h"
 #include "jsfriendapi.h"
 #include "jsinterp.h"
-#include "jsstaticcheck.h"
 #include "jsxml.h"
 #include "jsgc.h"
 
 #include "frontend/ParseMaps.h"
 #include "vm/RegExpObject.h"
 
 namespace js {
 
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -59,17 +59,16 @@
 #include "jsgcmark.h"
 #include "jsinterp.h"
 #include "jslock.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsparse.h"
 #include "jsscope.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 #include "jsstr.h"
 #include "jswatchpoint.h"
 #include "jswrapper.h"
 
 #include "vm/Debugger.h"
 
 #include "jsatominlines.h"
 #include "jsinferinlines.h"
--- a/js/src/jsemit.cpp
+++ b/js/src/jsemit.cpp
@@ -59,17 +59,16 @@
 #include "jsfun.h"
 #include "jsnum.h"
 #include "jsopcode.h"
 #include "jsparse.h"
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsscript.h"
 #include "jsautooplen.h"        // generated headers last
-#include "jsstaticcheck.h"
 
 #include "jsatominlines.h"
 #include "jsobjinlines.h"
 #include "jsscopeinlines.h"
 #include "jsscriptinlines.h"
 
 #include "frontend/ParseMaps-inl.h"
 #include "ds/LifoAlloc.h"
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -55,17 +55,16 @@
 #include "jsgc.h"
 #include "jsgcmark.h"
 #include "jsinterp.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsscope.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 #include "jswrapper.h"
 
 #include "vm/GlobalObject.h"
 
 #include "jsinferinlines.h"
 #include "jsobjinlines.h"
 
 #include "vm/Stack-inl.h"
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -74,16 +74,19 @@ extern JS_FRIEND_API(size_t)
 JS_GetE4XObjectsCreated(JSContext *cx);
 
 extern JS_FRIEND_API(size_t)
 JS_SetProtoCalled(JSContext *cx);
 
 extern JS_FRIEND_API(size_t)
 JS_GetCustomIteratorCount(JSContext *cx);
 
+extern JS_FRIEND_API(JSBool)
+JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *obj, JSObject **ret);
+
 enum {
     JS_TELEMETRY_GC_REASON,
     JS_TELEMETRY_GC_IS_COMPARTMENTAL,
     JS_TELEMETRY_GC_IS_SHAPE_REGEN,
     JS_TELEMETRY_GC_MS,
     JS_TELEMETRY_GC_MARK_MS,
     JS_TELEMETRY_GC_SWEEP_MS
 };
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -64,17 +64,16 @@
 #include "jsparse.h"
 #include "jspropertytree.h"
 #include "jsproxy.h"
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #include "jsexn.h"
-#include "jsstaticcheck.h"
 #include "jstracer.h"
 #include "vm/CallObject.h"
 #include "vm/Debugger.h"
 
 #if JS_HAS_GENERATORS
 # include "jsiter.h"
 #endif
 
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -74,17 +74,16 @@
 #include "jslock.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsparse.h"
 #include "jsprobes.h"
 #include "jsproxy.h"
 #include "jsscope.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 #include "jswatchpoint.h"
 #include "jsweakmap.h"
 #if JS_HAS_XML_SUPPORT
 #include "jsxml.h"
 #endif
 
 #include "methodjit/MethodJIT.h"
 #include "vm/Debugger.h"
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -65,17 +65,16 @@
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jspropertycache.h"
 #include "jsemit.h"
 #include "jsscope.h"
 #include "jsscript.h"
 #include "jsstr.h"
-#include "jsstaticcheck.h"
 #include "jstracer.h"
 #include "jslibmath.h"
 
 #ifdef JS_METHODJIT
 #include "methodjit/MethodJIT.h"
 #include "methodjit/MethodJIT-inl.h"
 #include "methodjit/Logging.h"
 #endif
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -61,17 +61,16 @@
 #include "jslock.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsproxy.h"
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 
 #if JS_HAS_XML_SUPPORT
 #include "jsxml.h"
 #endif
 
 #include "vm/GlobalObject.h"
 
 #include "jsinferinlines.h"
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -67,17 +67,16 @@
 #include "jsobj.h"
 #include "jsonparser.h"
 #include "jsopcode.h"
 #include "jsparse.h"
 #include "jsprobes.h"
 #include "jsproxy.h"
 #include "jsscope.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 #include "jsstdint.h"
 #include "jsstr.h"
 #include "jstracer.h"
 #include "jsdbgapi.h"
 #include "json.h"
 #include "jswatchpoint.h"
 #include "jswrapper.h"
 
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -47,17 +47,16 @@
 #include "jsfun.h"
 #include "jsiter.h"
 #include "jslock.h"
 #include "jsobj.h"
 #include "jsprobes.h"
 #include "jspropertytree.h"
 #include "jsproxy.h"
 #include "jsscope.h"
-#include "jsstaticcheck.h"
 #include "jstypedarray.h"
 #include "jsxml.h"
 #include "jswrapper.h"
 
 /* Headers included for inline implementations used by this header. */
 #include "jsbool.h"
 #include "jscntxt.h"
 #include "jsnum.h"
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -62,17 +62,16 @@
 #include "jsiter.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsscript.h"
 #include "jsstr.h"
-#include "jsstaticcheck.h"
 
 #include "vm/Debugger.h"
 
 #include "jscntxtinlines.h"
 #include "jsobjinlines.h"
 #include "jsopcodeinlines.h"
 #include "jsscriptinlines.h"
 
--- a/js/src/jsparse.cpp
+++ b/js/src/jsparse.cpp
@@ -73,17 +73,16 @@
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsparse.h"
 #include "jsprobes.h"
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsscript.h"
 #include "jsstr.h"
-#include "jsstaticcheck.h"
 #include "jslibmath.h"
 
 #if JS_HAS_XML_SUPPORT
 #include "jsxml.h"
 #endif
 
 #if JS_HAS_DESTRUCTURING
 #include "jsdhash.h"
--- a/js/src/jsprobes.cpp
+++ b/js/src/jsprobes.cpp
@@ -45,17 +45,16 @@
 #include "jsutil.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jsdbgapi.h"
 #include "jsfun.h"
 #include "jsinterp.h"
 #include "jsobj.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 #include "jsstr.h"
 
 #include "jsprobes.h"
 #include <sys/types.h>
 
 #define TYPEOF(cx,v)    (JSVAL_IS_NULL(v) ? JSTYPE_NULL : JS_TypeOfValue(cx,v))
 
 using namespace js;
--- a/js/src/jsprvtd.h
+++ b/js/src/jsprvtd.h
@@ -50,17 +50,16 @@
  * declaring a pointer to struct type, or defining a member of struct type.
  *
  * A few fundamental scalar types are defined here too.  Neither the scalar
  * nor the struct typedefs should change much, therefore the nearly-global
  * make dependency induced by this file should not prove painful.
  */
 
 #include "jsapi.h"
-#include "jsstaticcheck.h"
 #include "jsutil.h"
 
 JS_BEGIN_EXTERN_C
 
 /*
  * Convenience constants.
  */
 #define JS_BITS_PER_UINT32_LOG2 5
--- a/js/src/jsscan.cpp
+++ b/js/src/jsscan.cpp
@@ -62,17 +62,16 @@
 #include "jsversion.h"
 #include "jsemit.h"
 #include "jsexn.h"
 #include "jsnum.h"
 #include "jsopcode.h"
 #include "jsparse.h"
 #include "jsscan.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 
 #include "vm/RegExpObject.h"
 
 #include "jsscriptinlines.h"
 
 #if JS_HAS_XML_SUPPORT
 #include "jsxml.h"
 #endif
deleted file mode 100644
--- a/js/src/jsstaticcheck.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef jsstaticcheck_h___
-#define jsstaticcheck_h___
-
-#endif /* jsstaticcheck_h___ */
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -64,17 +64,16 @@
 #include "jsgc.h"
 #include "jsinterp.h"
 #include "jslock.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsprobes.h"
 #include "jsscope.h"
-#include "jsstaticcheck.h"
 #include "jsstr.h"
 #include "jsversion.h"
 
 #include "vm/GlobalObject.h"
 #include "vm/RegExpObject.h"
 
 #include "jsinferinlines.h"
 #include "jsobjinlines.h"
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -68,17 +68,16 @@
 #include "jsgcmark.h"
 #include "jsinterp.h"
 #include "jsiter.h"
 #include "jsmath.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsscope.h"
 #include "jsscript.h"
-#include "jsstaticcheck.h"
 #include "jstracer.h"
 #include "jsxml.h"
 #include "jstypedarray.h"
 
 #include "builtin/RegExp.h"
 
 #include "jsatominlines.h"
 #include "jscntxtinlines.h"
--- a/js/src/jstypedarray.cpp
+++ b/js/src/jstypedarray.cpp
@@ -52,17 +52,16 @@
 #include "jscntxt.h"
 #include "jsversion.h"
 #include "jsgc.h"
 #include "jsgcmark.h"
 #include "jsinterp.h"
 #include "jslock.h"
 #include "jsnum.h"
 #include "jsobj.h"
-#include "jsstaticcheck.h"
 #include "jstypedarray.h"
 #include "jsutil.h"
 
 #include "vm/GlobalObject.h"
 
 #include "jsatominlines.h"
 #include "jsinferinlines.h"
 #include "jsobjinlines.h"
--- a/js/src/jsutil.h
+++ b/js/src/jsutil.h
@@ -39,18 +39,16 @@
 
 /*
  * PR assertion checker.
  */
 
 #ifndef jsutil_h___
 #define jsutil_h___
 
-#include "jsstaticcheck.h"
-
 #include "js/Utility.h"
 
 /* Forward declarations. */
 struct JSContext;
 
 #ifdef __cplusplus
 namespace js {
 
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -37,16 +37,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <string.h>
 #include "jsapi.h"
 #include "jscntxt.h"
+#include "jsfriendapi.h"
 #include "jsgc.h"
 #include "jsobj.h"
 #include "jsgc.h"
 #include "jsgcmark.h"
 #include "jsweakmap.h"
 
 #include "vm/GlobalObject.h"
 
@@ -227,16 +228,37 @@ WeakMap_set(JSContext *cx, uintN argc, V
         goto out_of_memory;
     return true;
 
   out_of_memory:
     JS_ReportOutOfMemory(cx);
     return false;
 }
 
+JS_FRIEND_API(JSBool)
+JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *obj, JSObject **ret)
+{
+    if (!obj || !obj->isWeakMap()) {
+        *ret = NULL;
+        return true;
+    }
+    JSObject *arr = NewDenseEmptyArray(cx);
+    if (!arr)
+        return false;
+    ObjectValueMap *map = GetObjectMap(obj);
+    if (map) {
+        for (ObjectValueMap::Range r = map->nondeterministicAll(); !r.empty(); r.popFront()) {
+            if (!js_NewbornArrayPush(cx, arr, ObjectValue(*r.front().key)))
+                return false;
+        }
+    }
+    *ret = arr;
+    return true;
+}
+
 static void
 WeakMap_mark(JSTracer *trc, JSObject *obj)
 {
     if (ObjectValueMap *map = GetObjectMap(obj))
         map->trace(trc);
 }
 
 static void
--- a/js/src/jsweakmap.h
+++ b/js/src/jsweakmap.h
@@ -187,23 +187,29 @@ class WeakMapBase {
 };
 
 template <class Key, class Value,
           class HashPolicy = DefaultHasher<Key>,
           class MarkPolicy = DefaultMarkPolicy<Key, Value> >
 class WeakMap : public HashMap<Key, Value, HashPolicy, RuntimeAllocPolicy>, public WeakMapBase {
   private:
     typedef HashMap<Key, Value, HashPolicy, RuntimeAllocPolicy> Base;
-    typedef typename Base::Range Range;
     typedef typename Base::Enum Enum;
 
   public:
+    typedef typename Base::Range Range;
+
     explicit WeakMap(JSRuntime *rt) : Base(rt) { }
     explicit WeakMap(JSContext *cx) : Base(cx) { }
 
+    // Use with caution, as result can be affected by garbage collection.
+    Range nondeterministicAll() {
+        return Base::all();
+    }
+
   private:
     void nonMarkingTrace(JSTracer *tracer) {
         MarkPolicy t(tracer);
         for (Range r = Base::all(); !r.empty(); r.popFront())
             t.markEntry(r.front().value);
     }
 
     bool markIteratively(JSTracer *tracer) {
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -61,17 +61,16 @@
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsparse.h"
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #include "jsxml.h"
-#include "jsstaticcheck.h"
 
 #include "vm/GlobalObject.h"
 
 #include "jsatominlines.h"
 #include "jsinferinlines.h"
 #include "jsobjinlines.h"
 #include "jsstrinlines.h"
 
--- a/js/src/methodjit/InvokeHelpers.cpp
+++ b/js/src/methodjit/InvokeHelpers.cpp
@@ -40,17 +40,16 @@
 
 #include "jscntxt.h"
 #include "jsscope.h"
 #include "jsobj.h"
 #include "jslibmath.h"
 #include "jsiter.h"
 #include "jsnum.h"
 #include "jsxml.h"
-#include "jsstaticcheck.h"
 #include "jsbool.h"
 #include "assembler/assembler/MacroAssemblerCodeRef.h"
 #include "assembler/assembler/CodeLocation.h"
 #include "jsiter.h"
 #include "jstypes.h"
 #include "methodjit/StubCalls.h"
 #include "jstracer.h"
 #include "jspropertycache.h"
--- a/js/src/methodjit/StubCalls.cpp
+++ b/js/src/methodjit/StubCalls.cpp
@@ -40,17 +40,16 @@
 
 #include "jscntxt.h"
 #include "jsscope.h"
 #include "jsobj.h"
 #include "jslibmath.h"
 #include "jsiter.h"
 #include "jsnum.h"
 #include "jsxml.h"
-#include "jsstaticcheck.h"
 #include "jsbool.h"
 #include "assembler/assembler/MacroAssemblerCodeRef.h"
 #include "jsiter.h"
 #include "jstypes.h"
 #include "vm/Debugger.h"
 #include "vm/String.h"
 #include "methodjit/Compiler.h"
 #include "methodjit/StubCalls.h"
--- a/js/src/xpconnect/idl/xpccomponents.idl
+++ b/js/src/xpconnect/idl/xpccomponents.idl
@@ -148,17 +148,17 @@ interface nsIXPCComponents_utils_Sandbox
 interface ScheduledGCCallback : nsISupports
 {
     void callback();
 };
 
 /**
 * interface of Components.utils
 */
-[scriptable, uuid(fed2d752-6cb3-4135-97b0-2c290e541e2d)]
+[scriptable, uuid(11785c1f-346f-475c-950e-fe1bacce70f1)]
 interface nsIXPCComponents_Utils : nsISupports
 {
 
     /* reportError is designed to be called from JavaScript only.
      *
      * It will report a JS Error object to the JS console, and return. It
      * is meant for use in exception handler blocks which want to "eat"
      * an exception, but still want to report it to the console.
@@ -260,16 +260,31 @@ interface nsIXPCComponents_Utils : nsISu
 
     /*
      * Schedule a garbage collection cycle for a point in the future when no JS
      * is running. Call the provided function once this has occurred.
      */
     [implicit_jscontext]
     void schedulePreciseGC(in ScheduledGCCallback callback);
 
+    /**
+     * Return the keys in a weak map.  This operation is
+     * non-deterministic because it is affected by the scheduling of the
+     * garbage collector and the cycle collector.
+     *
+     * This should only be used to write tests of the interaction of
+     * the GC and CC with weak maps.
+     *
+     * @param aMap weak map or other JavaScript value
+     * @returns If aMap is a weak map object, return the keys of the weak
+                map as an array.  Otherwise, return undefined.
+     */
+    [implicit_jscontext]
+    jsval nondeterministicGetWeakMapKeys(in jsval aMap);
+
     /*
      * To be called from JS only.
      *
      * Returns the global object with which the given object is associated.
      *
      * @param obj The JavaScript object whose global is to be gotten.
      * @return the corresponding global.
      */
--- a/js/src/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/src/xpconnect/src/dom_quickstubs.qsconf
@@ -427,28 +427,17 @@ members = [
     # can't be quickstubbed
     '-nsIXMLHttpRequest.upload',
 
     # WebSocket
     'nsIMozWebSocket.*',
 
     # webgl
     'nsIDOMWebGLRenderingContext.*',
-    # These all use GetCurrentNativeCallContext and should be
-    # custom-quickstubbed.
-    '-nsIDOMWebGLRenderingContext.getActiveAttrib',
-    '-nsIDOMWebGLRenderingContext.getActiveUniform',
-    '-nsIDOMWebGLRenderingContext.getParameter',
-    '-nsIDOMWebGLRenderingContext.getBufferParameter',
-    '-nsIDOMWebGLRenderingContext.getFramebufferAttachmentParameter',
-    '-nsIDOMWebGLRenderingContext.getRenderbufferParameter',
-    '-nsIDOMWebGLRenderingContext.getProgramParameter',
-    '-nsIDOMWebGLRenderingContext.getUniform',
-    '-nsIDOMWebGLRenderingContext.getVertexAttrib',
-    '-nsIDOMWebGLRenderingContext.getShaderParameter',
+    # getContextAttributes is directly manipulating its return value
     '-nsIDOMWebGLRenderingContext.getContextAttributes',
 
     # Audio
     'nsIDOMNotifyAudioAvailableEvent.frameBuffer',
     'nsIDOMNotifyAudioAvailableEvent.time',
     'nsIDOMHTMLAudioElement.mozWriteAudio',
 
     # dom/indexedDB
--- a/js/src/xpconnect/src/dombindings.cpp
+++ b/js/src/xpconnect/src/dombindings.cpp
@@ -913,16 +913,19 @@ ListBase<LC>::nativeGet(JSContext *cx, J
 }
 
 template<class LC>
 bool
 ListBase<LC>::getPropertyOnPrototype(JSContext *cx, JSObject *proxy, jsid id, bool *found,
                                      js::Value *vp)
 {
     JSObject *proto = js::GetObjectProto(proxy);
+    if (!proto)
+        return true;
+
     bool hit;
     if (getProtoShape(proxy) != js::GetObjectShape(proto)) {
         if (!shouldCacheProtoShape(cx, proto, &hit))
             return false;
         if (hit)
             setProtoShape(proxy, js::GetObjectShape(proto));
     }
     else {
--- a/js/src/xpconnect/src/dombindingsgen.py
+++ b/js/src/xpconnect/src/dombindingsgen.py
@@ -693,17 +693,17 @@ def writeStubFile(filename, config, inte
                 f.write(string.Template(indexGetterTemplate).substitute(clazz))
             if clazz.indexSetter:
                 f.write(string.Template(indexSetterTemplate).substitute(clazz))
             if clazz.nameGetter:
                 #methodsList.append("    { s_%s_id, &namedItem, 1 }" % clazz.nameGetter.name)
                 f.write(string.Template(nameGetterTemplate).substitute(clazz))
             if clazz.nameSetter:
                 f.write(string.Template(nameSetterTemplate).substitute(clazz))
-            for member in clazz.members:
+            for member in sorted(clazz.members, key=lambda member: member.name):
                 if member.name == 'length':
                     if not member.readonly:
                         setterName = (clazz.name + '_' + header.attributeNativeName(member, False))
                         writeBindingStub(f, clazz.name, member, setterName, isSetter=True)
                     else:
                         setterName = "NULL"
 
                     propertiesList.append("    { s_length_id, length_getter, %s }" % setterName)
--- a/js/src/xpconnect/src/xpccomponents.cpp
+++ b/js/src/xpconnect/src/xpccomponents.cpp
@@ -3857,16 +3857,33 @@ class PreciseGCRunnable : public nsRunna
 /* [inline_jscontext] void schedulePreciseGC(in ScheduledGCCallback callback); */
 NS_IMETHODIMP
 nsXPCComponents_Utils::SchedulePreciseGC(ScheduledGCCallback* aCallback, JSContext* aCx)
 {
     nsRefPtr<PreciseGCRunnable> event = new PreciseGCRunnable(aCx, aCallback);
     return NS_DispatchToMainThread(event);
 }
 
+/* [implicit_jscontext] jsval nondeterministicGetWeakMapKeys(in jsval aMap); */
+NS_IMETHODIMP
+nsXPCComponents_Utils::NondeterministicGetWeakMapKeys(const jsval &aMap,
+                                                      JSContext *aCx,
+                                                      jsval *aKeys)
+{
+    if(!JSVAL_IS_OBJECT(aMap)) {
+        *aKeys = JSVAL_VOID;
+        return NS_OK; 
+    }
+    JSObject *objRet;
+    if(!JS_NondeterministicGetWeakMapKeys(aCx, JSVAL_TO_OBJECT(aMap), &objRet))
+        return NS_ERROR_OUT_OF_MEMORY;
+    *aKeys = objRet ? OBJECT_TO_JSVAL(objRet) : JSVAL_VOID;
+    return NS_OK;
+}
+
 /* void getGlobalForObject(); */
 NS_IMETHODIMP
 nsXPCComponents_Utils::GetGlobalForObject()
 {
   nsresult rv;
   nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID(), &rv));
   if(NS_FAILED(rv))
     return NS_ERROR_FAILURE;
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -255,19 +255,16 @@ ContextCallback(JSContext *cx, uintN ope
             delete XPCContext::GetXPCContext(cx);
         }
     }
     return JS_TRUE;
 }
 
 xpc::CompartmentPrivate::~CompartmentPrivate()
 {
-    delete waiverWrapperMap;
-    delete expandoMap;
-    delete domExpandoMap;
     MOZ_COUNT_DTOR(xpc::CompartmentPrivate);
 }
 
 static JSBool
 CompartmentCallback(JSContext *cx, JSCompartment *compartment, uintN op)
 {
     JS_ASSERT(op == JSCOMPARTMENT_DESTROY);
 
--- a/js/src/xpconnect/src/xpcprivate.h
+++ b/js/src/xpconnect/src/xpcprivate.h
@@ -4434,54 +4434,50 @@ XPC_GetIdentityObject(JSContext *cx, JSO
 namespace xpc {
 
 struct CompartmentPrivate
 {
     CompartmentPrivate(PtrAndPrincipalHashKey *key, bool wantXrays, bool cycleCollectionEnabled)
         : key(key),
           ptr(nsnull),
           wantXrays(wantXrays),
-          cycleCollectionEnabled(cycleCollectionEnabled),
-          waiverWrapperMap(nsnull),
-          expandoMap(nsnull),
-          domExpandoMap(nsnull)
+          cycleCollectionEnabled(cycleCollectionEnabled)
     {
         MOZ_COUNT_CTOR(xpc::CompartmentPrivate);
     }
 
     CompartmentPrivate(nsISupports *ptr, bool wantXrays, bool cycleCollectionEnabled)
         : key(nsnull),
           ptr(ptr),
           wantXrays(wantXrays),
-          cycleCollectionEnabled(cycleCollectionEnabled),
-          waiverWrapperMap(nsnull),
-          expandoMap(nsnull),
-          domExpandoMap(nsnull)
+          cycleCollectionEnabled(cycleCollectionEnabled)
     {
         MOZ_COUNT_CTOR(xpc::CompartmentPrivate);
     }
 
     ~CompartmentPrivate();
 
     // NB: key and ptr are mutually exclusive.
     nsAutoPtr<PtrAndPrincipalHashKey> key;
     nsCOMPtr<nsISupports> ptr;
     bool wantXrays;
     bool cycleCollectionEnabled;
-    JSObject2JSObjectMap *waiverWrapperMap;
+    nsAutoPtr<JSObject2JSObjectMap> waiverWrapperMap;
     // NB: we don't want this map to hold a strong reference to the wrapper.
-    nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *> *expandoMap;
-    nsTHashtable<nsPtrHashKey<JSObject> > *domExpandoMap;
+    nsAutoPtr<nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *> > expandoMap;
+    nsAutoPtr<nsTHashtable<nsPtrHashKey<JSObject> > > domExpandoMap;
     nsCString location;
 
     bool RegisterExpandoObject(XPCWrappedNative *wn, JSObject *expando) {
         if (!expandoMap) {
             expandoMap = new nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *>();
-            if (!expandoMap->Init(8))
+            if (!expandoMap->Init(8)) {
+                expandoMap = nsnull;
                 return false;
+            }
         }
         return expandoMap->Put(wn, expando);
     }
 
     /**
      * This lookup does not change the color of the JSObject meaning that the
      * object returned is not guaranteed to be kept alive past the next CC.
      *
@@ -4501,18 +4497,17 @@ struct CompartmentPrivate
         JSObject *obj = LookupExpandoObjectPreserveColor(wn);
         xpc_UnmarkGrayObject(obj);
         return obj;
     }
 
     bool RegisterDOMExpandoObject(JSObject *expando) {
         if (!domExpandoMap) {
             domExpandoMap = new nsTHashtable<nsPtrHashKey<JSObject> >();
-            if(!domExpandoMap->Init(8))
-            {
+            if(!domExpandoMap->Init(8)) {
                 domExpandoMap = nsnull;
                 return false;
             }
         }
         return domExpandoMap->PutEntry(expando);
     }
     void RemoveDOMExpandoObject(JSObject *expando) {
         if(domExpandoMap)
--- a/js/src/xpconnect/tests/chrome/Makefile.in
+++ b/js/src/xpconnect/tests/chrome/Makefile.in
@@ -67,16 +67,17 @@ include $(topsrcdir)/config/rules.mk
 		test_bug596580.xul \
 		test_bug654370.xul \
 		test_bug658560.xul \
 		test_bug679861.xul \
 		test_APIExposer.xul \
 		test_bug664689.xul \
 		test_precisegc.xul \
 		test_nodelists.xul \
+		test_getweakmapkeys.xul \
 		$(NULL)
 
 # Disabled until this test gets updated to test the new proxy based
 # wrappers.
 #		test_wrappers-2.xul \
 
 libs:: $(_CHROME_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/js/src/xpconnect/tests/chrome/test_getweakmapkeys.xul
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=688277
+-->
+<window title="Mozilla Bug "
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+  <!-- test results are displayed in the html:body -->
+  <body xmlns="http://www.w3.org/1999/xhtml">
+  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id="
+     target="_blank">Mozilla Bug 688277</a>
+  </body>
+
+  <!-- test code goes here -->
+  <script type="application/javascript">
+  <![CDATA[
+  /** Test for Bug 688277 **/
+
+  let Cu = Components.utils;
+
+  /* Fail gracefully if junk is passed in. */
+  is(Cu.nondeterministicGetWeakMapKeys(11), undefined,
+    "nondeterministicGetWeakMapKeys should return undefined for non-objects");
+  is(Cu.nondeterministicGetWeakMapKeys({}), undefined,
+    "nondeterministicGetWeakMapKeys should return undefined for non-weakmap objects");
+  is(Cu.nondeterministicGetWeakMapKeys(null), undefined,
+    "nondeterministicGetWeakMapKeys should return undefined for null");
+
+  /* return an empty array for an empty WeakMap */
+  let mempty = WeakMap();
+  is(Cu.nondeterministicGetWeakMapKeys(mempty).length, 0,
+    "nondeterministicGetWeakMapKeys should return empty array for empty weakmap");
+
+  /* Test freeing/nonfreeing. */
+  let m = WeakMap();
+  let liveKeys = new Array();
+
+  let add_elements = function () {
+    let k1 = {};
+    m.set(k1, "live1");
+    liveKeys.push(k1);
+
+    let k2 = {};
+    m.set(k2, "dead1");
+
+    let k = {};
+    m.set(k, k); /* simple cycle */
+  };
+
+  add_elements();
+
+  Cu.schedulePreciseGC(function () {
+    let keys = Cu.nondeterministicGetWeakMapKeys(m);
+    is(liveKeys.length, 1, "Wrong number of live keys.");
+    is(keys.length, 1, "Should have one weak map key.");
+    is(m.get(keys[0]), "live1", "live1 should be live");
+    SimpleTest.finish();
+  });
+
+  SimpleTest.waitForExplicitFinish();
+
+  ]]>
+  </script>
+</window>
--- a/layout/generic/FrameChildList.cpp
+++ b/layout/generic/FrameChildList.cpp
@@ -42,16 +42,26 @@
 
 namespace mozilla {
 namespace layout {
 
 FrameChildListIterator::FrameChildListIterator(const nsIFrame* aFrame)
   : FrameChildListArrayIterator(mLists)
 {
   aFrame->GetChildLists(&mLists);
+#ifdef DEBUG
+  // Make sure that there are no duplicate list IDs.
+  FrameChildListIDs ids;
+  PRUint32 count = mLists.Length();
+  for (PRUint32 i = 0; i < count; ++i) {
+    NS_ASSERTION(!ids.Contains(mLists[i].mID),
+                 "Duplicate item found!");
+    ids |= mLists[i].mID;
+  }
+#endif
 }
 
 #ifdef DEBUG
 const char*
 ChildListName(FrameChildListID aListID)
 {
   switch (aListID) {
     case kPrincipalList: return "";
--- a/layout/generic/FrameChildList.h
+++ b/layout/generic/FrameChildList.h
@@ -51,16 +51,17 @@ namespace layout {
 
 #ifdef DEBUG
 extern const char* ChildListName(FrameChildListID aListID);
 #endif
 
 class FrameChildListIDs {
 friend class FrameChildListIterator;
  public:
+  FrameChildListIDs() : mIDs(0) {}
   FrameChildListIDs(const FrameChildListIDs& aOther) : mIDs(aOther.mIDs) {}
   FrameChildListIDs(FrameChildListID aListID) : mIDs(aListID) {}
 
   FrameChildListIDs operator|(FrameChildListIDs aOther) const {
     return FrameChildListIDs(mIDs | aOther.mIDs);
   }
   FrameChildListIDs& operator|=(FrameChildListIDs aOther) {
     mIDs |= aOther.mIDs;
--- a/media/libsydneyaudio/include/sydney_audio.h
+++ b/media/libsydneyaudio/include/sydney_audio.h
@@ -43,17 +43,17 @@ async-signal safe.
   
 - It is assumed that duplex streams have a single clock (synchronised)
 */
 
 #include <sys/types.h>
 #if !defined (WIN32)
 #include <sys/param.h>
 #include <inttypes.h>
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(ANDROID)
 #include <sys/endian.h>
 #endif
 #else
 #include <stddef.h>
 #endif
 
 /* Detect byte order, based on sys/param.h */
 #undef SA_LITTLE_ENDIAN
--- a/media/libvpx/Makefile.in
+++ b/media/libvpx/Makefile.in
@@ -125,32 +125,32 @@ EXPORTS_vpx = \
   $(NULL)
 
 CSRCS += \
   vpx_config_c.c \
   systemdependent.c \
   alloccommon.c \
   blockd.c \
   debugmodes.c \
+  defaultcoefcounts.c \
   dsystemdependent.c \
   entropy.c \
   entropymode.c \
   entropymv.c \
   extend.c \
-  filter_c.c \
+  filter.c \
   findnearmv.c \
   idctllm.c \
   invtrans.c \
   loopfilter.c \
   loopfilter_filters.c \
   mbpitch.c \
   modecont.c \
   modecontext.c \
   postproc.c \
-  predictdc.c \
   quant_common.c \
   recon.c \
   reconinter.c \
   reconintra.c \
   reconintra4x4.c \
   setupintrarecon.c \
   swapyv12buffer.c \
   textblit.c \
@@ -168,29 +168,80 @@ CSRCS += \
   vpx_codec.c \
   vpx_decoder.c \
   vpx_decoder_compat.c \
   vpx_encoder.c \
   vpx_image.c \
   vpx_mem.c \
   gen_scalers.c \
   vpxscale.c \
-  scalesystemdependant.c \
+  scalesystemdependent.c \
   yv12config.c \
   yv12extend.c \
   $(NULL)
 
+ifdef MOZ_VP8_ERROR_CONCEALMENT
+CSRCS += \
+  error_concealment.c \
+  $(NULL)
+endif
+
+ifdef MOZ_VP8_ENCODER
+VPATH += \
+  $(srcdir)/vp8/encoder \
+  $(srcdir)/vp8/encoder/arm \
+  $(srcdir)/vp8/encoder/arm/armv5te \
+  $(srcdir)/vp8/encoder/arm/armv6 \
+  $(srcdir)/vp8/encoder/arm/neon \
+  $(srcdir)/vp8/encoder/generic \
+  $(srcdir)/vp8/encoder/x86 \
+  $(srcdir)/vpx_scale/arm \
+  $(srcdir)/vpx_scale/arm/neon \
+  $(NULL)
+
+CSRCS += \
+  vp8_cx_iface.c \
+  bitstream.c \
+  boolhuff.c \
+  dct.c \
+  encodeframe.c \
+  encodeintra.c \
+  encodemb.c \
+  encodemv.c \
+  ethreading.c \
+  firstpass.c \
+  lookahead.c \
+  mcomp.c \
+  modecosts.c \
+  onyx_if.c \
+  picklpf.c \
+  pickinter.c \
+  psnr.c \
+  quantize.c \
+  ratectrl.c \
+  rdopt.c \
+  sad_c.c \
+  segmentation.c \
+  temporal_filter.c \
+  tokenize.c \
+  treewriter.c \
+  variance_c.c \
+  csystemdependent.c \
+  $(NULL)
+endif
+
 ifdef VPX_X86_ASM
 # Building on an x86 platform with a supported assembler, include
 # the optimized assembly in the build.
 
 CSRCS += \
   idct_blk_mmx.c \
   idct_blk_sse2.c \
   loopfilter_x86.c \
+  recon_wrapper_sse2.c \
   vp8_asm_stubs.c \
   x86_systemdependent.c \
   x86_dsystemdependent.c \
   $(NULL)
 
 ASFILES += \
   idctllm_mmx.asm \
   idctllm_sse2.asm \
@@ -204,16 +255,56 @@ ASFILES += \
   recon_sse2.asm \
   subpixel_mmx.asm \
   subpixel_sse2.asm \
   subpixel_ssse3.asm \
   dequantize_mmx.asm \
   emms.asm \
   $(NULL)
 
+ifdef MOZ_VP8_ENCODER
+
+CSRCS += \
+  variance_mmx.c \
+  variance_sse2.c \
+  variance_ssse3.c \
+  x86_csystemdependent.c \
+  $(NULL)
+
+ASFILES += \
+  dct_mmx.asm \
+  dct_sse2.asm \
+  encodeopt.asm \
+  fwalsh_sse2.asm \
+  quantize_mmx.asm \
+  quantize_sse2.asm \
+  quantize_ssse3.asm \
+  quantize_sse4.asm \
+  sad_mmx.asm \
+  sad_sse2.asm \
+  sad_sse3.asm \
+  sad_ssse3.asm \
+  sad_sse4.asm \
+  subtract_mmx.asm \
+  subtract_sse2.asm \
+  temporal_filter_apply_sse2.asm \
+  variance_impl_mmx.asm \
+  variance_impl_sse2.asm \
+  variance_impl_ssse3.asm \
+  $(NULL)
+
+# Files which depend on asm_enc_offsets.asm
+VPX_ASM_ENC_OFFSETS_SRCS = \
+  quantize_sse2.asm \
+  quantize_ssse3.asm \
+  quantize_sse4.asm \
+  $(NULL)
+
+endif
+
 endif
 
 ifdef VPX_ARM_ASM
 # Building on an ARM platform with a supported assembler, include
 # the optimized assembly in the build.
 
 # The Android NDK doesn't pre-define anything to indicate the OS it's on, so
 # do it for them.
@@ -279,47 +370,166 @@ VPX_ASFILES = \
   idct_dequant_dc_full_2x_neon.asm \
   idct_dequant_dc_0_2x_neon.asm \
   dequant_idct_neon.asm \
   idct_dequant_full_2x_neon.asm \
   idct_dequant_0_2x_neon.asm \
   dequantizeb_neon.asm \
   $(NULL)
 
-# The ARM asm needs to extract the offsets of various C struct members.
-# We need a program that runs on the host to pull them out of a .o file.
-HOST_CSRCS = obj_int_extract.c
-HOST_PROGRAM = host_obj_int_extract$(HOST_BIN_SUFFIX)
+ifdef MOZ_VP8_ENCODER
+CSRCS += \
+  arm_csystemdependent.c \
+  dct_arm.c \
+  picklpf_arm.c \
+  variance_arm.c \
+  $(NULL)
+
+VPX_ASFILES += \
+  vp8_packtokens_armv5.asm \
+  vp8_packtokens_mbrow_armv5.asm \
+  vp8_packtokens_partitions_armv5.asm \
+  vp8_fast_fdct4x4_armv6.asm \
+  vp8_fast_quantize_b_armv6.asm \
+  vp8_mse16x16_armv6.asm \
+  vp8_sad16x16_armv6.asm \
+  vp8_subtract_armv6.asm \
+  vp8_variance16x16_armv6.asm \
+  vp8_variance8x8_armv6.asm \
+  vp8_variance_halfpixvar16x16_h_armv6.asm \
+  vp8_variance_halfpixvar16x16_hv_armv6.asm \
+  vp8_variance_halfpixvar16x16_v_armv6.asm \
+  walsh_v6.asm \
+  fastfdct4x4_neon.asm \
+  fastfdct8x4_neon.asm \
+  fastquantizeb_neon.asm \
+  sad16_neon.asm \
+  sad8_neon.asm \
+  shortfdct_neon.asm \
+  subtract_neon.asm \
+  variance_neon.asm \
+  vp8_memcpy_neon.asm \
+  vp8_mse16x16_neon.asm \
+  vp8_shortwalsh4x4_neon.asm \
+  vp8_subpixelvariance8x8_neon.asm \
+  vp8_subpixelvariance16x16_neon.asm \
+  vp8_subpixelvariance16x16s_neon.asm \
+  vp8_vpxyv12_copyframeyonly_neon.asm \
+  $(NULL)
+
+# Files which depend on asm_com_offsets.asm
+VPX_ASM_COM_OFFSETS_SRCS = \
+  vp8_vpxyv12_copyframeyonly_neon.asm \
+  $(NULL)
+
+# Files which depend on asm_enc_offsets.asm
+VPX_ASM_ENC_OFFSETS_SRCS = \
+  vp8_packtokens_armv5.asm \
+  vp8_packtokens_mbrow_armv5.asm \
+  vp8_packtokens_partitions_armv5.asm \
+  vp8_fast_quantize_b_armv6.asm \
+  vp8_subtract_armv6.asm \
+  fastquantizeb_neon.asm \
+  subtract_neon.asm \
+  $(NULL)
+
+endif
 
 ifdef VPX_AS_CONVERSION
 # The ARM asm is written in ARM RVCT syntax, but we actually build it with
 # gas using GNU syntax. Add some rules to perform the conversion.
 VPX_CONVERTED_ASFILES = $(addsuffix .$(ASM_SUFFIX), $(VPX_ASFILES))
 
 ASFILES += $(VPX_CONVERTED_ASFILES)
 GARBAGE += $(VPX_CONVERTED_ASFILES)
 
 %.asm.$(ASM_SUFFIX): %.asm
 	$(VPX_AS_CONVERSION) < $< > $@
 else
 ASFILES += $(VPX_ASFILES)
 endif
 
-GARBAGE += vpx_asm_offsets.$(OBJ_SUFFIX) vpx_asm_offsets.asm
+endif
+
+ifdef MOZ_VP8_ENCODER
+ifdef VPX_NEED_OBJ_INT_EXTRACT
+
+# We don't have a compiler that supports a compatible inline asm syntax, so we
+# have to resort to extracting asm offsets from a compiled object. This only
+# works if we have the appropriate system headers obj_int_extract needs to
+# parse that format, and so only has limited support for cross-compilation.
+
+ifdef VPX_ARM_ASM
+VPX_OIE_FORMAT := rvds
+else
+VPX_OIE_FORMAT := gas
+endif
+
+HOST_CSRCS = obj_int_extract.c
+HOST_PROGRAM = host_obj_int_extract$(HOST_BIN_SUFFIX)
 
+GARBAGE += \
+  asm_com_offsets.$(OBJ_SUFFIX) asm_com_offsets.asm \
+  asm_enc_offsets.$(OBJ_SUFFIX) asm_enc_offsets.asm \
+  $(NULL)
+
+else
+
+# We can extract the asm offsets directly from generated assembly using inline
+# asm. This is the preferred method.
+
+asm_com_offsets.s: CFLAGS += -DINLINE_ASM
+asm_enc_offsets.s: CFLAGS += -DINLINE_ASM
+
+asm_com_offsets.asm: asm_com_offsets.s
+	grep \\\<EQU\\\> $< | sed -e 's/[$$\#]//g' \
+	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
+
+asm_enc_offsets.asm: asm_enc_offsets.s
+	grep \\\<EQU\\\> $< | sed -e 's/[$$\#]//g' \
+	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
+
+GARBAGE += \
+  asm_com_offsets.s asm_com_offsets.asm \
+  asm_enc_offsets.s asm_enc_offsets.asm \
+  $(NULL)
+
+endif
 endif
 
 include $(topsrcdir)/config/rules.mk
 
+# This must be after rules.mk in order to use $(OBJ_SUFFIX) outside a
+# recursively-expanded variable.
+ifdef MOZ_VP8_ENCODER
+
+ifdef VPX_NEED_OBJ_INT_EXTRACT
+
+asm_com_offsets.asm: asm_com_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
+	./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \
+	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
+
+asm_enc_offsets.asm: asm_enc_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
+	./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \
+	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
+
+endif
+
+# These dependencies are not generated automatically, so do it manually.
+ifdef VPX_AS_CONVERSION
+$(addsuffix .$(OBJ_SUFFIX), $(VPX_ASM_COM_OFFSETS_SRCS)): asm_com_offsets.asm
+$(addsuffix .$(OBJ_SUFFIX), $(VPX_ASM_ENC_OFFSETS_SRCS)): asm_enc_offsets.asm
+else
+$(patsubst %.$(ASM_SUFFIX),%.$(OBJ_SUFFIX), $(VPX_ASM_COM_OFFSETS_SRCS)): asm_com_offsets.asm
+$(patsubst %.$(ASM_SUFFIX),%.$(OBJ_SUFFIX), $(VPX_ASM_ENC_OFFSETS_SRCS)): asm_enc_offsets.asm
+endif
+
+endif
+
 # Workaround a bug of Sun Studio (CR 6963410)
 ifdef SOLARIS_SUNPRO_CC
 ifeq (86,$(findstring 86,$(OS_TEST)))
-filter_c.o: filter_c.c Makefile.in
+filter.o: filter.c Makefile.in
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO_CC)
 	$(CC) -o $@ -c $(patsubst -xO[45],-xO3,$(COMPILE_CFLAGS)) $<
 endif
 endif
-
-ifdef VPX_ARM_ASM
-vpx_asm_offsets.asm: vpx_asm_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
-	./$(HOST_PROGRAM) rvds $< $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
-endif
--- a/media/libvpx/build/make/ads2gas.pl
+++ b/media/libvpx/build/make/ads2gas.pl
@@ -16,18 +16,24 @@
 # Convert ARM Developer Suite 1.0.1 syntax assembly source to GNU as format
 #
 # Usage: cat inputfile | perl ads2gas.pl > outputfile
 #
 print "@ This file was created from a .asm file\n";
 print "@  using the ads2gas.pl script.\n";
 print "\t.equ DO1STROUNDING, 0\n";
 
+# Stack of procedure names.
+@proc_stack = ();
+
 while (<STDIN>)
 {
+    # Load and store alignment
+    s/@/,:/g;
+
     # Comment character
     s/;/@/g;
 
     # Hexadecimal constants prefaced by 0x
     s/#&/#0x/g;
 
     # Convert :OR: to |
     s/:OR:/ | /g;
@@ -112,32 +118,46 @@ while (<STDIN>)
     # underscore
     s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
 
     # Labels need trailing colon
 #   s/^(\w+)/$1:/ if !/EQU/;
     # put the colon at the end of the line in the macro
     s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
 
-    # Strip ALIGN
-    s/\sALIGN/@ ALIGN/g;
+    # ALIGN directive
+    s/ALIGN/.balign/g;
 
     # Strip ARM
     s/\sARM/@ ARM/g;
 
     # Strip REQUIRE8
     #s/\sREQUIRE8/@ REQUIRE8/g;
     s/\sREQUIRE8/@ /g;      #EQU cause problem
 
     # Strip PRESERVE8
     s/\sPRESERVE8/@ PRESERVE8/g;
 
-    # Strip PROC and ENDPROC
-    s/\sPROC/@/g;
-    s/\sENDP/@/g;
+    # Use PROC and ENDP to give the symbols a .size directive.
+    # This makes them show up properly in debugging tools like gdb and valgrind.
+    if (/\bPROC\b/)
+    {
+        my $proc;
+        /^_([\.0-9A-Z_a-z]\w+)\b/;
+        $proc = $1;
+        push(@proc_stack, $proc) if ($proc);
+        s/\bPROC\b/@ $&/;
+    }
+    if (/\bENDP\b/)
+    {
+        my $proc;
+        s/\bENDP\b/@ $&/;
+        $proc = pop(@proc_stack);
+        $_ = "\t.size $proc, .-$proc".$_ if ($proc);
+    }
 
     # EQU directive
     s/(.*)EQU(.*)/.equ $1, $2/;
 
     # Begin macro definition
     if (/MACRO/) {
         $_ = <STDIN>;
         s/^/.macro/;
@@ -146,8 +166,11 @@ while (<STDIN>)
     }
 
     # For macros, use \ to reference formal params
     s/\$/\\/g;                  # End macro definition
     s/MEND/.endm/;              # No need to tell it where to stop assembling
     next if /^\s*END\s*$/;
     print;
 }
+
+# Mark that this object doesn't need an executable stack.
+printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n");
--- a/media/libvpx/build/make/obj_int_extract.c
+++ b/media/libvpx/build/make/obj_int_extract.c
@@ -4,35 +4,23 @@
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "vpx_config.h"
-
-#if defined(_MSC_VER)
-#include <io.h>
-#include <share.h>
 #include "vpx/vpx_integer.h"
-#else
-#include <stdint.h>
-#include <unistd.h>
-#endif
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdarg.h>
 
 typedef enum
 {
     OUTPUT_FMT_PLAIN,
     OUTPUT_FMT_RVDS,
     OUTPUT_FMT_GAS,
 } output_fmt_t;
 
@@ -42,188 +30,194 @@ int log_msg(const char *fmt, ...)
     va_list ap;
     va_start(ap, fmt);
     res = vfprintf(stderr, fmt, ap);
     va_end(ap);
     return res;
 }
 
 #if defined(__GNUC__) && __GNUC__
-
 #if defined(__MACH__)
 
 #include <mach-o/loader.h>
 #include <mach-o/nlist.h>
 
 int parse_macho(uint8_t *base_buf, size_t sz)
 {
     int i, j;
     struct mach_header header;
     uint8_t *buf = base_buf;
     int base_data_section = 0;
+    int bits = 0;
 
+    /* We can read in mach_header for 32 and 64 bit architectures
+     * because it's identical to mach_header_64 except for the last
+     * element (uint32_t reserved), which we don't use. Then, when
+     * we know which architecture we're looking at, increment buf
+     * appropriately.
+     */
     memcpy(&header, buf, sizeof(struct mach_header));
-    buf += sizeof(struct mach_header);
 
-    if (header.magic != MH_MAGIC)
+    if (header.magic == MH_MAGIC)
     {
-        log_msg("Bad magic number for object file. 0x%x expected, 0x%x found.\n",
-                header.magic, MH_MAGIC);
-        goto bail;
+        if (header.cputype == CPU_TYPE_ARM
+            || header.cputype == CPU_TYPE_X86)
+        {
+            bits = 32;
+            buf += sizeof(struct mach_header);
+        }
+        else
+        {
+            log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_[ARM|X86].\n");
+            goto bail;
+        }
     }
-
-    if (header.cputype != CPU_TYPE_ARM)
+    else if (header.magic == MH_MAGIC_64)
     {
-        log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_ARM.\n");
+        if (header.cputype == CPU_TYPE_X86_64)
+        {
+            bits = 64;
+            buf += sizeof(struct mach_header_64);
+        }
+        else
+        {
+            log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_X86_64.\n");
+            goto bail;
+        }
+    }
+    else
+    {
+        log_msg("Bad magic number for object file. 0x%x or 0x%x expected, 0x%x found.\n",
+                MH_MAGIC, MH_MAGIC_64, header.magic);
         goto bail;
     }
 
     if (header.filetype != MH_OBJECT)
     {
         log_msg("Bad filetype for object file. Currently only tested for MH_OBJECT.\n");
         goto bail;
     }
 
     for (i = 0; i < header.ncmds; i++)
     {
         struct load_command lc;
-        struct symtab_command sc;
-        struct segment_command seg_c;
 
         memcpy(&lc, buf, sizeof(struct load_command));
 
         if (lc.cmd == LC_SEGMENT)
         {
             uint8_t *seg_buf = buf;
             struct section s;
+            struct segment_command seg_c;
 
-            memcpy(&seg_c, buf, sizeof(struct segment_command));
-
+            memcpy(&seg_c, seg_buf, sizeof(struct segment_command));
             seg_buf += sizeof(struct segment_command);
 
-            for (j = 0; j < seg_c.nsects; j++)
+            /* Although each section is given it's own offset, nlist.n_value
+             * references the offset of the first section. This isn't
+             * apparent without debug information because the offset of the
+             * data section is the same as the first section. However, with
+             * debug sections mixed in, the offset of the debug section
+             * increases but n_value still references the first section.
+             */
+            if (seg_c.nsects < 1)
             {
-                memcpy(&s, seg_buf + (j * sizeof(struct section)), sizeof(struct section));
+                log_msg("Not enough sections\n");
+                goto bail;
+            }
 
-                // Need to get this offset which is the start of the symbol table
-                // before matching the strings up with symbols.
-                base_data_section = s.offset;
+            memcpy(&s, seg_buf, sizeof(struct section));
+            base_data_section = s.offset;
+        }
+        else if (lc.cmd == LC_SEGMENT_64)
+        {
+            uint8_t *seg_buf = buf;
+            struct section_64 s;
+            struct segment_command_64 seg_c;
+
+            memcpy(&seg_c, seg_buf, sizeof(struct segment_command_64));
+            seg_buf += sizeof(struct segment_command_64);
+
+            /* Explanation in LG_SEGMENT */
+            if (seg_c.nsects < 1)
+            {
+                log_msg("Not enough sections\n");
+                goto bail;
             }
+
+            memcpy(&s, seg_buf, sizeof(struct section_64));
+            base_data_section = s.offset;
         }
         else if (lc.cmd == LC_SYMTAB)
         {
-            uint8_t *sym_buf = base_buf;
-            uint8_t *str_buf = base_buf;
-
             if (base_data_section != 0)
             {
+                struct symtab_command sc;
+                uint8_t *sym_buf = base_buf;
+                uint8_t *str_buf = base_buf;
+
                 memcpy(&sc, buf, sizeof(struct symtab_command));
 
                 if (sc.cmdsize != sizeof(struct symtab_command))
+                {
                     log_msg("Can't find symbol table!\n");
+                    goto bail;
+                }
 
                 sym_buf += sc.symoff;
                 str_buf += sc.stroff;
 
                 for (j = 0; j < sc.nsyms; j++)
                 {
-                    struct nlist nl;
-                    int val;
+                    /* Location of string is cacluated each time from the
+                     * start of the string buffer.  On darwin the symbols
+                     * are prefixed by "_", so we bump the pointer by 1.
+                     * The target value is defined as an int in asm_*_offsets.c,
+                     * which is 4 bytes on all targets we currently use.
+                     */
+                    if (bits == 32)
+                    {
+                        struct nlist nl;
+                        int val;
 
-                    memcpy(&nl, sym_buf + (j * sizeof(struct nlist)), sizeof(struct nlist));
-
-                    val = *((int *)(base_buf + base_data_section + nl.n_value));
+                        memcpy(&nl, sym_buf, sizeof(struct nlist));
+                        sym_buf += sizeof(struct nlist);
 
-                    // Location of string is cacluated each time from the
-                    // start of the string buffer.  On darwin the symbols
-                    // are prefixed by "_".  On other platforms it is not
-                    // so it needs to be removed.  That is the reason for
-                    // the +1.
-                    printf("%-40s EQU %5d\n", str_buf + nl.n_un.n_strx + 1, val);
+                        memcpy(&val, base_buf + base_data_section + nl.n_value,
+                               sizeof(val));
+                        printf("%-40s EQU %5d\n",
+                               str_buf + nl.n_un.n_strx + 1, val);
+                    }
+                    else /* if (bits == 64) */
+                    {
+                        struct nlist_64 nl;
+                        int val;
+
+                        memcpy(&nl, sym_buf, sizeof(struct nlist_64));
+                        sym_buf += sizeof(struct nlist_64);
+
+                        memcpy(&val, base_buf + base_data_section + nl.n_value,
+                               sizeof(val));
+                        printf("%-40s EQU %5d\n",
+                               str_buf + nl.n_un.n_strx + 1, val);
+                    }
                 }
             }
         }
 
         buf += lc.cmdsize;
     }
 
     return 0;
 bail:
     return 1;
 
 }
 
-int main(int argc, char **argv)
-{
-    int fd;
-    char *f;
-    struct stat stat_buf;
-    uint8_t *file_buf;
-    int res;
-
-    if (argc < 2 || argc > 3)
-    {
-        fprintf(stderr, "Usage: %s [output format] <obj file>\n\n", argv[0]);
-        fprintf(stderr, "  <obj file>\tMachO format object file to parse\n");
-        fprintf(stderr, "Output Formats:\n");
-        fprintf(stderr, "  gas  - compatible with GNU assembler\n");
-        fprintf(stderr, "  rvds - compatible with armasm\n");
-        goto bail;
-    }
-
-    f = argv[2];
-
-    if (!((!strcmp(argv[1], "rvds")) || (!strcmp(argv[1], "gas"))))
-        f = argv[1];
-
-    fd = open(f, O_RDONLY);
-
-    if (fd < 0)
-    {
-        perror("Unable to open file");
-        goto bail;
-    }
-
-    if (fstat(fd, &stat_buf))
-    {
-        perror("stat");
-        goto bail;
-    }
-
-    file_buf = malloc(stat_buf.st_size);
-
-    if (!file_buf)
-    {
-        perror("malloc");
-        goto bail;
-    }
-
-    if (read(fd, file_buf, stat_buf.st_size) != stat_buf.st_size)
-    {
-        perror("read");
-        goto bail;
-    }
-
-    if (close(fd))
-    {
-        perror("close");
-        goto bail;
-    }
-
-    res = parse_macho(file_buf, stat_buf.st_size);
-    free(file_buf);
-
-    if (!res)
-        return EXIT_SUCCESS;
-
-bail:
-    return EXIT_FAILURE;
-}
-
-#else
+#elif defined(__ELF__)
 #include "elf.h"
 
 #define COPY_STRUCT(dst, buf, ofst, sz) do {\
         if(ofst + sizeof((*(dst))) > sz) goto bail;\
         memcpy(dst, buf+ofst, sizeof((*(dst))));\
     } while(0)
 
 #define ENDIAN_ASSIGN(val, memb) do {\
@@ -232,342 +226,485 @@ bail:
     } while(0)
 
 #define ENDIAN_ASSIGN_IN_PLACE(memb) do {\
         ENDIAN_ASSIGN(memb, memb);\
     } while(0)
 
 typedef struct
 {
-    uint8_t     *buf; /* Buffer containing ELF data */
-    size_t       sz;  /* Buffer size */
-    int          le_data;   /* Data is little-endian */
-    Elf32_Ehdr   hdr;
+    uint8_t      *buf; /* Buffer containing ELF data */
+    size_t        sz;  /* Buffer size */
+    int           le_data; /* Data is little-endian */
+    unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
+    int           bits; /* 32 or 64 */
+    Elf32_Ehdr    hdr32;
+    Elf64_Ehdr    hdr64;
 } elf_obj_t;
 
-int parse_elf32_header(elf_obj_t *elf)
+int parse_elf_header(elf_obj_t *elf)
 {
     int res;
-    /* Verify ELF32 header */
-    COPY_STRUCT(&elf->hdr, elf->buf, 0, elf->sz);
-    res = elf->hdr.e_ident[EI_MAG0] == ELFMAG0;
-    res &= elf->hdr.e_ident[EI_MAG1] == ELFMAG1;
-    res &= elf->hdr.e_ident[EI_MAG2] == ELFMAG2;
-    res &= elf->hdr.e_ident[EI_MAG3] == ELFMAG3;
-    res &= elf->hdr.e_ident[EI_CLASS] == ELFCLASS32;
-    res &= elf->hdr.e_ident[EI_DATA] == ELFDATA2LSB
-           || elf->hdr.e_ident[EI_DATA] == ELFDATA2MSB;
+    /* Verify ELF Magic numbers */
+    COPY_STRUCT(&elf->e_ident, elf->buf, 0, elf->sz);
+    res = elf->e_ident[EI_MAG0] == ELFMAG0;
+    res &= elf->e_ident[EI_MAG1] == ELFMAG1;
+    res &= elf->e_ident[EI_MAG2] == ELFMAG2;
+    res &= elf->e_ident[EI_MAG3] == ELFMAG3;
+    res &= elf->e_ident[EI_CLASS] == ELFCLASS32
+        || elf->e_ident[EI_CLASS] == ELFCLASS64;
+    res &= elf->e_ident[EI_DATA] == ELFDATA2LSB;
 
     if (!res) goto bail;
 
-    elf->le_data = elf->hdr.e_ident[EI_DATA] == ELFDATA2LSB;
+    elf->le_data = elf->e_ident[EI_DATA] == ELFDATA2LSB;
+
+    /* Read in relevant values */
+    if (elf->e_ident[EI_CLASS] == ELFCLASS32)
+    {
+        elf->bits = 32;
+        COPY_STRUCT(&elf->hdr32, elf->buf, 0, elf->sz);
+
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_type);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_machine);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_version);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_entry);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phoff);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shoff);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_flags);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_ehsize);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phentsize);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phnum);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shentsize);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shnum);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shstrndx);
+    }
+    else /* if (elf->e_ident[EI_CLASS] == ELFCLASS64) */
+    {
+        elf->bits = 64;
+        COPY_STRUCT(&elf->hdr64, elf->buf, 0, elf->sz);
+
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_type);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_machine);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_version);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_entry);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phoff);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shoff);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_flags);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_ehsize);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phentsize);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phnum);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shentsize);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shnum);
+        ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shstrndx);
+    }
 
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_type);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_machine);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_version);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_entry);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_phoff);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shoff);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_flags);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_ehsize);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_phentsize);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_phnum);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shentsize);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shnum);
-    ENDIAN_ASSIGN_IN_PLACE(elf->hdr.e_shstrndx);
+    return 0;
+bail:
+    log_msg("Failed to parse ELF file header");
+    return 1;
+}
+
+int parse_elf_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr32, Elf64_Shdr *hdr64)
+{
+    if (hdr32)
+    {
+        if (idx >= elf->hdr32.e_shnum)
+            goto bail;
+
+        COPY_STRUCT(hdr32, elf->buf, elf->hdr32.e_shoff + idx * elf->hdr32.e_shentsize,
+                    elf->sz);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_name);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_type);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_flags);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addr);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_offset);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_size);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_link);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_info);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addralign);
+        ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_entsize);
+    }
+    else /* if (hdr64) */
+    {
+        if (idx >= elf->hdr64.e_shnum)
+            goto bail;
+
+        COPY_STRUCT(hdr64, elf->buf, elf->hdr64.e_shoff + idx * elf->hdr64.e_shentsize,
+                    elf->sz);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_name);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_type);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_flags);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addr);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_offset);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_size);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_link);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_info);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addralign);
+        ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_entsize);
+    }
+
     return 0;
 bail:
     return 1;
 }
 
-int parse_elf32_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr)
+char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx)
 {
-    if (idx >= elf->hdr.e_shnum)
-        goto bail;
+    if (elf->bits == 32)
+    {
+        Elf32_Shdr shdr;
+
+        if (parse_elf_section(elf, s_idx, &shdr, NULL))
+        {
+            log_msg("Failed to parse ELF string table: section %d, index %d\n",
+                    s_idx, idx);
+            return "";
+        }
+
+        return (char *)(elf->buf + shdr.sh_offset + idx);
+    }
+    else /* if (elf->bits == 64) */
+    {
+        Elf64_Shdr shdr;
+
+        if (parse_elf_section(elf, s_idx, NULL, &shdr))
+        {
+            log_msg("Failed to parse ELF string table: section %d, index %d\n",
+                    s_idx, idx);
+            return "";
+        }
 
-    COPY_STRUCT(hdr, elf->buf, elf->hdr.e_shoff + idx * elf->hdr.e_shentsize,
-                elf->sz);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_name);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_type);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_flags);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_addr);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_offset);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_size);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_link);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_info);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_addralign);
-    ENDIAN_ASSIGN_IN_PLACE(hdr->sh_entsize);
+        return (char *)(elf->buf + shdr.sh_offset + idx);
+    }
+}
+
+int parse_elf_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym32, Elf64_Sym *sym64)
+{
+    if (sym32)
+    {
+        COPY_STRUCT(sym32, elf->buf, ofst, elf->sz);
+        ENDIAN_ASSIGN_IN_PLACE(sym32->st_name);
+        ENDIAN_ASSIGN_IN_PLACE(sym32->st_value);
+        ENDIAN_ASSIGN_IN_PLACE(sym32->st_size);
+        ENDIAN_ASSIGN_IN_PLACE(sym32->st_info);
+        ENDIAN_ASSIGN_IN_PLACE(sym32->st_other);
+        ENDIAN_ASSIGN_IN_PLACE(sym32->st_shndx);
+    }
+    else /* if (sym64) */
+    {
+        COPY_STRUCT(sym64, elf->buf, ofst, elf->sz);
+        ENDIAN_ASSIGN_IN_PLACE(sym64->st_name);
+        ENDIAN_ASSIGN_IN_PLACE(sym64->st_value);
+        ENDIAN_ASSIGN_IN_PLACE(sym64->st_size);
+        ENDIAN_ASSIGN_IN_PLACE(sym64->st_info);
+        ENDIAN_ASSIGN_IN_PLACE(sym64->st_other);
+        ENDIAN_ASSIGN_IN_PLACE(sym64->st_shndx);
+    }
     return 0;
 bail:
     return 1;
 }
 
-char *parse_elf32_string_table(elf_obj_t *elf, int s_idx, int idx)
-{
-    Elf32_Shdr shdr;
-
-    if (parse_elf32_section(elf, s_idx, &shdr))
-    {
-        log_msg("Failed to parse ELF string table: section %d, index %d\n",
-                s_idx, idx);
-        return "";
-    }
-
-    return (char *)(elf->buf + shdr.sh_offset + idx);
-}
-
-int parse_elf32_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym)
+int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
 {
-    COPY_STRUCT(sym, elf->buf, ofst, elf->sz);
-    ENDIAN_ASSIGN_IN_PLACE(sym->st_name);
-    ENDIAN_ASSIGN_IN_PLACE(sym->st_value);
-    ENDIAN_ASSIGN_IN_PLACE(sym->st_size);
-    ENDIAN_ASSIGN_IN_PLACE(sym->st_info);
-    ENDIAN_ASSIGN_IN_PLACE(sym->st_other);
-    ENDIAN_ASSIGN_IN_PLACE(sym->st_shndx);
-    return 0;
-bail:
-    return 1;
-}
-
-int parse_elf32(uint8_t *buf, size_t sz, output_fmt_t mode)
-{
-    elf_obj_t  elf;
-    Elf32_Shdr shdr;
+    elf_obj_t    elf;
     unsigned int ofst;
-    int         i;
-    Elf32_Off strtab_off;   /* save String Table offset for later use */
+    int          i;
+    Elf32_Off    strtab_off32;
+    Elf64_Off    strtab_off64; /* save String Table offset for later use */
 
     memset(&elf, 0, sizeof(elf));
     elf.buf = buf;
     elf.sz = sz;
 
     /* Parse Header */
-    if (parse_elf32_header(&elf))
+    if (parse_elf_header(&elf))
+      goto bail;
+
+    if (elf.bits == 32)
     {
-        log_msg("Parse error: File does not appear to be valid ELF32\n");
-        return 1;
-    }
+        Elf32_Shdr shdr;
+        for (i = 0; i < elf.hdr32.e_shnum; i++)
+        {
+            parse_elf_section(&elf, i, &shdr, NULL);
 
-    for (i = 0; i < elf.hdr.e_shnum; i++)
-    {
-        parse_elf32_section(&elf, i, &shdr);
+            if (shdr.sh_type == SHT_STRTAB)
+            {
+                char strtsb_name[128];
+
+                strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
 
-        if (shdr.sh_type == SHT_STRTAB)
+                if (!(strcmp(strtsb_name, ".shstrtab")))
+                {
+                    /* log_msg("found section: %s\n", strtsb_name); */
+                    strtab_off32 = shdr.sh_offset;
+                    break;
+                }
+            }
+        }
+    }
+    else /* if (elf.bits == 64) */
+    {
+        Elf64_Shdr shdr;
+        for (i = 0; i < elf.hdr64.e_shnum; i++)
         {
-            char strtsb_name[128];
-
-            strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
+            parse_elf_section(&elf, i, NULL, &shdr);
 
-            if (!(strcmp(strtsb_name, ".shstrtab")))
+            if (shdr.sh_type == SHT_STRTAB)
             {
-                log_msg("found section: %s\n", strtsb_name);
-                strtab_off = shdr.sh_offset;
-                break;
+                char strtsb_name[128];
+
+                strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
+
+                if (!(strcmp(strtsb_name, ".shstrtab")))
+                {
+                    /* log_msg("found section: %s\n", strtsb_name); */
+                    strtab_off64 = shdr.sh_offset;
+                    break;
+                }
             }
         }
     }
 
     /* Parse all Symbol Tables */
-    for (i = 0; i < elf.hdr.e_shnum; i++)
+    if (elf.bits == 32)
     {
-
-        parse_elf32_section(&elf, i, &shdr);
-
-        if (shdr.sh_type == SHT_SYMTAB)
+        Elf32_Shdr shdr;
+        for (i = 0; i < elf.hdr32.e_shnum; i++)
         {
-            for (ofst = shdr.sh_offset;
-                 ofst < shdr.sh_offset + shdr.sh_size;
-                 ofst += shdr.sh_entsize)
+            parse_elf_section(&elf, i, &shdr, NULL);
+
+            if (shdr.sh_type == SHT_SYMTAB)
             {
-                Elf32_Sym sym;
+                for (ofst = shdr.sh_offset;
+                     ofst < shdr.sh_offset + shdr.sh_size;
+                     ofst += shdr.sh_entsize)
+                {
+                    Elf32_Sym sym;
+
+                    parse_elf_symbol(&elf, ofst, &sym, NULL);
 
-                parse_elf32_symbol(&elf, ofst, &sym);
+                    /* For all OBJECTS (data objects), extract the value from the
+                     * proper data segment.
+                     */
+                    /* if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
+                        log_msg("found data object %s\n",
+                                parse_elf_string_table(&elf,
+                                                       shdr.sh_link,
+                                                       sym.st_name));
+                     */
 
-                /* For all OBJECTS (data objects), extract the value from the
-                 * proper data segment.
-                 */
-                if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
-                    log_msg("found data object %s\n",
-                            parse_elf32_string_table(&elf,
-                                                     shdr.sh_link,
-                                                     sym.st_name));
+                    if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT
+                        && sym.st_size == 4)
+                    {
+                        Elf32_Shdr dhdr;
+                        int val = 0;
+                        char section_name[128];
+
+                        parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL);
+
+                        /* For explanition - refer to _MSC_VER version of code */
+                        strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name));
+                        /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */
 
-                if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT
-                    && sym.st_size == 4)
-                {
-                    Elf32_Shdr dhdr;
-                    int32_t      val;
-                    char section_name[128];
+                        if (strcmp(section_name, ".bss"))
+                        {
+                            if (sizeof(val) != sym.st_size)
+                            {
+                                /* The target value is declared as an int in
+                                 * asm_*_offsets.c, which is 4 bytes on all
+                                 * targets we currently use. Complain loudly if
+                                 * this is not true.
+                                 */
+                                log_msg("Symbol size is wrong\n");
+                                goto bail;
+                            }
 
-                    parse_elf32_section(&elf, sym.st_shndx, &dhdr);
+                            memcpy(&val,
+                                   elf.buf + dhdr.sh_offset + sym.st_value,
+                                   sym.st_size);
+                        }
 
-                    /* For explanition - refer to _MSC_VER version of code */
-                    strcpy(section_name, (char *)(elf.buf + strtab_off + dhdr.sh_name));
-                    log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type);
+                        if (!elf.le_data)
+                        {
+                            log_msg("Big Endian data not supported yet!\n");
+                            goto bail;
+                        }
 
-                    if (!(strcmp(section_name, ".bss")))
-                    {
-                        val = 0;
+                        switch (mode)
+                        {
+                            case OUTPUT_FMT_RVDS:
+                                printf("%-40s EQU %5d\n",
+                                       parse_elf_string_table(&elf,
+                                                              shdr.sh_link,
+                                                              sym.st_name),
+                                       val);
+                                break;
+                            case OUTPUT_FMT_GAS:
+                                printf(".equ %-40s, %5d\n",
+                                       parse_elf_string_table(&elf,
+                                                              shdr.sh_link,
+                                                              sym.st_name),
+                                       val);
+                                break;
+                            default:
+                                printf("%s = %d\n",
+                                       parse_elf_string_table(&elf,
+                                                              shdr.sh_link,
+                                                              sym.st_name),
+                                       val);
+                        }
                     }
-                    else
-                    {
-                        memcpy(&val,
-                               elf.buf + dhdr.sh_offset + sym.st_value,
-                               sizeof(val));
-                    }
+                }
+            }
+        }
+    }
+    else /* if (elf.bits == 64) */
+    {
+        Elf64_Shdr shdr;
+        for (i = 0; i < elf.hdr64.e_shnum; i++)
+        {
+            parse_elf_section(&elf, i, NULL, &shdr);
 
-                    if (!elf.le_data)
-                    {
-                        log_msg("Big Endian data not supported yet!\n");
-                        goto bail;
-                    }\
+            if (shdr.sh_type == SHT_SYMTAB)
+            {
+                for (ofst = shdr.sh_offset;
+                     ofst < shdr.sh_offset + shdr.sh_size;
+                     ofst += shdr.sh_entsize)
+                {
+                    Elf64_Sym sym;
+
+                    parse_elf_symbol(&elf, ofst, NULL, &sym);
 
-                    switch (mode)
+                    /* For all OBJECTS (data objects), extract the value from the
+                     * proper data segment.
+                     */
+                    /* if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
+                        log_msg("found data object %s\n",
+                                parse_elf_string_table(&elf,
+                                                       shdr.sh_link,
+                                                       sym.st_name));
+                     */
+
+                    if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT
+                        && sym.st_size == 4)
                     {
-                    case OUTPUT_FMT_RVDS:
-                        printf("%-40s EQU %5d\n",
-                               parse_elf32_string_table(&elf,
-                                                        shdr.sh_link,
-                                                        sym.st_name),
-                               val);
-                        break;
-                    case OUTPUT_FMT_GAS:
-                        printf(".equ %-40s, %5d\n",
-                               parse_elf32_string_table(&elf,
-                                                        shdr.sh_link,
-                                                        sym.st_name),
-                               val);
-                        break;
-                    default:
-                        printf("%s = %d\n",
-                               parse_elf32_string_table(&elf,
-                                                        shdr.sh_link,
-                                                        sym.st_name),
-                               val);
+                        Elf64_Shdr dhdr;
+                        int val = 0;
+                        char section_name[128];
+
+                        parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr);
+
+                        /* For explanition - refer to _MSC_VER version of code */
+                        strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name));
+                        /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */
+
+                        if ((strcmp(section_name, ".bss")))
+                        {
+                            if (sizeof(val) != sym.st_size)
+                            {
+                                /* The target value is declared as an int in
+                                 * asm_*_offsets.c, which is 4 bytes on all
+                                 * targets we currently use. Complain loudly if
+                                 * this is not true.
+                                 */
+                                log_msg("Symbol size is wrong\n");
+                                goto bail;
+                            }
+
+                            memcpy(&val,
+                                   elf.buf + dhdr.sh_offset + sym.st_value,
+                                   sym.st_size);
+                        }
+
+                        if (!elf.le_data)
+                        {
+                            log_msg("Big Endian data not supported yet!\n");
+                            goto bail;
+                        }
+
+                        switch (mode)
+                        {
+                            case OUTPUT_FMT_RVDS:
+                                printf("%-40s EQU %5d\n",
+                                       parse_elf_string_table(&elf,
+                                                              shdr.sh_link,
+                                                              sym.st_name),
+                                       val);
+                                break;
+                            case OUTPUT_FMT_GAS:
+                                printf(".equ %-40s, %5d\n",
+                                       parse_elf_string_table(&elf,
+                                                              shdr.sh_link,
+                                                              sym.st_name),
+                                       val);
+                                break;
+                            default:
+                                printf("%s = %d\n",
+                                       parse_elf_string_table(&elf,
+                                                              shdr.sh_link,
+                                                              sym.st_name),
+                                       val);
+                        }
                     }
                 }
             }
         }
     }
 
     if (mode == OUTPUT_FMT_RVDS)
         printf("    END\n");
 
     return 0;
 bail:
-    log_msg("Parse error: File does not appear to be valid ELF32\n");
+    log_msg("Parse error: File does not appear to be valid ELF32 or ELF64\n");
     return 1;
 }
 
-int main(int argc, char **argv)
-{
-    int fd;
-    output_fmt_t mode;
-    char *f;
-    struct stat stat_buf;
-    uint8_t *file_buf;
-    int res;
-
-    if (argc < 2 || argc > 3)
-    {
-        fprintf(stderr, "Usage: %s [output format] <obj file>\n\n", argv[0]);
-        fprintf(stderr, "  <obj file>\tELF format object file to parse\n");
-        fprintf(stderr, "Output Formats:\n");
-        fprintf(stderr, "  gas  - compatible with GNU assembler\n");
-        fprintf(stderr, "  rvds - compatible with armasm\n");
-        goto bail;
-    }
-
-    f = argv[2];
-
-    if (!strcmp(argv[1], "rvds"))
-        mode = OUTPUT_FMT_RVDS;
-    else if (!strcmp(argv[1], "gas"))
-        mode = OUTPUT_FMT_GAS;
-    else
-        f = argv[1];
+#endif
+#endif /* defined(__GNUC__) && __GNUC__ */
 
 
-    fd = open(f, O_RDONLY);
-
-    if (fd < 0)
-    {
-        perror("Unable to open file");
-        goto bail;
-    }
-
-    if (fstat(fd, &stat_buf))
-    {
-        perror("stat");
-        goto bail;
-    }
-
-    file_buf = malloc(stat_buf.st_size);
-
-    if (!file_buf)
-    {
-        perror("malloc");
-        goto bail;
-    }
-
-    if (read(fd, file_buf, stat_buf.st_size) != stat_buf.st_size)
-    {
-        perror("read");
-        goto bail;
-    }
-
-    if (close(fd))
-    {
-        perror("close");
-        goto bail;
-    }
-
-    res = parse_elf32(file_buf, stat_buf.st_size, mode);
-    //res = parse_coff(file_buf, stat_buf.st_size);
-    free(file_buf);
-
-    if (!res)
-        return EXIT_SUCCESS;
-
-bail:
-    return EXIT_FAILURE;
-}
-#endif
-#endif
-
-
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
 /*  See "Microsoft Portable Executable and Common Object File Format Specification"
     for reference.
 */
 #define get_le32(x) ((*(x)) | (*(x+1)) << 8 |(*(x+2)) << 16 | (*(x+3)) << 24 )
 #define get_le16(x) ((*(x)) | (*(x+1)) << 8)
 
-int parse_coff(unsigned __int8 *buf, size_t sz)
+int parse_coff(uint8_t *buf, size_t sz)
 {
     unsigned int nsections, symtab_ptr, symtab_sz, strtab_ptr;
     unsigned int sectionrawdata_ptr;
     unsigned int i;
-    unsigned __int8 *ptr;
-    unsigned __int32 symoffset;
-    FILE *fp;
+    uint8_t *ptr;
+    uint32_t symoffset;
 
     char **sectionlist;  //this array holds all section names in their correct order.
     //it is used to check if the symbol is in .bss or .data section.
 
     nsections = get_le16(buf + 2);
     symtab_ptr = get_le32(buf + 8);
     symtab_sz = get_le32(buf + 12);
     strtab_ptr = symtab_ptr + symtab_sz * 18;
 
     if (nsections > 96)
-        goto bail;
+    {
+        log_msg("Too many sections\n");
+        return 1;
+    }
 
-    sectionlist = malloc(nsections * sizeof * sectionlist);
+    sectionlist = malloc(nsections * sizeof(sectionlist));
+
+    if (sectionlist == NULL)
+    {
+        log_msg("Allocating first level of section list failed\n");
+        return 1;
+    }
 
     //log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections);
 
     /*
     The size of optional header is always zero for an obj file. So, the section header
     follows the file header immediately.
     */
 
@@ -575,34 +712,32 @@ int parse_coff(unsigned __int8 *buf, siz
 
     for (i = 0; i < nsections; i++)
     {
         char sectionname[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
         strncpy(sectionname, ptr, 8);
         //log_msg("COFF: Parsing section %s\n",sectionname);
 
         sectionlist[i] = malloc(strlen(sectionname) + 1);
+
+        if (sectionlist[i] == NULL)
+        {
+            log_msg("Allocating storage for %s failed\n", sectionname);
+            goto bail;
+        }
         strcpy(sectionlist[i], sectionname);
 
         if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20);
 
         ptr += 40;
     }
 
     //log_msg("COFF: Symbol table at offset %u\n", symtab_ptr);
     //log_msg("COFF: raw data pointer ofset for section .data is %u\n", sectionrawdata_ptr);
 
-    fp = fopen("vpx_asm_offsets.asm", "w");
-
-    if (fp == NULL)
-    {
-        perror("open file");
-        goto bail;
-    }
-
     /*  The compiler puts the data with non-zero offset in .data section, but puts the data with
         zero offset in .bss section. So, if the data in in .bss section, set offset=0.
         Note from Wiki: In an object module compiled from C, the bss section contains
         the local variables (but not functions) that were declared with the static keyword,
         except for those with non-zero initial values. (In C, static variables are initialized
         to zero by default.) It also contains the non-local (both extern and static) variables
         that are also initialized to zero (either explicitly or by default).
         */
@@ -615,58 +750,67 @@ int parse_coff(unsigned __int8 *buf, siz
         14          Type
         16          StorageClass
         17          NumberOfAuxSymbols
         */
     ptr = buf + symtab_ptr;
 
     for (i = 0; i < symtab_sz; i++)
     {
-        __int16 section = get_le16(ptr + 12); //section number
+        int16_t section = get_le16(ptr + 12); //section number
 
         if (section > 0 && ptr[16] == 2)
         {
             //if(section > 0 && ptr[16] == 3 && get_le32(ptr+8)) {
 
             if (get_le32(ptr))
             {
                 char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
                 strncpy(name, ptr, 8);
                 //log_msg("COFF: Parsing symbol %s\n",name);
-                fprintf(fp, "%-40s EQU ", name);
+                /* The 64bit Windows compiler doesn't prefix with an _.
+                 * Check what's there, and bump if necessary
+                 */
+                if (name[0] == '_')
+                    printf("%-40s EQU ", name + 1);
+                else
+                    printf("%-40s EQU ", name);
             }
             else
             {
                 //log_msg("COFF: Parsing symbol %s\n",
                 //        buf + strtab_ptr + get_le32(ptr+4));
-                fprintf(fp, "%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4));
+                if ((buf + strtab_ptr + get_le32(ptr + 4))[0] == '_')
+                    printf("%-40s EQU ",
+                           buf + strtab_ptr + get_le32(ptr + 4) + 1);
+                else
+                    printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4));
             }
 
             if (!(strcmp(sectionlist[section-1], ".bss")))
             {
                 symoffset = 0;
             }
             else
             {
                 symoffset = get_le32(buf + sectionrawdata_ptr + get_le32(ptr + 8));
             }
 
             //log_msg("      Section: %d\n",section);
             //log_msg("      Class:   %d\n",ptr[16]);
             //log_msg("      Address: %u\n",get_le32(ptr+8));
             //log_msg("      Offset: %u\n", symoffset);
 
-            fprintf(fp, "%5d\n", symoffset);
+            printf("%5d\n", symoffset);
         }
 
         ptr += 18;
     }
 
-    fprintf(fp, "    END\n");
-    fclose(fp);
+    printf("    END\n");
 
     for (i = 0; i < nsections; i++)
     {
         free(sectionlist[i]);
     }
 
     free(sectionlist);
 
@@ -677,80 +821,94 @@ bail:
     {
         free(sectionlist[i]);
     }
 
     free(sectionlist);
 
     return 1;
 }
+#endif /* defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) */
 
 int main(int argc, char **argv)
 {
-    int fd;
-    output_fmt_t mode;
+    output_fmt_t mode = OUTPUT_FMT_PLAIN;
     const char *f;
-    struct _stat stat_buf;
-    unsigned __int8 *file_buf;
+    uint8_t *file_buf;
     int res;
+    FILE *fp;
+    long int file_size;
 
     if (argc < 2 || argc > 3)
     {
         fprintf(stderr, "Usage: %s [output format] <obj file>\n\n", argv[0]);
-        fprintf(stderr, "  <obj file>\tELF format object file to parse\n");
+        fprintf(stderr, "  <obj file>\tobject file to parse\n");
         fprintf(stderr, "Output Formats:\n");
         fprintf(stderr, "  gas  - compatible with GNU assembler\n");
         fprintf(stderr, "  rvds - compatible with armasm\n");
         goto bail;
     }
 
     f = argv[2];
 
     if (!strcmp(argv[1], "rvds"))
         mode = OUTPUT_FMT_RVDS;
     else if (!strcmp(argv[1], "gas"))
         mode = OUTPUT_FMT_GAS;
     else
         f = argv[1];
 
-    if (_sopen_s(&fd, f, _O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE))
+    fp = fopen(f, "rb");
+
+    if (!fp)
     {
         perror("Unable to open file");
         goto bail;
     }
 
-    if (_fstat(fd, &stat_buf))
+    if (fseek(fp, 0, SEEK_END))
     {
         perror("stat");
         goto bail;
     }
 
-    file_buf = malloc(stat_buf.st_size);
+    file_size = ftell(fp);
+    file_buf = malloc(file_size);
 
     if (!file_buf)
     {
         perror("malloc");
         goto bail;
     }
 
-    if (_read(fd, file_buf, stat_buf.st_size) != stat_buf.st_size)
+    rewind(fp);
+
+    if (fread(file_buf, sizeof(char), file_size, fp) != file_size)
     {
         perror("read");
         goto bail;
     }
 
-    if (_close(fd))
+    if (fclose(fp))
     {
         perror("close");
         goto bail;
     }
 
-    res = parse_coff(file_buf, stat_buf.st_size);
+#if defined(__GNUC__) && __GNUC__
+#if defined(__MACH__)
+    res = parse_macho(file_buf, file_size);
+#elif defined(__ELF__)
+    res = parse_elf(file_buf, file_size, mode);
+#endif
+#endif
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
+    res = parse_coff(file_buf, file_size);
+#endif
 
     free(file_buf);
 
     if (!res)
         return EXIT_SUCCESS;
 
 bail:
     return EXIT_FAILURE;
 }
-#endif
new file mode 100644
--- /dev/null
+++ b/media/libvpx/compile_errors.patch
@@ -0,0 +1,39 @@
+diff --git a/media/libvpx/vpx/vp8.h b/media/libvpx/vpx/vp8.h
+--- a/media/libvpx/vpx/vp8.h
++++ b/media/libvpx/vpx/vp8.h
+@@ -41,33 +41,33 @@ enum vp8_com_control_id
+     VP8_SET_REFERENCE           = 1,    /**< pass in an external frame into decoder to be used as reference frame */
+     VP8_COPY_REFERENCE          = 2,    /**< get a copy of reference frame from the decoder */
+     VP8_SET_POSTPROC            = 3,    /**< set the decoder's post processing settings  */
+     VP8_SET_DBG_COLOR_REF_FRAME = 4,    /**< set the reference frames to color for each macroblock */
+     VP8_SET_DBG_COLOR_MB_MODES  = 5,    /**< set which macro block modes to color */
+     VP8_SET_DBG_COLOR_B_MODES   = 6,    /**< set which blocks modes to color */
+     VP8_SET_DBG_DISPLAY_MV      = 7,    /**< set which motion vector modes to draw */
+     VP8_COMMON_CTRL_ID_MAX,
+-    VP8_DECODER_CTRL_ID_START   = 256,
++    VP8_DECODER_CTRL_ID_START   = 256
+ };
+ 
+ /*!\brief post process flags
+  *
+  * The set of macros define VP8 decoder post processing flags
+  */
+ enum vp8_postproc_level
+ {
+     VP8_NOFILTERING             = 0,
+     VP8_DEBLOCK                 = 1<<0,
+     VP8_DEMACROBLOCK            = 1<<1,
+     VP8_ADDNOISE                = 1<<2,
+     VP8_DEBUG_TXT_FRAME_INFO    = 1<<3, /**< print frame information */
+     VP8_DEBUG_TXT_MBLK_MODES    = 1<<4, /**< print macro block modes over each macro block */
+     VP8_DEBUG_TXT_DC_DIFF       = 1<<5, /**< print dc diff for each macro block */
+-    VP8_DEBUG_TXT_RATE_INFO     = 1<<6, /**< print video rate info (encoder only) */
++    VP8_DEBUG_TXT_RATE_INFO     = 1<<6  /**< print video rate info (encoder only) */
+ };
+ 
+ /*!\brief post process flags
+  *
+  * This define a structure that describe the post processing settings. For
+  * the best objective measure (using the PSNR metric) set post_proc_flag
+  * to VP8_DEBLOCK and deblocking_level to 1.
+  */
--- a/media/libvpx/solaris.patch
+++ b/media/libvpx/solaris.patch
@@ -11,79 +11,16 @@ diff --git a/media/libvpx/vp8/common/loo
 +#define __inline inline
 +#endif
 +
  typedef unsigned char uc;
  
  static __inline signed char vp8_signed_char_clamp(int t)
  {
      t = (t < -128 ? -128 : t);
-diff --git a/media/libvpx/vpx/internal/vpx_codec_internal.h b/media/libvpx/vpx/internal/vpx_codec_internal.h
---- a/media/libvpx/vpx/internal/vpx_codec_internal.h
-+++ b/media/libvpx/vpx/internal/vpx_codec_internal.h
-@@ -316,17 +316,17 @@ struct vpx_codec_iface
- 
- /*!\brief Callback function pointer / user data pair storage */
- typedef struct vpx_codec_priv_cb_pair
- {
-     union
-     {
-         vpx_codec_put_frame_cb_fn_t    put_frame;
-         vpx_codec_put_slice_cb_fn_t    put_slice;
--    };
-+    } fn;
-     void                            *user_priv;
- } vpx_codec_priv_cb_pair_t;
- 
- 
- /*!\brief Instance private storage
-  *
-  * This structure is allocated by the algorithm's init function. It can be
-  * extended in one of two ways. First, a second, algorithm specific structure
-diff --git a/media/libvpx/vpx/src/vpx_decoder.c b/media/libvpx/vpx/src/vpx_decoder.c
---- a/media/libvpx/vpx/src/vpx_decoder.c
-+++ b/media/libvpx/vpx/src/vpx_decoder.c
-@@ -165,17 +165,17 @@ vpx_codec_err_t vpx_codec_register_put_f
- 
-     if (!ctx || !cb)
-         res = VPX_CODEC_INVALID_PARAM;
-     else if (!ctx->iface || !ctx->priv
-              || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
-         res = VPX_CODEC_ERROR;
-     else
-     {
--        ctx->priv->dec.put_frame_cb.put_frame = cb;
-+        ctx->priv->dec.put_frame_cb.fn.put_frame = cb;
-         ctx->priv->dec.put_frame_cb.user_priv = user_priv;
-         res = VPX_CODEC_OK;
-     }
- 
-     return SAVE_STATUS(ctx, res);
- }
- 
- 
-@@ -187,17 +187,17 @@ vpx_codec_err_t vpx_codec_register_put_s
- 
-     if (!ctx || !cb)
-         res = VPX_CODEC_INVALID_PARAM;
-     else if (!ctx->iface || !ctx->priv
-              || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
-         res = VPX_CODEC_ERROR;
-     else
-     {
--        ctx->priv->dec.put_slice_cb.put_slice = cb;
-+        ctx->priv->dec.put_slice_cb.fn.put_slice = cb;
-         ctx->priv->dec.put_slice_cb.user_priv = user_priv;
-         res = VPX_CODEC_OK;
-     }
- 
-     return SAVE_STATUS(ctx, res);
- }
- 
- 
 diff --git a/media/libvpx/vpx_ports/mem.h b/media/libvpx/vpx_ports/mem.h
 --- a/media/libvpx/vpx_ports/mem.h
 +++ b/media/libvpx/vpx_ports/mem.h
 @@ -9,17 +9,17 @@
   */
  
  
  #ifndef VPX_PORTS_MEM_H
@@ -167,18 +104,18 @@ diff --git a/media/libvpx/vpx_ports/x86.
  #if defined(__GNUC__) && __GNUC__
  #define x86_pause_hint()\
      __asm__ __volatile__ ("pause \n\t")
 +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
 +#define x86_pause_hint()\
 +    asm volatile ("pause \n\t")
  #else
  #if ARCH_X86_64
- /* No pause intrinsic for windows x64 */
- #define x86_pause_hint()
+ #define x86_pause_hint()\
+     _mm_pause();
  #else
  #define x86_pause_hint()\
      __asm pause
  #endif
 @@ -144,16 +171,29 @@ x87_set_control_word(unsigned short mode
  }
  static unsigned short
  x87_get_control_word(void)
--- a/media/libvpx/update.sh
+++ b/media/libvpx/update.sh
@@ -46,159 +46,230 @@ if [ $# -lt 1 ]; then
   echo You can configure these from objdir/$target with the following command:
   echo $ ..configure --target=$target --disable-vp8-encoder --disable-examples --disable-install-docs
   echo On Mac, you also need --enable-pic
   exit -1
 fi
 
 # These are relative to SDK source dir.
 commonFiles=(
+  vp8/vp8_cx_iface.c
+  vp8/vp8_dx_iface.c
   vp8/common/alloccommon.c
+  vp8/common/asm_com_offsets.c
   vp8/common/blockd.c
   vp8/common/debugmodes.c
+  vp8/common/defaultcoefcounts.c
   vp8/common/entropy.c
   vp8/common/entropymode.c
   vp8/common/entropymv.c
   vp8/common/extend.c
-  vp8/common/filter_c.c
+  vp8/common/filter.c
   vp8/common/findnearmv.c
-  vp8/common/generic/systemdependent.c
   vp8/common/idctllm.c
   vp8/common/invtrans.c
   vp8/common/loopfilter.c
   vp8/common/loopfilter_filters.c
   vp8/common/mbpitch.c
   vp8/common/modecont.c
   vp8/common/modecontext.c
   vp8/common/postproc.c
-  vp8/common/predictdc.c
   vp8/common/quant_common.c
   vp8/common/recon.c
   vp8/common/reconinter.c
   vp8/common/reconintra4x4.c
   vp8/common/reconintra.c
   vp8/common/setupintrarecon.c
   vp8/common/swapyv12buffer.c
   vp8/common/textblit.c
   vp8/common/treecoder.c
   vp8/common/arm/arm_systemdependent.c
   vp8/common/arm/bilinearfilter_arm.c
   vp8/common/arm/filter_arm.c
   vp8/common/arm/loopfilter_arm.c
   vp8/common/arm/reconintra_arm.c
-  vp8/common/arm/vpx_asm_offsets.c
   vp8/common/arm/neon/recon_neon.c
+  vp8/common/generic/systemdependent.c
   vp8/common/x86/loopfilter_x86.c
+  vp8/common/x86/recon_wrapper_sse2.c
   vp8/common/x86/vp8_asm_stubs.c
   vp8/common/x86/x86_systemdependent.c
   vp8/decoder/dboolhuff.c
   vp8/decoder/decodemv.c
   vp8/decoder/decodframe.c
   vp8/decoder/dequantize.c
   vp8/decoder/detokenize.c
-  vp8/decoder/reconintra_mt.c
-  vp8/decoder/generic/dsystemdependent.c
+  vp8/decoder/error_concealment.c
   vp8/decoder/idct_blk.c
   vp8/decoder/onyxd_if.c
+  vp8/decoder/reconintra_mt.c
   vp8/decoder/threading.c
   vp8/decoder/arm/arm_dsystemdependent.c
   vp8/decoder/arm/dequantize_arm.c
   vp8/decoder/arm/armv6/idct_blk_v6.c
   vp8/decoder/arm/neon/idct_blk_neon.c
+  vp8/decoder/generic/dsystemdependent.c
   vp8/decoder/x86/idct_blk_mmx.c
   vp8/decoder/x86/idct_blk_sse2.c
   vp8/decoder/x86/x86_dsystemdependent.c
-  vp8/vp8_dx_iface.c
+  vp8/encoder/asm_enc_offsets.c
+  vp8/encoder/bitstream.c
+  vp8/encoder/boolhuff.c
+  vp8/encoder/dct.c
+  vp8/encoder/encodeframe.c
+  vp8/encoder/encodeintra.c
+  vp8/encoder/encodemb.c
+  vp8/encoder/encodemv.c
+  vp8/encoder/ethreading.c
+  vp8/encoder/firstpass.c
+  vp8/encoder/lookahead.c
+  vp8/encoder/mcomp.c
+  vp8/encoder/modecosts.c
+  vp8/encoder/onyx_if.c
+  vp8/encoder/picklpf.c
+  vp8/encoder/pickinter.c
+  vp8/encoder/psnr.c
+  vp8/encoder/quantize.c
+  vp8/encoder/ratectrl.c
+  vp8/encoder/rdopt.c
+  vp8/encoder/sad_c.c
+  vp8/encoder/segmentation.c
+  vp8/encoder/temporal_filter.c
+  vp8/encoder/tokenize.c
+  vp8/encoder/treewriter.c
+  vp8/encoder/variance_c.c
+  vp8/encoder/arm/arm_csystemdependent.c
+  vp8/encoder/arm/dct_arm.c
+  vp8/encoder/arm/picklpf_arm.c
+  vp8/encoder/arm/variance_arm.c
+  vp8/encoder/generic/csystemdependent.c
+  vp8/encoder/x86/variance_mmx.c
+  vp8/encoder/x86/variance_sse2.c
+  vp8/encoder/x86/variance_ssse3.c
+  vp8/encoder/x86/x86_csystemdependent.c
   vpx/src/vpx_codec.c
   vpx/src/vpx_decoder.c
   vpx/src/vpx_decoder_compat.c
   vpx/src/vpx_encoder.c
   vpx/src/vpx_image.c
   vpx_mem/vpx_mem.c
   vpx_scale/generic/gen_scalers.c
-  vpx_scale/generic/scalesystemdependant.c
+  vpx_scale/generic/scalesystemdependent.c
   vpx_scale/generic/vpxscale.c
   vpx_scale/generic/yv12config.c
   vpx_scale/generic/yv12extend.c
   vp8/common/alloccommon.h
   vp8/common/blockd.h
   vp8/common/coefupdateprobs.h
   vp8/common/common.h
   vp8/common/common_types.h
   vp8/common/defaultcoefcounts.h
   vp8/common/entropy.h
   vp8/common/entropymode.h
   vp8/common/entropymv.h
   vp8/common/extend.h
+  vp8/common/filter.h
   vp8/common/findnearmv.h
   vp8/common/g_common.h
   vp8/common/header.h
   vp8/common/idct.h
   vp8/common/invtrans.h
   vp8/common/loopfilter.h
   vp8/common/modecont.h
   vp8/common/mv.h
   vp8/common/onyxc_int.h
   vp8/common/onyxd.h
   vp8/common/onyx.h
   vp8/common/postproc.h
   vp8/common/ppflags.h
   vp8/common/pragmas.h
-  vp8/common/predictdc.h
-  vp8/common/preproc.h
   vp8/common/quant_common.h
   vp8/common/recon.h
   vp8/common/reconinter.h
   vp8/common/reconintra4x4.h
   vp8/common/reconintra.h
   vp8/common/setupintrarecon.h
   vp8/common/subpixel.h
   vp8/common/swapyv12buffer.h
   vp8/common/systemdependent.h
   vp8/common/threading.h
   vp8/common/treecoder.h
   vp8/common/type_aliases.h
-  vp8/common/vpxerrors.h
+  vp8/common/arm/bilinearfilter_arm.h
   vp8/common/arm/idct_arm.h
   vp8/common/arm/loopfilter_arm.h
   vp8/common/arm/recon_arm.h
   vp8/common/arm/subpixel_arm.h
   vp8/common/x86/idct_x86.h
   vp8/common/x86/loopfilter_x86.h
   vp8/common/x86/postproc_x86.h
   vp8/common/x86/recon_x86.h
   vp8/common/x86/subpixel_x86.h
   vp8/decoder/dboolhuff.h
   vp8/decoder/decodemv.h
   vp8/decoder/decoderthreading.h
   vp8/decoder/dequantize.h
   vp8/decoder/detokenize.h
+  vp8/decoder/ec_types.h
+  vp8/decoder/error_concealment.h
   vp8/decoder/onyxd_int.h
   vp8/decoder/reconintra_mt.h
   vp8/decoder/treereader.h
-  vp8/decoder/arm/dboolhuff_arm.h
   vp8/decoder/arm/dequantize_arm.h
-  vp8/decoder/arm/detokenize_arm.h
   vp8/decoder/x86/dequantize_x86.h
+  vp8/encoder/asm_enc_offsets.h
+  vp8/encoder/bitstream.h
+  vp8/encoder/boolhuff.h
+  vp8/encoder/block.h
+  vp8/encoder/dct.h
+  vp8/encoder/encodeintra.h
+  vp8/encoder/encodemb.h
+  vp8/encoder/encodemv.h
+  vp8/encoder/firstpass.h
+  vp8/encoder/lookahead.h
+  vp8/encoder/mcomp.h
+  vp8/encoder/modecosts.h
+  vp8/encoder/onyx_int.h
+  vp8/encoder/pickinter.h
+  vp8/encoder/psnr.h
+  vp8/encoder/quantize.h
+  vp8/encoder/ratectrl.h
+  vp8/encoder/rdopt.h
+  vp8/encoder/segmentation.h
+  vp8/encoder/temporal_filter.h
+  vp8/encoder/tokenize.h
+  vp8/encoder/treewriter.h
+  vp8/encoder/variance.h
+  vp8/encoder/arm/dct_arm.h
+  vp8/encoder/arm/encodemb_arm.h
+  vp8/encoder/arm/quantize_arm.h
+  vp8/encoder/arm/variance_arm.h
+  vp8/encoder/x86/dct_x86.h
+  vp8/encoder/x86/encodemb_x86.h
+  vp8/encoder/x86/mcomp_x86.h
+  vp8/encoder/x86/quantize_x86.h
+  vp8/encoder/x86/temporal_filter_x86.h
+  vp8/encoder/x86/variance_x86.h
   vpx/internal/vpx_codec_internal.h
   vpx/vp8cx.h
   vpx/vp8dx.h
   vpx/vp8e.h
   vpx/vp8.h
   vpx/vpx_codec.h
   vpx/vpx_codec_impl_bottom.h
   vpx/vpx_codec_impl_top.h
   vpx/vpx_decoder_compat.h
   vpx/vpx_decoder.h
   vpx/vpx_encoder.h
   vpx/vpx_image.h
   vpx/vpx_integer.h
   vpx_mem/include/vpx_mem_intrnl.h
   vpx_mem/vpx_mem.h
   vpx_ports/arm_cpudetect.c
+  vpx_ports/asm_offsets.h
   vpx_ports/config.h
   vpx_ports/mem.h
   vpx_ports/vpx_timer.h
   vpx_ports/arm.h
   vpx_ports/x86.h
   vpx_scale/scale_mode.h
   vpx_scale/vpxscale.h
   vpx_scale/yv12config.h
@@ -235,17 +306,16 @@ commonFiles=(
   vp8/common/arm/neon/shortidct4x4llm_neon.asm
   vp8/common/arm/neon/sixtappredict4x4_neon.asm
   vp8/common/arm/neon/sixtappredict8x4_neon.asm
   vp8/common/arm/neon/sixtappredict8x8_neon.asm
   vp8/common/arm/neon/sixtappredict16x16_neon.asm
   vp8/common/arm/neon/recon16x16mb_neon.asm
   vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
   vp8/common/arm/neon/save_neon_reg.asm
-  vp8/decoder/arm/detokenize.asm
   vp8/decoder/arm/armv6/dequant_dc_idct_v6.asm
   vp8/decoder/arm/armv6/dequant_idct_v6.asm
   vp8/decoder/arm/armv6/dequantize_v6.asm
   vp8/decoder/arm/neon/idct_dequant_dc_full_2x_neon.asm
   vp8/decoder/arm/neon/idct_dequant_dc_0_2x_neon.asm
   vp8/decoder/arm/neon/dequant_idct_neon.asm
   vp8/decoder/arm/neon/idct_dequant_full_2x_neon.asm
   vp8/decoder/arm/neon/idct_dequant_0_2x_neon.asm
@@ -259,18 +329,66 @@ commonFiles=(
   vp8/common/x86/postproc_mmx.asm
   vp8/common/x86/postproc_sse2.asm
   vp8/common/x86/recon_mmx.asm
   vp8/common/x86/recon_sse2.asm
   vp8/common/x86/subpixel_mmx.asm
   vp8/common/x86/subpixel_sse2.asm
   vp8/common/x86/subpixel_ssse3.asm
   vp8/decoder/x86/dequantize_mmx.asm
+  vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm
+  vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm
+  vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
+  vp8/encoder/arm/armv6/vp8_fast_fdct4x4_armv6.asm
+  vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm
+  vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
+  vp8/encoder/arm/armv6/vp8_sad16x16_armv6.asm
+  vp8/encoder/arm/armv6/vp8_subtract_armv6.asm
+  vp8/encoder/arm/armv6/vp8_variance16x16_armv6.asm
+  vp8/encoder/arm/armv6/vp8_variance8x8_armv6.asm
+  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
+  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
+  vp8/encoder/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
+  vp8/encoder/arm/armv6/walsh_v6.asm
+  vp8/encoder/arm/neon/fastfdct4x4_neon.asm
+  vp8/encoder/arm/neon/fastfdct8x4_neon.asm
+  vp8/encoder/arm/neon/fastquantizeb_neon.asm
+  vp8/encoder/arm/neon/sad16_neon.asm
+  vp8/encoder/arm/neon/sad8_neon.asm
+  vp8/encoder/arm/neon/shortfdct_neon.asm
+  vp8/encoder/arm/neon/subtract_neon.asm
+  vp8/encoder/arm/neon/variance_neon.asm
+  vp8/encoder/arm/neon/vp8_memcpy_neon.asm
+  vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
+  vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
+  vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
+  vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
+  vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
+  vp8/encoder/x86/dct_mmx.asm
+  vp8/encoder/x86/dct_sse2.asm
+  vp8/encoder/x86/encodeopt.asm
+  vp8/encoder/x86/fwalsh_sse2.asm
+  vp8/encoder/x86/quantize_mmx.asm
+  vp8/encoder/x86/quantize_sse2.asm
+  vp8/encoder/x86/quantize_ssse3.asm
+  vp8/encoder/x86/quantize_sse4.asm
+  vp8/encoder/x86/sad_mmx.asm
+  vp8/encoder/x86/sad_sse2.asm
+  vp8/encoder/x86/sad_sse3.asm
+  vp8/encoder/x86/sad_ssse3.asm
+  vp8/encoder/x86/sad_sse4.asm
+  vp8/encoder/x86/subtract_mmx.asm
+  vp8/encoder/x86/subtract_sse2.asm
+  vp8/encoder/x86/temporal_filter_apply_sse2.asm
+  vp8/encoder/x86/variance_impl_mmx.asm
+  vp8/encoder/x86/variance_impl_sse2.asm
+  vp8/encoder/x86/variance_impl_ssse3.asm
   vpx_ports/emms.asm
   vpx_ports/x86_abi_support.asm
+  vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm
   build/make/ads2gas.pl
   build/make/obj_int_extract.c
   LICENSE
   PATENTS
 )
 
 # configure files specific to x86-win32-vs8
 cp $1/objdir/x86-win32-vs8/vpx_config.c vpx_config_x86-win32-vs8.c
@@ -313,22 +431,10 @@ for f in ${commonFiles[@]}
 do
   mkdir -p -v `dirname $f`
   cp -v $1/$f $f
 done
 
 # Patch to compile with Sun Studio on Solaris
 patch -p3 < solaris.patch
 
-# Patch to fix link with xcode4
-patch -p1 < xcode4.patch
-
-# Patch to fix data race on global function pointers
-patch -p3 < bug640935.patch
-
-# Patch to avoid text relocations on ARM
-patch -p3 < bug646815.patch
-
-# Patch to fix alignment problems with using ARM asm in Thumb mode.
-patch -p3 < bug666931.patch
-
-# Patch to make chroma planes 16-byte aligned.
-patch -p3 < bug671818.patch
+# Patch to fix errors including C headers in C++
+patch -p3 < compile_errors.patch
--- a/media/libvpx/vp8/common/alloccommon.c
+++ b/media/libvpx/vp8/common/alloccommon.c
@@ -11,47 +11,51 @@
 
 #include "vpx_ports/config.h"
 #include "blockd.h"
 #include "vpx_mem/vpx_mem.h"
 #include "onyxc_int.h"
 #include "findnearmv.h"
 #include "entropymode.h"
 #include "systemdependent.h"
-#include "vpxerrors.h"
 
 
 extern  void vp8_init_scan_order_mask();
 
-void vp8_update_mode_info_border(MODE_INFO *mi, int rows, int cols)
+static void update_mode_info_border(MODE_INFO *mi, int rows, int cols)
 {
     int i;
     vpx_memset(mi - cols - 2, 0, sizeof(MODE_INFO) * (cols + 1));
 
     for (i = 0; i < rows; i++)
     {
+        /* TODO(holmer): Bug? This updates the last element of each row
+         * rather than the border element!
+         */
         vpx_memset(&mi[i*cols-1], 0, sizeof(MODE_INFO));
     }
 }
 
 void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
 {
     int i;
 
     for (i = 0; i < NUM_YV12_BUFFERS; i++)
         vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
 
     vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
     vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
 
     vpx_free(oci->above_context);
     vpx_free(oci->mip);
+    vpx_free(oci->prev_mip);
 
     oci->above_context = 0;
     oci->mip = 0;
+    oci->prev_mip = 0;
 
 }
 
 int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
 {
     int i;
 
     vp8_de_alloc_frame_buffers(oci);
@@ -61,121 +65,139 @@ int vp8_alloc_frame_buffers(VP8_COMMON *
         width += 16 - (width & 0xf);
 
     if ((height & 0xf) != 0)
         height += 16 - (height & 0xf);
 
 
     for (i = 0; i < NUM_YV12_BUFFERS; i++)
     {
-      oci->fb_idx_ref_cnt[0] = 0;
-
-      if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i],  width, height, VP8BORDERINPIXELS) < 0)
+        oci->fb_idx_ref_cnt[i] = 0;
+        oci->yv12_fb[i].flags = 0;
+        if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
         {
             vp8_de_alloc_frame_buffers(oci);
-            return ALLOC_FAILURE;
+            return 1;
         }
     }
 
     oci->new_fb_idx = 0;
     oci->lst_fb_idx = 1;
     oci->gld_fb_idx = 2;
     oci->alt_fb_idx = 3;
 
     oci->fb_idx_ref_cnt[0] = 1;
     oci->fb_idx_ref_cnt[1] = 1;
     oci->fb_idx_ref_cnt[2] = 1;
     oci->fb_idx_ref_cnt[3] = 1;
 
     if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame,   width, 16, VP8BORDERINPIXELS) < 0)
     {
         vp8_de_alloc_frame_buffers(oci);
-        return ALLOC_FAILURE;
+        return 1;
     }
 
     if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0)
     {
         vp8_de_alloc_frame_buffers(oci);
-        return ALLOC_FAILURE;
+        return 1;
     }
 
     oci->mb_rows = height >> 4;
     oci->mb_cols = width >> 4;
     oci->MBs = oci->mb_rows * oci->mb_cols;
     oci->mode_info_stride = oci->mb_cols + 1;
     oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
 
     if (!oci->mip)
     {
         vp8_de_alloc_frame_buffers(oci);
-        return ALLOC_FAILURE;
+        return 1;
     }
 
     oci->mi = oci->mip + oci->mode_info_stride + 1;
 
+    /* allocate memory for last frame MODE_INFO array */
+#if CONFIG_ERROR_CONCEALMENT
+    oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
+
+    if (!oci->prev_mip)
+    {
+        vp8_de_alloc_frame_buffers(oci);
+        return 1;
+    }
+
+    oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
+#else
+    oci->prev_mip = NULL;
+    oci->prev_mi = NULL;
+#endif
 
     oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
 
     if (!oci->above_context)
     {
         vp8_de_alloc_frame_buffers(oci);
-        return ALLOC_FAILURE;
+        return 1;
     }
 
-    vp8_update_mode_info_border(oci->mi, oci->mb_rows, oci->mb_cols);
+    update_mode_info_border(oci->mi, oci->mb_rows, oci->mb_cols);
+#if CONFIG_ERROR_CONCEALMENT
+    update_mode_info_border(oci->prev_mi, oci->mb_rows, oci->mb_cols);
+#endif
 
     return 0;
 }
 void vp8_setup_version(VP8_COMMON *cm)
 {
     switch (cm->version)
     {
     case 0:
         cm->no_lpf = 0;
-        cm->simpler_lpf = 0;
+        cm->filter_type = NORMAL_LOOPFILTER;
         cm->use_bilinear_mc_filter = 0;
         cm->full_pixel = 0;
         break;
     case 1:
         cm->no_lpf = 0;
-        cm->simpler_lpf = 1;
+        cm->filter_type = SIMPLE_LOOPFILTER;
         cm->use_bilinear_mc_filter = 1;
         cm->full_pixel = 0;
         break;
     case 2:
         cm->no_lpf = 1;
-        cm->simpler_lpf = 0;
+        cm->filter_type = NORMAL_LOOPFILTER;
         cm->use_bilinear_mc_filter = 1;
         cm->full_pixel = 0;
         break;
     case 3:
         cm->no_lpf = 1;
-        cm->simpler_lpf = 1;
+        cm->filter_type = SIMPLE_LOOPFILTER;
         cm->use_bilinear_mc_filter = 1;
         cm->full_pixel = 1;
         break;
     default:
         /*4,5,6,7 are reserved for future use*/
         cm->no_lpf = 0;
-        cm->simpler_lpf = 0;
+        cm->filter_type = NORMAL_LOOPFILTER;
         cm->use_bilinear_mc_filter = 0;
         cm->full_pixel = 0;
         break;
     }
 }
 void vp8_create_common(VP8_COMMON *oci)
 {
     vp8_machine_specific_config(oci);
     vp8_default_coef_probs(oci);
     vp8_init_mbmode_probs(oci);
     vp8_default_bmode_probs(oci->fc.bmode_prob);
 
     oci->mb_no_coeff_skip = 1;
     oci->no_lpf = 0;
-    oci->simpler_lpf = 0;
+    oci->filter_type = NORMAL_LOOPFILTER;
     oci->use_bilinear_mc_filter = 0;
     oci->full_pixel = 0;
     oci->multi_token_partition = ONE_PARTITION;
     oci->clr_type = REG_YUV;
     oci->clamp_type = RECON_CLAMP_REQUIRED;
 
     /* Initialise reference frame sign bias structure to defaults */
     vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
--- a/media/libvpx/vp8/common/arm/arm_systemdependent.c
+++ b/media/libvpx/vp8/common/arm/arm_systemdependent.c
@@ -6,37 +6,40 @@
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 
 #include "vpx_ports/config.h"
 #include "vpx_ports/arm.h"
-#include "g_common.h"
-#include "pragmas.h"
-#include "subpixel.h"
-#include "loopfilter.h"
-#include "recon.h"
-#include "idct.h"
-#include "onyxc_int.h"
+#include "vp8/common/g_common.h"
+#include "vp8/common/pragmas.h"
+#include "vp8/common/subpixel.h"
+#include "vp8/common/loopfilter.h"
+#include "vp8/common/recon.h"
+#include "vp8/common/idct.h"
+#include "vp8/common/onyxc_int.h"
 
 void vp8_arch_arm_common_init(VP8_COMMON *ctx)
 {
 #if CONFIG_RUNTIME_CPU_DETECT
     VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
     int flags = arm_cpu_caps();
-    int has_edsp = flags & HAS_EDSP;
-    int has_media = flags & HAS_MEDIA;
-    int has_neon = flags & HAS_NEON;
     rtcd->flags = flags;
 
     /* Override default functions with fastest ones for this CPU. */
+#if HAVE_ARMV5TE
+    if (flags & HAS_EDSP)
+    {
+    }
+#endif
+
 #if HAVE_ARMV6
-    if (has_media)
+    if (flags & HAS_MEDIA)
     {
         rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_armv6;
         rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_armv6;
         rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_armv6;
         rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_armv6;
         rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
         rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_armv6;
         rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_armv6;
@@ -46,32 +49,34 @@ void vp8_arch_arm_common_init(VP8_COMMON
         rtcd->idct.idct16       = vp8_short_idct4x4llm_v6_dual;
         rtcd->idct.iwalsh1      = vp8_short_inv_walsh4x4_1_v6;
         rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_v6;
 
         rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
         rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_armv6;
         rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
         rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_armv6;
-        rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_armv6;
+        rtcd->loopfilter.simple_mb_v =
+                vp8_loop_filter_simple_vertical_edge_armv6;
         rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_armv6;
-        rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_armv6;
+        rtcd->loopfilter.simple_mb_h =
+                vp8_loop_filter_simple_horizontal_edge_armv6;
         rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_armv6;
 
         rtcd->recon.copy16x16   = vp8_copy_mem16x16_v6;
         rtcd->recon.copy8x8     = vp8_copy_mem8x8_v6;
         rtcd->recon.copy8x4     = vp8_copy_mem8x4_v6;
         rtcd->recon.recon       = vp8_recon_b_armv6;
         rtcd->recon.recon2      = vp8_recon2b_armv6;
         rtcd->recon.recon4      = vp8_recon4b_armv6;
     }
 #endif
 
 #if HAVE_ARMV7
-    if (has_neon)
+    if (flags & HAS_NEON)
     {
         rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_neon;
         rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_neon;
         rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_neon;
         rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_neon;
         rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
         rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_neon;
         rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_neon;
--- a/media/libvpx/vp8/common/arm/armv6/bilinearfilter_v6.asm
+++ b/media/libvpx/vp8/common/arm/armv6/bilinearfilter_v6.asm
@@ -10,43 +10,43 @@
 
 
     EXPORT  |vp8_filter_block2d_bil_first_pass_armv6|
     EXPORT  |vp8_filter_block2d_bil_second_pass_armv6|
 
     AREA    |.text|, CODE, READONLY  ; name this block of code
 
 ;-------------------------------------
-; r0    unsigned char *src_ptr,
-; r1    unsigned short *output_ptr,
-; r2    unsigned int src_pixels_per_line,
-; r3    unsigned int output_height,
-; stack    unsigned int output_width,
-; stack    const short *vp8_filter
+; r0    unsigned char  *src_ptr,
+; r1    unsigned short *dst_ptr,
+; r2    unsigned int    src_pitch,
+; r3    unsigned int    height,
+; stack unsigned int    width,
+; stack const short    *vp8_filter
 ;-------------------------------------
 ; The output is transposed stroed in output array to make it easy for second pass filtering.
 |vp8_filter_block2d_bil_first_pass_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
     ldr     r11, [sp, #40]                  ; vp8_filter address
-    ldr     r4, [sp, #36]                   ; output width
+    ldr     r4, [sp, #36]                   ; width
 
     mov     r12, r3                         ; outer-loop counter
-    sub     r2, r2, r4                      ; src increment for height loop
 
-    ;;IF ARCHITECTURE=6
-    pld     [r0]
-    ;;ENDIF
+    add     r7, r2, r4                      ; preload next row
+    pld     [r0, r7]
+
+    sub     r2, r2, r4                      ; src increment for height loop
 
     ldr     r5, [r11]                       ; load up filter coefficients
 
-    mov     r3, r3, lsl #1                  ; output_height*2
+    mov     r3, r3, lsl #1                  ; height*2
     add     r3, r3, #2                      ; plus 2 to make output buffer 4-bit aligned since height is actually (height+1)
 
-    mov     r11, r1                         ; save output_ptr for each row
+    mov     r11, r1                         ; save dst_ptr for each row
 
     cmp     r5, #128                        ; if filter coef = 128, then skip the filter
     beq     bil_null_1st_filter
 
 |bil_height_loop_1st_v6|
     ldrb    r6, [r0]                        ; load source data
     ldrb    r7, [r0, #1]
     ldrb    r8, [r0, #2]
@@ -91,19 +91,18 @@
     ldrneb  r7, [r0, #1]
     ldrneb  r8, [r0, #2]
 
     bne     bil_width_loop_1st_v6
 
     add     r0, r0, r2                      ; move to next input row
     subs    r12, r12, #1
 
-    ;;IF ARCHITECTURE=6
-    pld     [r0]
-    ;;ENDIF
+    add     r9, r2, r4, lsl #1              ; adding back block width
+    pld     [r0, r9]                        ; preload next row
 
     add     r11, r11, #2                    ; move over to next column
     mov     r1, r11
 
     bne     bil_height_loop_1st_v6
 
     ldmia   sp!, {r4 - r11, pc}
 
@@ -135,27 +134,27 @@
 
     ldmia   sp!, {r4 - r11, pc}
 
     ENDP  ; |vp8_filter_block2d_bil_first_pass_armv6|
 
 
 ;---------------------------------
 ; r0    unsigned short *src_ptr,
-; r1    unsigned char *output_ptr,
-; r2    int output_pitch,
-; r3    unsigned int  output_height,
-; stack unsigned int  output_width,
-; stack const short *vp8_filter
+; r1    unsigned char  *dst_ptr,
+; r2    int             dst_pitch,
+; r3    unsigned int    height,
+; stack unsigned int    width,
+; stack const short    *vp8_filter
 ;---------------------------------
 |vp8_filter_block2d_bil_second_pass_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
     ldr     r11, [sp, #40]                  ; vp8_filter address
-    ldr     r4, [sp, #36]                   ; output width
+    ldr     r4, [sp, #36]                   ; width
 
     ldr     r5, [r11]                       ; load up filter coefficients
     mov     r12, r4                         ; outer-loop counter = width, since we work on transposed data matrix
     mov     r11, r1
 
     cmp     r5, #128                        ; if filter coef = 128, then skip the filter
     beq     bil_null_2nd_filter
 
--- a/media/libvpx/vp8/common/arm/armv6/copymem16x16_v6.asm
+++ b/media/libvpx/vp8/common/arm/armv6/copymem16x16_v6.asm
@@ -17,19 +17,17 @@
     AREA    Block, CODE, READONLY ; name this block of code
 ;void copy_mem16x16_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 |vp8_copy_mem16x16_v6| PROC
     stmdb       sp!, {r4 - r7}
     ;push   {r4-r7}
 
     ;preload
-    pld     [r0]
-    pld     [r0, r1]
-    pld     [r0, r1, lsl #1]
+    pld     [r0, #31]                ; preload for next 16x16 block
 
     ands    r4, r0, #15
     beq     copy_mem16x16_fast
 
     ands    r4, r0, #7
     beq     copy_mem16x16_8
 
     ands    r4, r0, #3
@@ -85,16 +83,18 @@ copy_mem16x16_1_loop
 
     add     r2, r2, r3
 
     ldrneb  r4, [r0]
     ldrneb  r5, [r0, #1]
     ldrneb  r6, [r0, #2]
     ldrneb  r7, [r0, #3]
 
+    pld     [r0, #31]               ; preload for next 16x16 block
+
     bne     copy_mem16x16_1_loop
 
     ldmia       sp!, {r4 - r7}
     ;pop        {r4-r7}
     mov     pc, lr
 
 ;copy 4 bytes each time
 copy_mem16x16_4
@@ -116,16 +116,18 @@ copy_mem16x16_4_loop
 
     add     r2, r2, r3
 
     ldrne   r4, [r0]
     ldrne   r5, [r0, #4]
     ldrne   r6, [r0, #8]
     ldrne   r7, [r0, #12]
 
+    pld     [r0, #31]               ; preload for next 16x16 block
+
     bne     copy_mem16x16_4_loop
 
     ldmia       sp!, {r4 - r7}
     ;pop        {r4-r7}
     mov     pc, lr
 
 ;copy 8 bytes each time
 copy_mem16x16_8
@@ -143,16 +145,17 @@ copy_mem16x16_8_loop
 
     stmia   r2!, {r4-r5}
     subs    r12, r12, #1
     ;stm        r2, {r4-r5}
     stmia   r2!, {r6-r7}
 
     add     r2, r2, r3
 
+    pld     [r0, #31]               ; preload for next 16x16 block
     bne     copy_mem16x16_8_loop
 
     ldmia       sp!, {r4 - r7}
     ;pop        {r4-r7}
     mov     pc, lr
 
 ;copy 16 bytes each time
 copy_mem16x16_fast
@@ -166,16 +169,17 @@ copy_mem16x16_fast_loop
     ;ldm        r0, {r4-r7}
     add     r0, r0, r1
 
     subs    r12, r12, #1
     stmia   r2, {r4-r7}
     ;stm        r2, {r4-r7}
     add     r2, r2, r3
 
+    pld     [r0, #31]               ; preload for next 16x16 block
     bne     copy_mem16x16_fast_loop
 
     ldmia       sp!, {r4 - r7}
     ;pop        {r4-r7}
     mov     pc, lr
 
     ENDP  ; |vp8_copy_mem16x16_v6|
 
--- a/media/libvpx/vp8/common/arm/armv6/filter_v6.asm
+++ b/media/libvpx/vp8/common/arm/armv6/filter_v6.asm
@@ -5,16 +5,18 @@
 ;  that can be found in the LICENSE file in the root of the source
 ;  tree. An additional intellectual property rights grant can be found
 ;  in the file PATENTS.  All contributing project authors may
 ;  be found in the AUTHORS file in the root of the source tree.
 ;
 
 
     EXPORT  |vp8_filter_block2d_first_pass_armv6|
+    EXPORT  |vp8_filter_block2d_first_pass_16x16_armv6|
+    EXPORT  |vp8_filter_block2d_first_pass_8x8_armv6|
     EXPORT  |vp8_filter_block2d_second_pass_armv6|
     EXPORT  |vp8_filter4_block2d_second_pass_armv6|
     EXPORT  |vp8_filter_block2d_first_pass_only_armv6|
     EXPORT  |vp8_filter_block2d_second_pass_only_armv6|
 
     AREA    |.text|, CODE, READONLY  ; name this block of code
 ;-------------------------------------
 ; r0    unsigned char *src_ptr
@@ -35,21 +37,16 @@
     sub     r2, r2, r3                      ; inside loop increments input array,
                                             ; so the height loop only needs to add
                                             ; r2 - width to the input pointer
 
     mov     r3, r3, lsl #1                  ; multiply width by 2 because using shorts
     add     r12, r3, #16                    ; square off the output
     sub     sp, sp, #4
 
-    ;;IF ARCHITECTURE=6
-    ;pld        [r0, #-2]
-    ;;pld       [r0, #30]
-    ;;ENDIF
-
     ldr     r4, [r11]                       ; load up packed filter coefficients
     ldr     r5, [r11, #4]
     ldr     r6, [r11, #8]
 
     str     r1, [sp]                        ; push destination to stack
     mov     r7, r7, lsl #16                 ; height is top part of counter
 
 ; six tap filter
@@ -96,29 +93,210 @@
 
     strh    lr, [r1], r12                   ; result is transposed and stored, which
                                             ; will make second pass filtering easier.
     ldrneb  r10, [r0], #2
     strh    r11, [r1], r12
 
     bne     width_loop_1st_6
 
-    ;;add       r9, r2, #30                 ; attempt to load 2 adjacent cache lines
-    ;;IF ARCHITECTURE=6
-    ;pld        [r0, r2]
-    ;;pld       [r0, r9]
-    ;;ENDIF
+    ldr     r1, [sp]                        ; load and update dst address
+    subs    r7, r7, #0x10000
+    add     r0, r0, r2                      ; move to next input line
+
+    add     r1, r1, #2                      ; move over to next column
+    str     r1, [sp]
+
+    bne     height_loop_1st_6
+
+    add     sp, sp, #4
+    ldmia   sp!, {r4 - r11, pc}
+
+    ENDP
+
+; --------------------------
+; 16x16 version
+; -----------------------------
+|vp8_filter_block2d_first_pass_16x16_armv6| PROC
+    stmdb   sp!, {r4 - r11, lr}
+
+    ldr     r11, [sp, #40]                  ; vp8_filter address
+    ldr     r7, [sp, #36]                   ; output height
+
+    add     r4, r2, #18                     ; preload next low
+    pld     [r0, r4]
+
+    sub     r2, r2, r3                      ; inside loop increments input array,
+                                            ; so the height loop only needs to add
+                                            ; r2 - width to the input pointer
+
+    mov     r3, r3, lsl #1                  ; multiply width by 2 because using shorts
+    add     r12, r3, #16                    ; square off the output
+    sub     sp, sp, #4
+
+    ldr     r4, [r11]                       ; load up packed filter coefficients
+    ldr     r5, [r11, #4]
+    ldr     r6, [r11, #8]
+
+    str     r1, [sp]                        ; push destination to stack
+    mov     r7, r7, lsl #16                 ; height is top part of counter
+
+; six tap filter
+|height_loop_1st_16_6|
+    ldrb    r8, [r0, #-2]                   ; load source data
+    ldrb    r9, [r0, #-1]
+    ldrb    r10, [r0], #2
+    orr     r7, r7, r3, lsr #2              ; construct loop counter
+
+|width_loop_1st_16_6|
+    ldrb    r11, [r0, #-1]
+
+    pkhbt   lr, r8, r9, lsl #16             ; r9 | r8
+    pkhbt   r8, r9, r10, lsl #16            ; r10 | r9
+
+    ldrb    r9, [r0]
+
+    smuad   lr, lr, r4                      ; apply the filter
+    pkhbt   r10, r10, r11, lsl #16          ; r11 | r10
+    smuad   r8, r8, r4
+    pkhbt   r11, r11, r9, lsl #16           ; r9 | r11
+
+    smlad   lr, r10, r5, lr
+    ldrb    r10, [r0, #1]
+    smlad   r8, r11, r5, r8
+    ldrb    r11, [r0, #2]
+
+    sub     r7, r7, #1
+
+    pkhbt   r9, r9, r10, lsl #16            ; r10 | r9
+    pkhbt   r10, r10, r11, lsl #16          ; r11 | r10
+
+    smlad   lr, r9, r6, lr
+    smlad   r11, r10, r6, r8
+
+    ands    r10, r7, #0xff                  ; test loop counter
+
+    add     lr, lr, #0x40                   ; round_shift_and_clamp
+    ldrneb  r8, [r0, #-2]                   ; load data for next loop
+    usat    lr, #8, lr, asr #7
+    add     r11, r11, #0x40
+    ldrneb  r9, [r0, #-1]
+    usat    r11, #8, r11, asr #7
+
+    strh    lr, [r1], r12                   ; result is transposed and stored, which
+                                            ; will make second pass filtering easier.
+    ldrneb  r10, [r0], #2
+    strh    r11, [r1], r12
+
+    bne     width_loop_1st_16_6
 
     ldr     r1, [sp]                        ; load and update dst address
     subs    r7, r7, #0x10000
     add     r0, r0, r2                      ; move to next input line
+
+    add     r11, r2, #34                    ; adding back block width(=16)
+    pld     [r0, r11]                       ; preload next low
+
     add     r1, r1, #2                      ; move over to next column
     str     r1, [sp]
 
-    bne     height_loop_1st_6
+    bne     height_loop_1st_16_6
+
+    add     sp, sp, #4
+    ldmia   sp!, {r4 - r11, pc}
+
+    ENDP
+
+; --------------------------
+; 8x8 version
+; -----------------------------
+|vp8_filter_block2d_first_pass_8x8_armv6| PROC
+    stmdb   sp!, {r4 - r11, lr}
+
+    ldr     r11, [sp, #40]                  ; vp8_filter address
+    ldr     r7, [sp, #36]                   ; output height
+
+    add     r4, r2, #10                     ; preload next low
+    pld     [r0, r4]
+
+    sub     r2, r2, r3                      ; inside loop increments input array,
+                                            ; so the height loop only needs to add
+                                            ; r2 - width to the input pointer
+
+    mov     r3, r3, lsl #1                  ; multiply width by 2 because using shorts
+    add     r12, r3, #16                    ; square off the output
+    sub     sp, sp, #4
+
+    ldr     r4, [r11]                       ; load up packed filter coefficients
+    ldr     r5, [r11, #4]
+    ldr     r6, [r11, #8]
+
+    str     r1, [sp]                        ; push destination to stack
+    mov     r7, r7, lsl #16                 ; height is top part of counter
+
+; six tap filter
+|height_loop_1st_8_6|
+    ldrb    r8, [r0, #-2]                   ; load source data
+    ldrb    r9, [r0, #-1]
+    ldrb    r10, [r0], #2
+    orr     r7, r7, r3, lsr #2              ; construct loop counter
+
+|width_loop_1st_8_6|
+    ldrb    r11, [r0, #-1]
+
+    pkhbt   lr, r8, r9, lsl #16             ; r9 | r8
+    pkhbt   r8, r9, r10, lsl #16            ; r10 | r9
+
+    ldrb    r9, [r0]
+
+    smuad   lr, lr, r4                      ; apply the filter
+    pkhbt   r10, r10, r11, lsl #16          ; r11 | r10
+    smuad   r8, r8, r4
+    pkhbt   r11, r11, r9, lsl #16           ; r9 | r11
+
+    smlad   lr, r10, r5, lr
+    ldrb    r10, [r0, #1]
+    smlad   r8, r11, r5, r8
+    ldrb    r11, [r0, #2]
+
+    sub     r7, r7, #1
+
+    pkhbt   r9, r9, r10, lsl #16            ; r10 | r9
+    pkhbt   r10, r10, r11, lsl #16          ; r11 | r10
+
+    smlad   lr, r9, r6, lr
+    smlad   r11, r10, r6, r8
+
+    ands    r10, r7, #0xff                  ; test loop counter
+
+    add     lr, lr, #0x40                   ; round_shift_and_clamp
+    ldrneb  r8, [r0, #-2]                   ; load data for next loop
+    usat    lr, #8, lr, asr #7
+    add     r11, r11, #0x40
+    ldrneb  r9, [r0, #-1]
+    usat    r11, #8, r11, asr #7
+
+    strh    lr, [r1], r12                   ; result is transposed and stored, which
+                                            ; will make second pass filtering easier.
+    ldrneb  r10, [r0], #2
+    strh    r11, [r1], r12
+
+    bne     width_loop_1st_8_6
+
+    ldr     r1, [sp]                        ; load and update dst address
+    subs    r7, r7, #0x10000
+    add     r0, r0, r2                      ; move to next input line
+
+    add     r11, r2, #18                    ; adding back block width(=8)
+    pld     [r0, r11]                       ; preload next low
+
+    add     r1, r1, #2                      ; move over to next column
+    str     r1, [sp]
+
+    bne     height_loop_1st_8_6
 
     add     sp, sp, #4
     ldmia   sp!, {r4 - r11, pc}
 
     ENDP
 
 ;---------------------------------
 ; r0    short         *src_ptr,
@@ -257,16 +435,20 @@
 ; r2    unsigned int src_pixels_per_line
 ; r3    unsigned int cnt,
 ; stack unsigned int output_pitch,
 ; stack const short *vp8_filter
 ;------------------------------------
 |vp8_filter_block2d_first_pass_only_armv6| PROC
     stmdb   sp!, {r4 - r11, lr}
 
+    add     r7, r2, r3                      ; preload next low
+    add     r7, r7, #2
+    pld     [r0, r7]
+
     ldr     r4, [sp, #36]                   ; output pitch
     ldr     r11, [sp, #40]                  ; HFilter address
     sub     sp, sp, #8
 
     mov     r7, r3
     sub     r2, r2, r3                      ; inside loop increments input array,
                                             ; so the height loop only needs to add
                                             ; r2 - width to the input pointer
@@ -325,26 +507,25 @@
     usat    r10, #8, r10, asr #7
 
     ldrneb  r9, [r0, #-1]
     strb    r10, [r1], #1
     ldrneb  r10, [r0], #2
 
     bne     width_loop_1st_only_6
 
-    ;;add       r9, r2, #30                 ; attempt to load 2 adjacent cache lines
-    ;;IF ARCHITECTURE=6
-    ;pld        [r0, r2]
-    ;;pld       [r0, r9]
-    ;;ENDIF
-
     ldr     lr, [sp]                        ; load back output pitch
     ldr     r12, [sp, #4]                   ; load back output pitch
     subs    r7, r7, #1
     add     r0, r0, r12                     ; updata src for next loop
+
+    add     r11, r12, r3                    ; preload next low
+    add     r11, r11, #2
+    pld     [r0, r11]
+
     add     r1, r1, lr                      ; update dst for next loop
 
     bne     height_loop_1st_only_6
 
     add     sp, sp, #8
     ldmia   sp!, {r4 - r11, pc}
     ENDP  ; |vp8_filter_block2d_first_pass_only_armv6|
 
--- a/media/libvpx/vp8/common/arm/armv6/loopfilter_v6.asm
+++ b/media/libvpx/vp8/common/arm/armv6/loopfilter_v6.asm
@@ -48,43 +48,44 @@
 
 
 src         RN  r0
 pstep       RN  r1
 count       RN  r5
 
 ;r0     unsigned char *src_ptr,
 ;r1     int src_pixel_step,
-;r2     const char *flimit,
+;r2     const char *blimit,
 ;r3     const char *limit,
 ;stack  const char *thresh,
 ;stack  int  count
 
-;Note: All 16 elements in flimit are equal. So, in the code, only one load is needed
-;for flimit. Same way applies to limit and thresh.
-
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 |vp8_loop_filter_horizontal_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
     sub         src, src, pstep, lsl #2     ; move src pointer down by 4 lines
     ldr         count, [sp, #40]            ; count for 8-in-parallel
     ldr         r6, [sp, #36]               ; load thresh address
     sub         sp, sp, #16                 ; create temp buffer
 
     ldr         r9, [src], pstep            ; p3
-    ldr         r4, [r2], #4                ; flimit
+    ldrb        r4, [r2]                    ; blimit
     ldr         r10, [src], pstep           ; p2
-    ldr         r2, [r3], #4                ; limit
+    ldrb        r2, [r3]                    ; limit
     ldr         r11, [src], pstep           ; p1
-    uadd8       r4, r4, r4                  ; flimit * 2
-    ldr         r3, [r6], #4                ; thresh
+    orr         r4, r4, r4, lsl #8
+    ldrb        r3, [r6]                    ; thresh
+    orr         r2, r2, r2, lsl #8
     mov         count, count, lsl #1        ; 4-in-parallel
-    uadd8       r4, r4, r2                  ; flimit * 2 + limit
+    orr         r4, r4, r4, lsl #16
+    orr         r3, r3, r3, lsl #8
+    orr         r2, r2, r2, lsl #16
+    orr         r3, r3, r3, lsl #16
 
 |Hnext8|
     ; vp8_filter_mask() function
     ; calculate breakout conditions
     ldr         r12, [src], pstep           ; p0
 
     uqsub8      r6, r9, r10                 ; p3 - p2
     uqsub8      r7, r10, r9                 ; p2 - p3
@@ -248,22 +249,16 @@ count       RN  r5
     sub         src, src, pstep, lsl #1
 
 |hskip_filter|
     add         src, src, #4
     sub         src, src, pstep, lsl #2
 
     subs        count, count, #1
 
-    ;pld            [src]
-    ;pld            [src, pstep]
-    ;pld            [src, pstep, lsl #1]
-    ;pld            [src, pstep, lsl #2]
-    ;pld            [src, pstep, lsl #3]
-
     ldrne       r9, [src], pstep            ; p3
     ldrne       r10, [src], pstep           ; p2
     ldrne       r11, [src], pstep           ; p1
 
     bne         Hnext8
 
     add         sp, sp, #16
     ldmia       sp!, {r4 - r11, pc}
@@ -276,24 +271,28 @@ count       RN  r5
     stmdb       sp!, {r4 - r11, lr}
 
     sub         src, src, pstep, lsl #2     ; move src pointer down by 4 lines
     ldr         count, [sp, #40]            ; count for 8-in-parallel
     ldr         r6, [sp, #36]               ; load thresh address
     sub         sp, sp, #16                 ; create temp buffer
 
     ldr         r9, [src], pstep            ; p3
-    ldr         r4, [r2], #4                ; flimit
+    ldrb        r4, [r2]                    ; blimit
     ldr         r10, [src], pstep           ; p2
-    ldr         r2, [r3], #4                ; limit
+    ldrb        r2, [r3]                    ; limit
     ldr         r11, [src], pstep           ; p1
-    uadd8       r4, r4, r4                  ; flimit * 2
-    ldr         r3, [r6], #4                ; thresh
+    orr         r4, r4, r4, lsl #8
+    ldrb        r3, [r6]                    ; thresh
+    orr         r2, r2, r2, lsl #8
     mov         count, count, lsl #1        ; 4-in-parallel
-    uadd8       r4, r4, r2                  ; flimit * 2 + limit
+    orr         r4, r4, r4, lsl #16
+    orr         r3, r3, r3, lsl #8
+    orr         r2, r2, r2, lsl #16
+    orr         r3, r3, r3, lsl #16
 
 |MBHnext8|
 
     ; vp8_filter_mask() function
     ; calculate breakout conditions
     ldr         r12, [src], pstep           ; p0
 
     uqsub8      r6, r9, r10                 ; p3 - p2
@@ -585,25 +584,29 @@ count       RN  r5
     stmdb       sp!, {r4 - r11, lr}
 
     sub         src, src, #4                ; move src pointer down by 4
     ldr         count, [sp, #40]            ; count for 8-in-parallel
     ldr         r12, [sp, #36]              ; load thresh address
     sub         sp, sp, #16                 ; create temp buffer
 
     ldr         r6, [src], pstep            ; load source data
-    ldr         r4, [r2], #4                ; flimit
+    ldrb        r4, [r2]                    ; blimit
     ldr         r7, [src], pstep
-    ldr         r2, [r3], #4                ; limit
+    ldrb        r2, [r3]                    ; limit
     ldr         r8, [src], pstep
-    uadd8       r4, r4, r4                  ; flimit * 2
-    ldr         r3, [r12], #4               ; thresh
+    orr         r4, r4, r4, lsl #8
+    ldrb        r3, [r12]                   ; thresh
+    orr         r2, r2, r2, lsl #8
     ldr         lr, [src], pstep
     mov         count, count, lsl #1        ; 4-in-parallel
-    uadd8       r4, r4, r2                  ; flimit * 2 + limit
+    orr         r4, r4, r4, lsl #16
+    orr         r3, r3, r3, lsl #8
+    orr         r2, r2, r2, lsl #16
+    orr         r3, r3, r3, lsl #16
 
 |Vnext8|
 
     ; vp8_filter_mask() function
     ; calculate breakout conditions
     ; transpose the source data for 4-in-parallel operation
     TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
 
@@ -852,28 +855,36 @@ count       RN  r5
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 |vp8_mbloop_filter_vertical_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
     sub         src, src, #4                ; move src pointer down by 4
     ldr         count, [sp, #40]            ; count for 8-in-parallel
     ldr         r12, [sp, #36]              ; load thresh address
+    pld         [src, #23]                  ; preload for next block
     sub         sp, sp, #16                 ; create temp buffer
 
     ldr         r6, [src], pstep            ; load source data
-    ldr         r4, [r2], #4                ; flimit
+    ldrb        r4, [r2]                    ; blimit
+    pld         [src, #23]
     ldr         r7, [src], pstep
-    ldr         r2, [r3], #4                ; limit
+    ldrb        r2, [r3]                    ; limit
+    pld         [src, #23]
     ldr         r8, [src], pstep
-    uadd8       r4, r4, r4                  ; flimit * 2
-    ldr         r3, [r12], #4               ; thresh
+    orr         r4, r4, r4, lsl #8
+    ldrb        r3, [r12]                   ; thresh
+    orr         r2, r2, r2, lsl #8
+    pld         [src, #23]
     ldr         lr, [src], pstep
     mov         count, count, lsl #1        ; 4-in-parallel
-    uadd8       r4, r4, r2                  ; flimit * 2 + limit
+    orr         r4, r4, r4, lsl #16
+    orr         r3, r3, r3, lsl #8
+    orr         r2, r2, r2, lsl #16
+    orr         r3, r3, r3, lsl #16
 
 |MBVnext8|
     ; vp8_filter_mask() function
     ; calculate breakout conditions
     ; transpose the source data for 4-in-parallel operation
     TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
 
     uqsub8      r7, r9, r10                 ; p3 - p2
@@ -903,16 +914,17 @@ count       RN  r5
     ldr         r6, [src], pstep            ; load source data
     str         r11, [sp]                   ; push r11 to stack
     ldr         r7, [src], pstep
     str         r12, [sp, #4]               ; save current reg before load q0 - q3 data
     ldr         r8, [src], pstep
     str         lr, [sp, #8]
     ldr         lr, [src], pstep
 
+
     TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
 
     ldr         lr, [sp, #8]                ; load back (f)limit accumulator
 
     uqsub8      r6, r12, r11                ; q3 - q2
     uqsub8      r7, r11, r12                ; q2 - q3
     uqsub8      r12, r11, r10               ; q2 - q1
     uqsub8      r11, r10, r11               ; q1 - q2
@@ -951,16 +963,17 @@ count       RN  r5
     usub8       lr, r12, lr
     ldr         r9, [sp]                    ; load the compared result
     sel         lr, r11, r12                ; filter mask: lr
 
     cmp         lr, #0
     beq         mbvskip_filter               ; skip filtering
 
 
+
     ;vp8_hevmask() function
     ;calculate high edge variance
 
     sub         src, src, pstep, lsl #2     ; move src pointer down by 4 lines
 
     orr         r9, r9, r10
 
     ldrh        r7, [src, #-2]
@@ -1118,16 +1131,17 @@ count       RN  r5
     mov         lr, #0x12                   ; 18
     mov         r7, #0x3f                   ; 63
 
     sxtb16      r6, r12
     sxtb16      r10, r12, ror #8
     smlabb      r8, r6, lr, r7
     smlatb      r6, r6, lr, r7
     smlabb      r9, r10, lr, r7
+
     smlatb      r10, r10, lr, r7
     ssat        r8, #8, r8, asr #7
     ssat        r6, #8, r6, asr #7
     ssat        r9, #8, r9, asr #7
     ssat        r10, #8, r10, asr #7
 
     sub         src, src, pstep, lsl #2     ; move src pointer down by 4 lines
 
@@ -1237,19 +1251,23 @@ count       RN  r5
 
     ;adjust src pointer for next loop
     sub         src, src, #2
 
 |mbvskip_filter|
     sub         src, src, #4
     subs        count, count, #1
 
+    pld         [src, #23]                  ; preload for next block
     ldrne       r6, [src], pstep            ; load source data
+    pld         [src, #23]
     ldrne       r7, [src], pstep
+    pld         [src, #23]
     ldrne       r8, [src], pstep
+    pld         [src, #23]
     ldrne       lr, [src], pstep
 
     bne         MBVnext8
 
     add         sp, sp, #16
 
     ldmia       sp!, {r4 - r11, pc}
     ENDP        ; |vp8_mbloop_filter_vertical_edge_armv6|
--- a/media/libvpx/vp8/common/arm/armv6/simpleloopfilter_v6.asm
+++ b/media/libvpx/vp8/common/arm/armv6/simpleloopfilter_v6.asm
@@ -40,45 +40,38 @@
     pkhtb       $b2, $b3, $b1, asr #16      ; 32 22 12 02   -- p1
     pkhbt       $b0, $b1, $b3, lsl #16      ; 30 20 10 00   -- p3
 
     pkhtb       $b3, $a2, $a0, asr #16      ; 33 23 13 03   -- p0
     pkhbt       $b1, $a0, $a2, lsl #16      ; 31 21 11 01   -- p2
     MEND
 
 
+
 src         RN  r0
 pstep       RN  r1
 
 ;r0     unsigned char *src_ptr,
 ;r1     int src_pixel_step,
-;r2     const char *flimit,
-;r3     const char *limit,
-;stack  const char *thresh,
-;stack  int  count
-
-; All 16 elements in flimit are equal. So, in the code, only one load is needed
-; for flimit. Same applies to limit. thresh is not used in simple looopfilter
+;r2     const char *blimit
 
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 |vp8_loop_filter_simple_horizontal_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
-    ldr         r12, [r3]                   ; limit
+    ldrb        r12, [r2]                   ; blimit
     ldr         r3, [src, -pstep, lsl #1]   ; p1
     ldr         r4, [src, -pstep]           ; p0
     ldr         r5, [src]                   ; q0
     ldr         r6, [src, pstep]            ; q1
-    ldr         r7, [r2]                    ; flimit
+    orr         r12, r12, r12, lsl #8       ; blimit
     ldr         r2, c0x80808080
-    ldr         r9, [sp, #40]               ; count for 8-in-parallel
-    uadd8       r7, r7, r7                  ; flimit * 2
-    mov         r9, r9, lsl #1              ; double the count. we're doing 4 at a time
-    uadd8       r12, r7, r12                ; flimit * 2 + limit
+    orr         r12, r12, r12, lsl #16      ; blimit
+    mov         r9, #4                      ; double the count. we're doing 4 at a time
     mov         lr, #0                      ; need 0 in a couple places
 
 |simple_hnext8|
     ; vp8_simple_filter_mask()
 
     uqsub8      r7, r3, r6                  ; p1 - q1
     uqsub8      r8, r6, r3                  ; q1 - p1
     uqsub8      r10, r4, r5                 ; p0 - q0
@@ -143,40 +136,42 @@ pstep       RN  r1
     ENDP        ; |vp8_loop_filter_simple_horizontal_edge_armv6|
 
 
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 |vp8_loop_filter_simple_vertical_edge_armv6| PROC
 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     stmdb       sp!, {r4 - r11, lr}
 
-    ldr         r12, [r2]                   ; r12: flimit
+    ldrb        r12, [r2]                   ; r12: blimit
     ldr         r2, c0x80808080
-    ldr         r7, [r3]                    ; limit
+    orr         r12, r12, r12, lsl #8
 
     ; load soure data to r7, r8, r9, r10
     ldrh        r3, [src, #-2]
+    pld         [src, #23]                  ; preload for next block
     ldrh        r4, [src], pstep
-    uadd8       r12, r12, r12               ; flimit * 2
+    orr         r12, r12, r12, lsl #16
 
     ldrh        r5, [src, #-2]
+    pld         [src, #23]
     ldrh        r6, [src], pstep
-    uadd8       r12, r12, r7                ; flimit * 2 + limit
 
     pkhbt       r7, r3, r4, lsl #16
 
     ldrh        r3, [src, #-2]
+    pld         [src, #23]
     ldrh        r4, [src], pstep
-    ldr         r11, [sp, #40]              ; count (r11) for 8-in-parallel
 
     pkhbt       r8, r5, r6, lsl #16
 
     ldrh        r5, [src, #-2]
+    pld         [src, #23]
     ldrh        r6, [src], pstep
-    mov         r11, r11, lsl #1            ; 4-in-parallel
+    mov         r11, #4                     ; double the count. we're doing 4 at a time
 
 |simple_vnext8|
     ; vp8_simple_filter_mask() function
     pkhbt       r9, r3, r4, lsl #16
     pkhbt       r10, r5, r6, lsl #16
 
     ;transpose r7, r8, r9, r10 to r3, r4, r5, r6
     TRANSPOSE_MATRIX r7, r8, r9, r10, r3, r4, r5, r6
@@ -254,29 +249,33 @@ pstep       RN  r1
     strb        r4, [src, #-1]
     strb        r5, [src], pstep
 
 |simple_vskip_filter|
     subs        r11, r11, #1
 
     ; load soure data to r7, r8, r9, r10
     ldrneh      r3, [src, #-2]
+    pld         [src, #23]                  ; preload for next block
     ldrneh      r4, [src], pstep
 
     ldrneh      r5, [src, #-2]
+    pld         [src, #23]
     ldrneh      r6, [src], pstep
 
     pkhbt       r7, r3, r4, lsl #16
 
     ldrneh      r3, [src, #-2]
+    pld         [src, #23]
     ldrneh      r4, [src], pstep
 
     pkhbt       r8, r5, r6, lsl #16
 
     ldrneh      r5, [src, #-2]
+    pld         [src, #23]
     ldrneh      r6, [src], pstep
 
     bne         simple_vnext8
 
     ldmia       sp!, {r4 - r11, pc}
     ENDP        ; |vp8_loop_filter_simple_vertical_edge_armv6|
 
 ; Constant Pool
--- a/media/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
+++ b/media/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
@@ -30,16 +30,19 @@
     cmp         r2, #0                      ;skip first_pass filter if xoffset=0
     add         lr, sp, #4                  ;point to temporary buffer
     beq         skip_firstpass_filter
 
 ;first-pass filter
     adr         r12, filter8_coeff
     sub         r0, r0, r1, lsl #1
 
+    add         r3, r1, #10                 ; preload next low
+    pld         [r0, r3]
+
     add         r2, r12, r2, lsl #4         ;calculate filter location
     add         r0, r0, #3                  ;adjust src only for loading convinience
 
     ldr         r3, [r2]                    ; load up packed filter coefficients
     ldr         r4, [r2, #4]
     ldr         r5, [r2, #8]
 
     mov         r2, #0x90000                ; height=9 is top part of counter
@@ -105,16 +108,19 @@
     ;;ENDIF
 
     subs        r2, r2, #0x10000
 
     sub         lr, lr, #158
 
     add         r0, r0, r1                  ; move to next input line
 
+    add         r11, r1, #18                ; preload next low. adding back block width(=8), which is subtracted earlier
+    pld         [r0, r11]
+
     bne         first_pass_hloop_v6
 
 ;second pass filter
 secondpass_filter
     ldr         r3, [sp], #4                ; load back yoffset
     ldr         r0, [sp, #216]              ; load dst address from stack 180+36
     ldr         r1, [sp, #220]              ; load dst stride from stack 180+40
 
@@ -238,18 +244,16 @@ skip_secondpass_hloop
 
     add         sp, sp, #16                 ; 180 - (160 +4)
 
     ldmia       sp!, {r4 - r11, pc}
 
     ENDP
 
 ;-----------------
-    AREA    subpelfilters8_dat, DATA, READWRITE         ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
 ;One word each is reserved. Label filter_coeff can be used to access the data.
 ;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
 filter8_coeff
     DCD     0x00000000,     0x00000080,     0x00000000,     0x00000000
     DCD     0xfffa0000,     0x000c007b,     0x0000ffff,     0x00000000
     DCD     0xfff50002,     0x0024006c,     0x0001fff8,     0x00000000
     DCD     0xfff70000,     0x0032005d,     0x0000fffa,     0x00000000
     DCD     0xfff00003,     0x004d004d,     0x0003fff0,     0x00000000
--- a/media/libvpx/vp8/common/arm/bilinearfilter_arm.c
+++ b/media/libvpx/vp8/common/arm/bilinearfilter_arm.c
@@ -5,156 +5,57 @@
  *  that can be found in the LICENSE file in the root of the source
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 
 #include <math.h>
-#include "subpixel.h"
-
-#define BLOCK_HEIGHT_WIDTH 4
-#define VP8_FILTER_WEIGHT 128
-#define VP8_FILTER_SHIFT  7
-
-static const short bilinear_filters[8][2] =
-{
-    { 128,   0 },
-    { 112,  16 },
-    {  96,  32 },
-    {  80,  48 },
-    {  64,  64 },
-    {  48,  80 },
-    {  32,  96 },
-    {  16, 112 }
-};
-
-
-extern void vp8_filter_block2d_bil_first_pass_armv6
-(
-    unsigned char *src_ptr,
-    unsigned short *output_ptr,
-    unsigned int src_pixels_per_line,
-    unsigned int output_height,
-    unsigned int output_width,
-    const short *vp8_filter
-);
-
-extern void vp8_filter_block2d_bil_second_pass_armv6
-(
-    unsigned short *src_ptr,
-    unsigned char  *output_ptr,
-    int output_pitch,
-    unsigned int  output_height,
-    unsigned int  output_width,
-    const short *vp8_filter
-);
-
-#if 0
-void vp8_filter_block2d_bil_first_pass_6
-(
-    unsigned char *src_ptr,
-    unsigned short *output_ptr,
-    unsigned int src_pixels_per_line,
-    unsigned int output_height,
-    unsigned int output_width,
-    const short *vp8_filter
-)
-{
-    unsigned int i, j;
-
-    for ( i=0; i<output_height; i++ )
-    {
-        for ( j=0; j<output_width; j++ )
-        {
-            /* Apply bilinear filter */
-            output_ptr[j] = ( ( (int)src_ptr[0]          * vp8_filter[0]) +
-                               ((int)src_ptr[1] * vp8_filter[1]) +
-                                (VP8_FILTER_WEIGHT/2) ) >> VP8_FILTER_SHIFT;
-            src_ptr++;
-        }
-
-        /* Next row... */
-        src_ptr    += src_pixels_per_line - output_width;
-        output_ptr += output_width;
-    }
-}
-
-void vp8_filter_block2d_bil_second_pass_6
-(
-    unsigned short *src_ptr,
-    unsigned char  *output_ptr,
-    int output_pitch,
-    unsigned int  output_height,
-    unsigned int  output_width,
-    const short *vp8_filter
-)
-{
-    unsigned int  i,j;
-    int  Temp;
-
-    for ( i=0; i<output_height; i++ )
-    {
-        for ( j=0; j<output_width; j++ )
-        {
-            /* Apply filter */
-            Temp =  ((int)src_ptr[0]         * vp8_filter[0]) +
-                    ((int)src_ptr[output_width] * vp8_filter[1]) +
-                    (VP8_FILTER_WEIGHT/2);
-            output_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
-            src_ptr++;
-        }
-
-        /* Next row... */
-        /*src_ptr    += src_pixels_per_line - output_width;*/
-        output_ptr += output_pitch;
-    }
-}
-#endif
+#include "vp8/common/filter.h"
+#include "vp8/common/subpixel.h"
+#include "bilinearfilter_arm.h"
 
 void vp8_filter_block2d_bil_armv6
 (
     unsigned char *src_ptr,
-    unsigned char *output_ptr,
-    unsigned int   src_pixels_per_line,
+    unsigned char *dst_ptr,
+    unsigned int   src_pitch,
     unsigned int   dst_pitch,
-    const short      *HFilter,
-    const short      *VFilter,
+    const short   *HFilter,
+    const short   *VFilter,
     int            Width,
     int            Height
 )
 {
-
-    unsigned short FData[36*16]; /* Temp data bufffer used in filtering */
+    unsigned short FData[36*16]; /* Temp data buffer used in filtering */
 
     /* First filter 1-D horizontally... */
-    /* pixel_step = 1; */
-    vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pixels_per_line, Height + 1, Width, HFilter);
+    vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
 
     /* then 1-D vertically... */
-    vp8_filter_block2d_bil_second_pass_armv6(FData, output_ptr, dst_pitch, Height, Width, VFilter);
+    vp8_filter_block2d_bil_second_pass_armv6(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
 }
 
 
 void vp8_bilinear_predict4x4_armv6
 (
     unsigned char  *src_ptr,
     int   src_pixels_per_line,
     int  xoffset,
     int  yoffset,
     unsigned char *dst_ptr,
     int dst_pitch
 )
 {
     const short  *HFilter;
     const short  *VFilter;
 
-    HFilter = bilinear_filters[xoffset];
-    VFilter = bilinear_filters[yoffset];
+    HFilter = vp8_bilinear_filters[xoffset];
+    VFilter = vp8_bilinear_filters[yoffset];
 
     vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
 }
 
 void vp8_bilinear_predict8x8_armv6
 (
     unsigned char  *src_ptr,
     int  src_pixels_per_line,
@@ -162,18 +63,18 @@ void vp8_bilinear_predict8x8_armv6
     int  yoffset,
     unsigned char *dst_ptr,
     int  dst_pitch
 )
 {
     const short  *HFilter;
     const short  *VFilter;
 
-    HFilter = bilinear_filters[xoffset];
-    VFilter = bilinear_filters[yoffset];
+    HFilter = vp8_bilinear_filters[xoffset];
+    VFilter = vp8_bilinear_filters[yoffset];
 
     vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
 }
 
 void vp8_bilinear_predict8x4_armv6
 (
     unsigned char  *src_ptr,
     int  src_pixels_per_line,
@@ -181,18 +82,18 @@ void vp8_bilinear_predict8x4_armv6
     int  yoffset,
     unsigned char *dst_ptr,
     int  dst_pitch
 )
 {
     const short  *HFilter;
     const short  *VFilter;
 
-    HFilter = bilinear_filters[xoffset];
-    VFilter = bilinear_filters[yoffset];
+    HFilter = vp8_bilinear_filters[xoffset];
+    VFilter = vp8_bilinear_filters[yoffset];
 
     vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
 }
 
 void vp8_bilinear_predict16x16_armv6
 (
     unsigned char  *src_ptr,
     int  src_pixels_per_line,
@@ -200,13 +101,13 @@ void vp8_bilinear_predict16x16_armv6
     int  yoffset,
     unsigned char *dst_ptr,
     int  dst_pitch
 )
 {
     const short  *HFilter;
     const short  *VFilter;
 
-    HFilter = bilinear_filters[xoffset];
-    VFilter = bilinear_filters[yoffset];
+    HFilter = vp8_bilinear_filters[xoffset];
+    VFilter = vp8_bilinear_filters[yoffset];
 
     vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
 }
new file mode 100644
--- /dev/null
+++ b/media/libvpx/vp8/common/arm/bilinearfilter_arm.h
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (c) 2011 The WebM project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+
+#ifndef BILINEARFILTER_ARM_H
+#define BILINEARFILTER_ARM_H
+
+extern void vp8_filter_block2d_bil_first_pass_armv6
+(
+    const unsigned char  *src_ptr,
+    unsigned short       *dst_ptr,
+    unsigned int          src_pitch,
+    unsigned int          height,
+    unsigned int          width,
+    const short          *vp8_filter
+);
+
+extern void vp8_filter_block2d_bil_second_pass_armv6
+(
+    const unsigned short *src_ptr,
+    unsigned char        *dst_ptr,
+    int                   dst_pitch,
+    unsigned int          height,
+    unsigned int          width,
+    const short         *vp8_filter
+);
+
+#endif /* BILINEARFILTER_ARM_H */
--- a/media/libvpx/vp8/common/arm/filter_arm.c
+++ b/media/libvpx/vp8/common/arm/filter_arm.c
@@ -6,37 +6,43 @@
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 
 #include "vpx_ports/config.h"
 #include <math.h>
-#include "subpixel.h"
+#include "vp8/common/filter.h"
+#include "vp8/common/subpixel.h"
 #include "vpx_ports/mem.h"
 
-#define BLOCK_HEIGHT_WIDTH 4
-#define VP8_FILTER_WEIGHT 128
-#define VP8_FILTER_SHIFT  7
+extern void vp8_filter_block2d_first_pass_armv6
+(
+    unsigned char *src_ptr,
+    short         *output_ptr,
+    unsigned int src_pixels_per_line,
+    unsigned int output_width,
+    unsigned int output_height,
+    const short *vp8_filter
+);
 
-DECLARE_ALIGNED(16, static const short, sub_pel_filters[8][6]) =
-{
-    { 0,  0,  128,    0,   0,  0 },         /* note that 1/8 pel positions are just as per alpha -0.5 bicubic */
-    { 0, -6,  123,   12,  -1,  0 },
-    { 2, -11, 108,   36,  -8,  1 },         /* New 1/4 pel 6 tap filter */
-    { 0, -9,   93,   50,  -6,  0 },
-    { 3, -16,  77,   77, -16,  3 },         /* New 1/2 pel 6 tap filter */
-    { 0, -6,   50,   93,  -9,  0 },
-    { 1, -8,   36,  108, -11,  2 },         /* New 1/4 pel 6 tap filter */
-    { 0, -1,   12,  123,  -6,  0 },
-};
+// 8x8
+extern void vp8_filter_block2d_first_pass_8x8_armv6
+(
+    unsigned char *src_ptr,
+    short         *output_ptr,
+    unsigned int src_pixels_per_line,
+    unsigned int output_width,
+    unsigned int output_height,
+    const short *vp8_filter
+);
 
-
-extern void vp8_filter_block2d_first_pass_armv6
+// 16x16
+extern void vp8_filter_block2d_first_pass_16x16_armv6
 (
     unsigned char *src_ptr,
     short         *output_ptr,
     unsigned int src_pixels_per_line,
     unsigned int output_width,
     unsigned int output_height,
     const short *vp8_filter
 );
@@ -88,21 +94,21 @@ void vp8_sixtap_predict_armv6
     int  xoffset,
     int  yoffset,
     unsigned char *dst_ptr,
     int  dst_pitch
 )
 {
     const short  *HFilter;
     const short  *VFilter;
-    DECLARE_ALIGNED_ARRAY(4, short, FData, 12*4); /* Temp data bufffer used in filtering */
+    DECLARE_ALIGNED_ARRAY(4, short, FData, 12*4); /* Temp data buffer used in filtering */
 
 
-    HFilter = sub_pel_filters[xoffset];   /* 6 tap */
-    VFilter = sub_pel_filters[yoffset];       /* 6 tap */
+    HFilter = vp8_sub_pel_filters[xoffset];   /* 6 tap */
+    VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
 
     /* Vfilter is null. First pass only */
     if (xoffset && !yoffset)
     {
         /*vp8_filter_block2d_first_pass_armv6 ( src_ptr, FData+2, src_pixels_per_line, 4, 4, HFilter );
         vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, VFilter );*/
 
         vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, HFilter);
@@ -124,93 +130,52 @@ void vp8_sixtap_predict_armv6
         else
         {
             vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 4, 9, HFilter);
             vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
         }
     }
 }
 
-#if 0
-void vp8_sixtap_predict8x4_armv6
-(
-    unsigned char  *src_ptr,
-    int  src_pixels_per_line,
-    int  xoffset,
-    int  yoffset,
-    unsigned char *dst_ptr,
-    int  dst_pitch
-)
-{
-    const short  *HFilter;
-    const short  *VFilter;
-    DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data bufffer used in filtering */
-
-    HFilter = sub_pel_filters[xoffset];   /* 6 tap */
-    VFilter = sub_pel_filters[yoffset];       /* 6 tap */
-
-
-    /*if (xoffset && !yoffset)
-    {
-        vp8_filter_block2d_first_pass_only_armv6 (  src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter );
-    }*/
-    /* Hfilter is null. Second pass only */
-    /*else if (!xoffset && yoffset)
-    {
-        vp8_filter_block2d_second_pass_only_armv6 ( src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter );
-    }
-    else
-    {
-        if (yoffset & 0x1)
-            vp8_filter_block2d_first_pass_armv6 ( src_ptr-src_pixels_per_line, FData+1, src_pixels_per_line, 8, 7, HFilter );
-        else*/
-
-        vp8_filter_block2d_first_pass_armv6 ( src_ptr-(2*src_pixels_per_line), FData, src_pixels_per_line, 8, 9, HFilter );
-
-        vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, 8, VFilter );
-    /*}*/
-}
-#endif
-
 void vp8_sixtap_predict8x8_armv6
 (
     unsigned char  *src_ptr,
     int  src_pixels_per_line,
     int  xoffset,
     int  yoffset,
     unsigned char *dst_ptr,
     int  dst_pitch
 )
 {
     const short  *HFilter;
     const short  *VFilter;
-    DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data bufffer used in filtering */
+    DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data buffer used in filtering */
 
-    HFilter = sub_pel_filters[xoffset];   /* 6 tap */
-    VFilter = sub_pel_filters[yoffset];       /* 6 tap */
+    HFilter = vp8_sub_pel_filters[xoffset];   /* 6 tap */
+    VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
 
     if (xoffset && !yoffset)
     {
         vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter);
     }
     /* Hfilter is null. Second pass only */
     else if (!xoffset && yoffset)
     {
         vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter);
     }
     else
     {
         if (yoffset & 0x1)
         {
-            vp8_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
+            vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
             vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
         }
         else
         {
-            vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
+            vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
             vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
         }
     }
 }
 
 
 void vp8_sixtap_predict16x16_armv6
 (
@@ -219,38 +184,38 @@ void vp8_sixtap_predict16x16_armv6
     int  xoffset,
     int  yoffset,
     unsigned char *dst_ptr,
     int  dst_pitch
 )
 {
     const short  *HFilter;
     const short  *VFilter;
-    DECLARE_ALIGNED_ARRAY(4, short, FData, 24*16);    /* Temp data bufffer used in filtering */
+    DECLARE_ALIGNED_ARRAY(4, short, FData, 24*16);    /* Temp data buffer used in filtering */
 
-    HFilter = sub_pel_filters[xoffset];   /* 6 tap */
-    VFilter = sub_pel_filters[yoffset];       /* 6 tap */
+    HFilter = vp8_sub_pel_filters[xoffset];   /* 6 tap */
+    VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
 
     if (xoffset && !yoffset)
     {
         vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, HFilter);
     }
     /* Hfilter is null. Second pass only */
     else if (!xoffset && yoffset)
     {
         vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, VFilter);
     }
     else
     {
         if (yoffset & 0x1)
         {
-            vp8_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
+            vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
             vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
         }
         else
         {
-            vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
+            vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
             vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
         }
     }
 
 }
 #endif
--- a/media/libvpx/vp8/common/arm/loopfilter_arm.c
+++ b/media/libvpx/vp8/common/arm/loopfilter_arm.c
@@ -4,234 +4,173 @@
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 
-#include "vpx_ports/config.h"
-#include <math.h>
-#include "loopfilter.h"
-#include "onyxc_int.h"
+#include "vpx_config.h"
+#include "vp8/common/loopfilter.h"
+#include "vp8/common/onyxc_int.h"
 
+#if HAVE_ARMV6
 extern prototype_loopfilter(vp8_loop_filter_horizontal_edge_armv6);
 extern prototype_loopfilter(vp8_loop_filter_vertical_edge_armv6);
 extern prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_armv6);
 extern prototype_loopfilter(vp8_mbloop_filter_vertical_edge_armv6);
-extern prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_armv6);
-extern prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_armv6);
+#endif
+
+#if HAVE_ARMV7
+typedef void loopfilter_y_neon(unsigned char *src, int pitch,
+        unsigned char blimit, unsigned char limit, unsigned char thresh);
+typedef void loopfilter_uv_neon(unsigned char *u, int pitch,
+        unsigned char blimit, unsigned char limit, unsigned char thresh,
+        unsigned char *v);
 
-extern prototype_loopfilter(vp8_loop_filter_horizontal_edge_y_neon);
-extern prototype_loopfilter(vp8_loop_filter_vertical_edge_y_neon);
-extern prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_y_neon);
-extern prototype_loopfilter(vp8_mbloop_filter_vertical_edge_y_neon);
-extern prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_neon);
-extern prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_neon);
+extern loopfilter_y_neon vp8_loop_filter_horizontal_edge_y_neon;
+extern loopfilter_y_neon vp8_loop_filter_vertical_edge_y_neon;
+extern loopfilter_y_neon vp8_mbloop_filter_horizontal_edge_y_neon;
+extern loopfilter_y_neon vp8_mbloop_filter_vertical_edge_y_neon;
 
-extern loop_filter_uvfunction vp8_loop_filter_horizontal_edge_uv_neon;
-extern loop_filter_uvfunction vp8_loop_filter_vertical_edge_uv_neon;
-extern loop_filter_uvfunction vp8_mbloop_filter_horizontal_edge_uv_neon;
-extern loop_filter_uvfunction vp8_mbloop_filter_vertical_edge_uv_neon;
-
+extern loopfilter_uv_neon vp8_loop_filter_horizontal_edge_uv_neon;
+extern loopfilter_uv_neon vp8_loop_filter_vertical_edge_uv_neon;
+extern loopfilter_uv_neon vp8_mbloop_filter_horizontal_edge_uv_neon;
+extern loopfilter_uv_neon vp8_mbloop_filter_vertical_edge_uv_neon;
+#endif
 
 #if HAVE_ARMV6
 /*ARMV6 loopfilter functions*/
 /* Horizontal MB filtering */
 void vp8_loop_filter_mbh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                               int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                               int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_mbloop_filter_horizontal_edge_armv6(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+    vp8_mbloop_filter_horizontal_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
 
     if (u_ptr)
-        vp8_mbloop_filter_horizontal_edge_armv6(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
+        vp8_mbloop_filter_horizontal_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 
     if (v_ptr)
-        vp8_mbloop_filter_horizontal_edge_armv6(v_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
-}
-
-void vp8_loop_filter_mbhs_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                                int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
-{
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+        vp8_mbloop_filter_horizontal_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 }
 
 /* Vertical MB Filtering */
 void vp8_loop_filter_mbv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                               int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                               int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_mbloop_filter_vertical_edge_armv6(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+    vp8_mbloop_filter_vertical_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
 
     if (u_ptr)
-        vp8_mbloop_filter_vertical_edge_armv6(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
+        vp8_mbloop_filter_vertical_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 
     if (v_ptr)
-        vp8_mbloop_filter_vertical_edge_armv6(v_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
-}
-
-void vp8_loop_filter_mbvs_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                                int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
-{
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_vertical_edge_armv6(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+        vp8_mbloop_filter_vertical_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 }
 
 /* Horizontal B Filtering */
 void vp8_loop_filter_bh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                              int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                              int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_loop_filter_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+    vp8_loop_filter_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
+    vp8_loop_filter_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
+    vp8_loop_filter_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
 
     if (u_ptr)
-        vp8_loop_filter_horizontal_edge_armv6(u_ptr + 4 * uv_stride, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
+        vp8_loop_filter_horizontal_edge_armv6(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
 
     if (v_ptr)
-        vp8_loop_filter_horizontal_edge_armv6(v_ptr + 4 * uv_stride, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
+        vp8_loop_filter_horizontal_edge_armv6(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
 }
 
-void vp8_loop_filter_bhs_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                               int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+void vp8_loop_filter_bhs_armv6(unsigned char *y_ptr, int y_stride,
+                               const unsigned char *blimit)
 {
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+    vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, blimit);
+    vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, blimit);
+    vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, blimit);
 }
 
 /* Vertical B Filtering */
 void vp8_loop_filter_bv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                              int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                              int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_loop_filter_vertical_edge_armv6(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_vertical_edge_armv6(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_vertical_edge_armv6(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+    vp8_loop_filter_vertical_edge_armv6(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
+    vp8_loop_filter_vertical_edge_armv6(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
+    vp8_loop_filter_vertical_edge_armv6(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
 
     if (u_ptr)
-        vp8_loop_filter_vertical_edge_armv6(u_ptr + 4, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
+        vp8_loop_filter_vertical_edge_armv6(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
 
     if (v_ptr)
-        vp8_loop_filter_vertical_edge_armv6(v_ptr + 4, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
+        vp8_loop_filter_vertical_edge_armv6(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
 }
 
-void vp8_loop_filter_bvs_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                               int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+void vp8_loop_filter_bvs_armv6(unsigned char *y_ptr, int y_stride,
+                               const unsigned char *blimit)
 {
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+    vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 4, y_stride, blimit);
+    vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 8, y_stride, blimit);
+    vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 12, y_stride, blimit);
 }
 #endif
 
 #if HAVE_ARMV7
 /* NEON loopfilter functions */
 /* Horizontal MB filtering */
 void vp8_loop_filter_mbh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                              int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                              int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_mbloop_filter_horizontal_edge_y_neon(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+    unsigned char mblim = *lfi->mblim;
+    unsigned char lim = *lfi->lim;
+    unsigned char hev_thr = *lfi->hev_thr;
+    vp8_mbloop_filter_horizontal_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
 
     if (u_ptr)
-        vp8_mbloop_filter_horizontal_edge_uv_neon(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, v_ptr);
-}
-
-void vp8_loop_filter_mbhs_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                               int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
-{
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_horizontal_edge_neon(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+        vp8_mbloop_filter_horizontal_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
 }
 
 /* Vertical MB Filtering */
 void vp8_loop_filter_mbv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                              int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                              int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_mbloop_filter_vertical_edge_y_neon(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+    unsigned char mblim = *lfi->mblim;
+    unsigned char lim = *lfi->lim;
+    unsigned char hev_thr = *lfi->hev_thr;
+
+    vp8_mbloop_filter_vertical_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
 
     if (u_ptr)
-        vp8_mbloop_filter_vertical_edge_uv_neon(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, v_ptr);
-}
-
-void vp8_loop_filter_mbvs_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                               int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
-{
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_vertical_edge_neon(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
+        vp8_mbloop_filter_vertical_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
 }
 
 /* Horizontal B Filtering */
 void vp8_loop_filter_bh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                             int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                             int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+    unsigned char blim = *lfi->blim;
+    unsigned char lim = *lfi->lim;
+    unsigned char hev_thr = *lfi->hev_thr;
+
+    vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 4 * y_stride, y_stride, blim, lim, hev_thr);
+    vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 8 * y_stride, y_stride, blim, lim, hev_thr);
+    vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 12 * y_stride, y_stride, blim, lim, hev_thr);
 
     if (u_ptr)
-        vp8_loop_filter_horizontal_edge_uv_neon(u_ptr + 4 * uv_stride, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, v_ptr + 4 * uv_stride);
-}
-
-void vp8_loop_filter_bhs_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                              int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
-{
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_horizontal_edge_neon(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_horizontal_edge_neon(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_horizontal_edge_neon(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+        vp8_loop_filter_horizontal_edge_uv_neon(u_ptr + 4 * uv_stride, uv_stride, blim, lim, hev_thr, v_ptr + 4 * uv_stride);
 }
 
 /* Vertical B Filtering */
 void vp8_loop_filter_bv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                             int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
+                             int y_stride, int uv_stride, loop_filter_info *lfi)
 {
-    (void) simpler_lpf;
-    vp8_loop_filter_vertical_edge_y_neon(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_vertical_edge_y_neon(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_vertical_edge_y_neon(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+    unsigned char blim = *lfi->blim;
+    unsigned char lim = *lfi->lim;
+    unsigned char hev_thr = *lfi->hev_thr;
+
+    vp8_loop_filter_vertical_edge_y_neon(y_ptr + 4, y_stride, blim, lim, hev_thr);
+    vp8_loop_filter_vertical_edge_y_neon(y_ptr + 8, y_stride, blim, lim, hev_thr);
+    vp8_loop_filter_vertical_edge_y_neon(y_ptr + 12, y_stride, blim, lim, hev_thr);
 
     if (u_ptr)
-        vp8_loop_filter_vertical_edge_uv_neon(u_ptr + 4, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, v_ptr + 4);
-}
-
-void vp8_loop_filter_bvs_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
-                              int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
-{
-    (void) u_ptr;
-    (void) v_ptr;
-    (void) uv_stride;
-    (void) simpler_lpf;
-    vp8_loop_filter_simple_vertical_edge_neon(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_vertical_edge_neon(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
-    vp8_loop_filter_simple_vertical_edge_neon(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
+        vp8_loop_filter_vertical_edge_uv_neon(u_ptr + 4, uv_stride, blim, lim, hev_thr, v_ptr + 4);
 }
 #endif
--- a/media/libvpx/vp8/common/arm/loopfilter_arm.h
+++ b/media/libvpx/vp8/common/arm/loopfilter_arm.h
@@ -7,62 +7,65 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 
 #ifndef LOOPFILTER_ARM_H
 #define LOOPFILTER_ARM_H
 
+#include "vpx_config.h"
+
 #if HAVE_ARMV6
 extern prototype_loopfilter_block(vp8_loop_filter_mbv_armv6);
 extern prototype_loopfilter_block(vp8_loop_filter_bv_armv6);
 extern prototype_loopfilter_block(vp8_loop_filter_mbh_armv6);
 extern prototype_loopfilter_block(vp8_loop_filter_bh_armv6);
-extern prototype_loopfilter_block(vp8_loop_filter_mbvs_armv6);
-extern prototype_loopfilter_block(vp8_loop_filter_bvs_armv6);
-extern prototype_loopfilter_block(vp8_loop_filter_mbhs_armv6);
-extern prototype_loopfilter_block(vp8_loop_filter_bhs_armv6);
+extern prototype_simple_loopfilter(vp8_loop_filter_bvs_armv6);
+extern prototype_simple_loopfilter(vp8_loop_filter_bhs_armv6);
+extern prototype_simple_loopfilter(vp8_loop_filter_simple_horizontal_edge_armv6);
+extern prototype_simple_loopfilter(vp8_loop_filter_simple_vertical_edge_armv6);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
 #undef  vp8_lf_normal_mb_v
 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_armv6
 
 #undef  vp8_lf_normal_b_v
 #define vp8_lf_normal_b_v vp8_loop_filter_bv_armv6
 
 #undef  vp8_lf_normal_mb_h
 #define vp8_lf_normal_mb_h vp8_loop_filter_mbh_armv6
 
 #undef  vp8_lf_normal_b_h
 #define vp8_lf_normal_b_h vp8_loop_filter_bh_armv6
 
 #undef  vp8_lf_simple_mb_v
-#define vp8_lf_simple_mb_v vp8_loop_filter_mbvs_armv6
+#define vp8_lf_simple_mb_v vp8_loop_filter_simple_vertical_edge_armv6
 
 #undef  vp8_lf_simple_b_v
 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_armv6
 
 #undef  vp8_lf_simple_mb_h
-#define vp8_lf_simple_mb_h vp8_loop_filter_mbhs_armv6
+#define vp8_lf_simple_mb_h vp8_loop_filter_simple_horizontal_edge_armv6
 
 #undef  vp8_lf_simple_b_h
 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_armv6
-#endif
-#endif
+#endif /* !CONFIG_RUNTIME_CPU_DETECT */
+
+#endif /* HAVE_ARMV6 */
 
 #if HAVE_ARMV7
 extern prototype_loopfilter_block(vp8_loop_filter_mbv_neon);
 extern prototype_loopfilter_block(vp8_loop_filter_bv_neon);
 extern prototype_loopfilter_block(vp8_loop_filter_mbh_neon);
 extern prototype_loopfilter_block(vp8_loop_filter_bh_neon);
-extern prototype_loopfilter_block(vp8_loop_filter_mbvs_neon);
-extern prototype_loopfilter_block(vp8_loop_filter_bvs_neon);
-extern prototype_loopfilter_block(vp8_loop_filter_mbhs_neon);
-extern prototype_loopfilter_block(vp8_loop_filter_bhs_neon);
+extern prototype_simple_loopfilter(vp8_loop_filter_mbvs_neon);
+extern prototype_simple_loopfilter(vp8_loop_filter_bvs_neon);
+extern prototype_simple_loopfilter(vp8_loop_filter_mbhs_neon);
+extern prototype_simple_loopfilter(vp8_loop_filter_bhs_neon);
 
 #if !CONFIG_RUNTIME_CPU_DETECT
 #undef  vp8_lf_normal_mb_v
 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_neon
 
 #undef  vp8_lf_normal_b_v
 #define vp8_lf_normal_b_v vp8_loop_filter_bv_neon
 
@@ -78,12 +81,13 @@ extern prototype_loopfilter_block(vp8_lo
 #undef  vp8_lf_simple_b_v
 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_neon
 
 #undef  vp8_lf_simple_mb_h
 #define vp8_lf_simple_mb_h vp8_loop_filter_mbhs_neon
 
 #undef  vp8_lf_simple_b_h
 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_neon
-#endif
-#endif
+#endif /* !CONFIG_RUNTIME_CPU_DETECT */
 
-#endif
+#endif /* HAVE_ARMV7 */
+
+#endif /* LOOPFILTER_ARM_H */
--- a/media/libvpx/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
@@ -345,16 +345,13 @@ filt_blk2d_spo16x16_loop_neon
     vst1.u8         {d8, d9}, [r4], r5
 
     bne             filt_blk2d_spo16x16_loop_neon
     pop             {r4-r5,pc}
 
     ENDP
 
 ;-----------------
-    AREA    bifilters16_dat, DATA, READWRITE            ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 bifilter16_coeff
     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
 
     END
--- a/media/libvpx/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
@@ -118,16 +118,13 @@ skip_secondpass_filter
     vst1.32         {d29[0]}, [r4], lr
     vst1.32         {d29[1]}, [r4], lr
 
     pop             {r4, pc}
 
     ENDP
 
 ;-----------------
-    AREA    bilinearfilters4_dat, DATA, READWRITE           ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 bifilter4_coeff
     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
 
     END
--- a/media/libvpx/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
@@ -123,16 +123,13 @@ skip_secondpass_filter
     vst1.u8         {d24}, [r4], lr
     vst1.u8         {d25}, [r4], lr
 
     pop             {r4, pc}
 
     ENDP
 
 ;-----------------
-    AREA    bifilters8x4_dat, DATA, READWRITE           ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 bifilter8x4_coeff
     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
 
     END
--- a/media/libvpx/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
+++ b/media/libvpx/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
@@ -171,16 +171,13 @@ skip_secondpass_filter
     vst1.u8         {d28}, [r4], lr
     vst1.u8         {d29}, [r4], lr
 
     pop             {r4, pc}
 
     ENDP
 
 ;-----------------
-    AREA    bifilters8_dat, DATA, READWRITE         ;read/write by default
-;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
+
 bifilter8_coeff
     DCD     128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
 
     END
--- a/media/libvpx/vp8/common/arm/neon/iwalsh_neon.asm
+++ b/media/libvpx/vp8/common/arm/neon/iwalsh_neon.asm
@@ -15,82 +15,66 @@
     PRESERVE8
 
     AREA    |.text|, CODE, READONLY  ; name this block of code
 
 ;short vp8_short_inv_walsh4x4_neon(short *input, short *output)
 |vp8_short_inv_walsh4x4_neon| PROC
 
     ; read in all four lines of values: d0->d3
-    vldm.64 r0, {q0, q1}
+    vld1.i16 {q0-q1}, [r0@128]
 
     ; first for loop
+    vadd.s16 d4, d0, d3 ;a = [0] + [12]
+    vadd.s16 d6, d1, d2 ;b = [4] + [8]
+    vsub.s16 d5, d0, d3 ;d = [0] - [12]
+    vsub.s16 d7, d1, d2 ;c = [4] - [8]
 
-    vadd.s16 d4, d0, d3 ;a = [0] + [12]
-    vadd.s16 d5, d1, d2 ;b = [4] + [8]
-    vsub.s16 d6, d1, d2 ;c = [4] - [8]
-    vsub.s16 d7, d0, d3 ;d = [0] - [12]
-
-    vadd.s16 d0, d4, d5 ;a + b
-    vadd.s16 d1, d6, d7 ;c + d
-    vsub.s16 d2, d4, d5 ;a - b
-    vsub.s16 d3, d7, d6 ;d - c
+    vadd.s16 q0, q2, q3 ; a+b d+c
+    vsub.s16 q1, q2, q3 ; a-b d-c
 
     vtrn.32 d0, d2 ;d0:  0  1  8  9
                    ;d2:  2  3 10 11
     vtrn.32 d1, d3 ;d1:  4  5 12 13
                    ;d3:  6  7 14 15
 
     vtrn.16 d0, d1 ;d0:  0  4  8 12
                    ;d1:  1  5  9 13
     vtrn.16 d2, d3 ;d2:  2  6 10 14
                    ;d3:  3  7 11 15
 
     ; second for loop
 
     vadd.s16 d4, d0, d3 ;a = [0] + [3]
-    vadd.s16 d5, d1, d2 ;b = [1] + [2]
-    vsub.s16 d6, d1, d2 ;c = [1] - [2]
-    vsub.s16 d7, d0, d3 ;d = [0] - [3]
+    vadd.s16 d6, d1, d2 ;b = [1] + [2]
+    vsub.s16 d5, d0, d3 ;d = [0] - [3]
+    vsub.s16 d7, d1, d2 ;c = [1] - [2]
+
+    vmov.i16 q8, #3
 
-    vadd.s16 d0, d4, d5 ;e = a + b
-    vadd.s16 d1, d6, d7 ;f = c + d
-    vsub.s16 d2, d4, d5 ;g = a - b
-    vsub.s16 d3, d7, d6 ;h = d - c
+    vadd.s16 q0, q2, q3 ; a+b d+c
+    vsub.s16 q1, q2, q3 ; a-b d-c
 
-    vmov.i16 q2, #3
-    vadd.i16 q0, q0, q2 ;e/f += 3
-    vadd.i16 q1, q1, q2 ;g/h += 3
+    vadd.i16 q0, q0, q8 ;e/f += 3
+    vadd.i16 q1, q1, q8 ;g/h += 3
 
     vshr.s16 q0, q0, #3 ;e/f >> 3
     vshr.s16 q1, q1, #3 ;g/h >> 3
 
-    vtrn.32 d0, d2
-    vtrn.32 d1, d3
-    vtrn.16 d0, d1
-    vtrn.16 d2, d3
-
-    vstmia.16 r1!, {q0}
-    vstmia.16 r1!, {q1}
+    vst4.i16 {d0,d1,d2,d3}, [r1@128]
 
     bx lr
     ENDP    ; |vp8_short_inv_walsh4x4_neon|
 
 
 ;short vp8_short_inv_walsh4x4_1_neon(short *input, short *output)
 |vp8_short_inv_walsh4x4_1_neon| PROC
-    ; load a full line into a neon register
-    vld1.16  {q0}, [r0]
-    ; extract first element and replicate
-    vdup.16 q1, d0[0]
-    ; add 3 to all values
-    vmov.i16 q2, #3
-    vadd.i16 q3, q1, q2
-    ; right shift
-    vshr.s16 q3, q3, #3
-    ; write it back
-    vstmia.16 r1!, {q3}
-    vstmia.16 r1!, {q3}
-
+    ldrsh r2, [r0]          ; load input[0]
+    add r3, r2, #3          ; add 3
+    add r2, r1, #16         ; base for last 8 output
+    asr r0, r3, #3          ; right shift 3
+    vdup.16 q0, r0          ; load and duplicate
+    vst1.16 {q0}, [r1@128]  ; write back 8
+    vst1.16 {q0}, [r2@128]  ; write back last 8
     bx lr
     ENDP    ; |vp8_short_inv_walsh4x4_1_neon|
 
     END
--- a/media/libvpx/vp8/common/arm/neon/loopfilter_neon.asm
+++ b/media/libvpx/vp8/common/arm/neon/loopfilter_neon.asm
@@ -9,166 +9,245 @@
 ;
 
 
     EXPORT  |vp8_loop_filter_horizontal_edge_y_neon|
     EXPORT  |vp8_loop_filter_horizontal_edge_uv_neon|
     EXPORT  |vp8_loop_filter_vertical_edge_y_neon|
     EXPORT  |vp8_loop_filter_vertical_edge_uv_neon|
     ARM
-    REQUIRE8
-    PRESERVE8
 
     AREA ||.text||, CODE, READONLY, ALIGN=2
 
-; flimit, limit, and thresh should be positive numbers.
-; All 16 elements in these variables are equal.
-
-; void vp8_loop_filter_horizontal_edge_y_neon(unsigned char *src, int pitch,
-;                                             const signed char *flimit,
-;                                             const signed char *limit,
-;                                             const signed char *thresh,
-;                                             int count)
 ; r0    unsigned char *src
 ; r1    int pitch
-; r2    const signed char *flimit
-; r3    const signed char *limit
-; sp    const signed char *thresh,
-; sp+4  int count (unused)
+; r2    unsigned char blimit
+; r3    unsigned char limit
+; sp    unsigned char thresh,
 |vp8_loop_filter_horizontal_edge_y_neon| PROC
-    stmdb       sp!, {lr}
-    vld1.s8     {d0[], d1[]}, [r2]          ; flimit
-    vld1.s8     {d2[], d3[]}, [r3]          ; limit
-    sub         r2, r0, r1, lsl #2          ; move src pointer down by 4 lines
-    ldr         r12, [sp, #4]               ; load thresh pointer
+    push        {lr}
+    vdup.u8     q0, r2                     ; duplicate blimit
+    vdup.u8     q1, r3                     ; duplicate limit
+    sub         r2, r0, r1, lsl #2         ; move src pointer down by 4 lines
+    ldr         r3, [sp, #4]               ; load thresh
+    add         r12, r2, r1
+    add         r1, r1, r1
 
-    vld1.u8     {q3}, [r2], r1              ; p3
-    vld1.u8     {q4}, [r2], r1              ; p2
-    vld1.u8     {q5}, [r2], r1              ; p1
-    vld1.u8     {q6}, [r2], r1              ; p0
-    vld1.u8     {q7}, [r2], r1              ; q0
-    vld1.u8     {q8}, [r2], r1              ; q1
-    vld1.u8     {q9}, [r2], r1              ; q2
-    vld1.u8     {q10}, [r2]                 ; q3
-    vld1.s8     {d4[], d5[]}, [r12]         ; thresh
-    sub         r0, r0, r1, lsl #1
+    vdup.u8     q2, r3                     ; duplicate thresh
+
+    vld1.u8     {q3}, [r2@128], r1              ; p3
+    vld1.u8     {q4}, [r12@128], r1             ; p2
+    vld1.u8     {q5}, [r2@128], r1              ; p1
+    vld1.u8     {q6}, [r12@128], r1             ; p0
+    vld1.u8     {q7}, [r2@128], r1              ; q0
+    vld1.u8     {q8}, [r12@128], r1             ; q1
+    vld1.u8     {q9}, [r2@128]                  ; q2
+    vld1.u8     {q10}, [r12@128]                ; q3
+
+    sub         r2, r2, r1, lsl #1
+    sub         r12, r12, r1, lsl #1
 
     bl          vp8_loop_filter_neon
 
-    vst1.u8     {q5}, [r0], r1              ; store op1
-    vst1.u8     {q6}, [r0], r1              ; store op0
-    vst1.u8     {q7}, [r0], r1              ; store oq0
-    vst1.u8     {q8}, [r0], r1              ; store oq1
+    vst1.u8     {q5}, [r2@128], r1              ; store op1
+    vst1.u8     {q6}, [r12@128], r1             ; store op0
+    vst1.u8     {q7}, [r2@128], r1              ; store oq0
+    vst1.u8     {q8}, [r12@128], r1             ; store oq1
 
-    ldmia       sp!, {pc}
+    pop         {pc}
     ENDP        ; |vp8_loop_filter_horizontal_edge_y_neon|
 
-; void vp8_loop_filter_horizontal_edge_uv_neon(unsigned char *u, int pitch
-;                                              const signed char *flimit,
-;                                              const signed char *limit,
-;                                              const signed char *thresh,
-;                                              unsigned char *v)
+
 ; r0    unsigned char *u,
 ; r1    int pitch,
-; r2    const signed char *flimit,
-; r3    const signed char *limit,
-; sp    const signed char *thresh,
+; r2    unsigned char blimit
+; r3    unsigned char limit
+; sp    unsigned char thresh,
 ; sp+4  unsigned char *v
 |vp8_loop_filter_horizontal_edge_uv_neon| PROC
-    stmdb       sp!, {lr}
-    vld1.s8     {d0[], d1[]}, [r2]          ; flimit
-    vld1.s8     {d2[], d3[]}, [r3]          ; limit
+    push        {lr}
+    vdup.u8     q0, r2                      ; duplicate blimit
+    vdup.u8     q1, r3                      ; duplicate limit
+    ldr         r12, [sp, #4]               ; load thresh
     ldr         r2, [sp, #8]                ; load v ptr
+    vdup.u8     q2, r12                     ; duplicate thresh
 
     sub         r3, r0, r1, lsl #2          ; move u pointer down by 4 lines
-    vld1.u8     {d6}, [r3], r1              ; p3
-    vld1.u8     {d8}, [r3], r1              ; p2
-    vld1.u8     {d10}, [r3], r1             ; p1
-    vld1.u8     {d12}, [r3], r1             ; p0
-    vld1.u8     {d14}, [r3], r1             ; q0
-    vld1.u8     {d16}, [r3], r1             ; q1
-    vld1.u8     {d18}, [r3], r1             ; q2
-    vld1.u8     {d20}, [r3]                 ; q3
-
-    ldr         r3, [sp, #4]                ; load thresh pointer
+    sub         r12, r2, r1, lsl #2         ; move v pointer down by 4 lines
 
-    sub         r12, r2, r1, lsl #2         ; move v pointer down by 4 lines
-    vld1.u8     {d7}, [r12], r1             ; p3
-    vld1.u8     {d9}, [r12], r1             ; p2
-    vld1.u8     {d11}, [r12], r1            ; p1
-    vld1.u8     {d13}, [r12], r1            ; p0
-    vld1.u8     {d15}, [r12], r1            ; q0
-    vld1.u8     {d17}, [r12], r1            ; q1
-    vld1.u8     {d19}, [r12], r1            ; q2
-    vld1.u8     {d21}, [r12]                ; q3
-
-    vld1.s8     {d4[], d5[]}, [r3]          ; thresh
+    vld1.u8     {d6}, [r3@64], r1              ; p3
+    vld1.u8     {d7}, [r12@64], r1             ; p3
+    vld1.u8     {d8}, [r3@64], r1              ; p2
+    vld1.u8     {d9}, [r12@64], r1             ; p2
+    vld1.u8     {d10}, [r3@64], r1             ; p1
+    vld1.u8     {d11}, [r12@64], r1            ; p1
+    vld1.u8     {d12}, [r3@64], r1             ; p0
+    vld1.u8     {d13}, [r12@64], r1            ; p0
+    vld1.u8     {d14}, [r3@64], r1             ; q0
+    vld1.u8     {d15}, [r12@64], r1            ; q0
+    vld1.u8     {d16}, [r3@64], r1             ; q1
+    vld1.u8     {d17}, [r12@64], r1            ; q1
+    vld1.u8     {d18}, [r3@64], r1             ; q2
+    vld1.u8     {d19}, [r12@64], r1            ; q2
+    vld1.u8     {d20}, [r3@64]                 ; q3
+    vld1.u8     {d21}, [r12@64]                ; q3
 
     bl          vp8_loop_filter_neon
 
     sub         r0, r0, r1, lsl #1
     sub         r2, r2, r1, lsl #1
 
-    vst1.u8     {d10}, [r0], r1             ; store u op1
-    vst1.u8     {d11}, [r2], r1             ; store v op1
-    vst1.u8     {d12}, [r0], r1             ; store u op0
-    vst1.u8     {d13}, [r2], r1             ; store v op0
-    vst1.u8     {d14}, [r0], r1             ; store u oq0
-    vst1.u8     {d15}, [r2], r1             ; store v oq0
-    vst1.u8     {d16}, [r0]                 ; store u oq1
-    vst1.u8     {d17}, [r2]                 ; store v oq1
+    vst1.u8     {d10}, [r0@64], r1             ; store u op1
+    vst1.u8     {d11}, [r2@64], r1             ; store v op1
+    vst1.u8     {d12}, [r0@64], r1             ; store u op0
+    vst1.u8     {d13}, [r2@64], r1             ; store v op0
+    vst1.u8     {d14}, [r0@64], r1             ; store u oq0
+    vst1.u8     {d15}, [r2@64], r1             ; store v oq0
+    vst1.u8     {d16}, [r0@64]                 ; store u oq1
+    vst1.u8     {d17}, [r2@64]                 ; store v oq1
 
-    ldmia       sp!, {pc}
+    pop         {pc}
     ENDP        ; |vp8_loop_filter_horizontal_edge_uv_neon|
 
 ; void vp8_loop_filter_vertical_edge_y_neon(unsigned char *src, int pitch,
 ;                                           const signed char *flimit,
 ;                                           const signed char *limit,
 ;                                           const signed char *thresh,
 ;                                           int count)
-; r0    unsigned char *src,
-; r1    int pitch,
-; r2    const signed char *flimit,
-; r3    const signed char *limit,
-; sp    const signed char *thresh,
-; sp+4  int count (unused)
+; r0    unsigned char *src
+; r1    int pitch
+; r2    unsigned char blimit
+; r3    unsigned char limit
+; sp    unsigned char thresh,
+
 |vp8_loop_filter_vertical_edge_y_neon| PROC
-    stmdb       sp!, {lr}
-    vld1.s8     {d0[], d1[]}, [r2]          ; flimit
-    vld1.s8     {d2[], d3[]}, [r3]          ; limit
-    sub         r2, r0, #4                  ; src ptr down by 4 columns
-    sub         r0, r0, #2                  ; dst ptr
-    ldr         r12, [sp, #4]               ; load thresh pointer
+    push        {lr}
+    vdup.u8     q0, r2                     ; duplicate blimit
+    vdup.u8     q1, r3                     ; duplicate limit
+    sub         r2, r0, #4                 ; src ptr down by 4 columns
+    add         r1, r1, r1
+    ldr         r3, [sp, #4]               ; load thresh
+    add         r12, r2, r1, asr #1
 
-    vld1.u8     {d6}, [r2], r1              ; load first 8-line src data
-    vld1.u8     {d8}, [r2], r1
+    vld1.u8     {d6}, [r2], r1
+    vld1.u8     {d8}, [r12], r1
     vld1.u8     {d10}, [r2], r1
-    vld1.u8     {d12}, [r2], r1
+    vld1.u8     {d12}, [r12], r1
     vld1.u8     {d14}, [r2], r1
-    vld1.u8     {d16}, [r2], r1
+    vld1.u8     {d16}, [r12], r1
     vld1.u8     {d18}, [r2], r1
-    vld1.u8     {d20}, [r2], r1
-
-    vld1.s8     {d4[], d5[]}, [r12]         ; thresh
+    vld1.u8     {d20}, [r12], r1
 
     vld1.u8     {d7}, [r2], r1              ; load second 8-line src data
-    vld1.u8     {d9}, [r2], r1
+    vld1.u8     {d9}, [r12], r1
     vld1.u8     {d11}, [r2], r1
-    vld1.u8     {d13}, [r2], r1
+    vld1.u8     {d13}, [r12], r1
     vld1.u8     {d15}, [r2], r1
-    vld1.u8     {d17}, [r2], r1
-    vld1.u8     {d19}, [r2], r1
-    vld1.u8     {d21}, [r2]
+    vld1.u8     {d17}, [r12], r1
+    vld1.u8     {d19}, [r2]
+    vld1.u8     {d21}, [r12]
 
     ;transpose to 8x16 matrix
     vtrn.32     q3, q7
     vtrn.32     q4, q8
     vtrn.32     q5, q9
     vtrn.32     q6, q10
 
+    vdup.u8     q2, r3                     ; duplicate thresh
+
+    vtrn.16     q3, q5
+    vtrn.16     q4, q6
+    vtrn.16     q7, q9
+    vtrn.16     q8, q10
+
+    vtrn.8      q3, q4
+    vtrn.8      q5, q6
+    vtrn.8      q7, q8
+    vtrn.8      q9, q10
+
+    bl          vp8_loop_filter_neon
+
+    vswp        d12, d11
+    vswp        d16, d13
+
+    sub         r0, r0, #2                 ; dst ptr
+
+    vswp        d14, d12
+    vswp        d16, d15
+
+    add         r12, r0, r1, asr #1
+
+    ;store op1, op0, oq0, oq1
+    vst4.8      {d10[0], d11[0], d12[0], d13[0]}, [r0], r1
+    vst4.8      {d10[1], d11[1], d12[1], d13[1]}, [r12], r1
+    vst4.8      {d10[2], d11[2], d12[2], d13[2]}, [r0], r1
+    vst4.8      {d10[3], d11[3], d12[3], d13[3]}, [r12], r1
+    vst4.8      {d10[4], d11[4], d12[4], d13[4]}, [r0], r1
+    vst4.8      {d10[5], d11[5], d12[5], d13[5]}, [r12], r1
+    vst4.8      {d10[6], d11[6], d12[6], d13[6]}, [r0], r1
+    vst4.8      {d10[7], d11[7], d12[7], d13[7]}, [r12], r1
+
+    vst4.8      {d14[0], d15[0], d16[0], d17[0]}, [r0], r1
+    vst4.8      {d14[1], d15[1], d16[1], d17[1]}, [r12], r1
+    vst4.8      {d14[2], d15[2], d16[2], d17[2]}, [r0], r1
+    vst4.8      {d14[3], d15[3], d16[3], d17[3]}, [r12], r1
+    vst4.8      {d14[4], d15[4], d16[4], d17[4]}, [r0], r1
+    vst4.8      {d14[5], d15[5], d16[5], d17[5]}, [r12], r1
+    vst4.8      {d14[6], d15[6], d16[6], d17[6]}, [r0]
+    vst4.8      {d14[7], d15[7], d16[7], d17[7]}, [r12]
+
+    pop         {pc}
+    ENDP        ; |vp8_loop_filter_vertical_edge_y_neon|
+
+; void vp8_loop_filter_vertical_edge_uv_neon(unsigned char *u, int pitch
+;                                            const signed char *flimit,
+;                                            const signed char *limit,
+;                                            const signed char *thresh,
+;                                            unsigned char *v)
+; r0    unsigned char *u,
+; r1    int pitch,
+; r2    unsigned char blimit
+; r3    unsigned char limit
+; sp    unsigned char thresh,
+; sp+4  unsigned char *v
+|vp8_loop_filter_vertical_edge_uv_neon| PROC
+    push        {lr}
+    vdup.u8     q0, r2                      ; duplicate blimit
+    sub         r12, r0, #4                 ; move u pointer down by 4 columns
+    ldr         r2, [sp, #8]                ; load v ptr
+    vdup.u8     q1, r3                      ; duplicate limit
+    sub         r3, r2, #4                  ; move v pointer down by 4 columns
+
+    vld1.u8     {d6}, [r12], r1             ;load u data
+    vld1.u8     {d7}, [r3], r1              ;load v data
+    vld1.u8     {d8}, [r12], r1
+    vld1.u8     {d9}, [r3], r1
+    vld1.u8     {d10}, [r12], r1
+    vld1.u8     {d11}, [r3], r1
+    vld1.u8     {d12}, [r12], r1
+    vld1.u8     {d13}, [r3], r1
+    vld1.u8     {d14}, [r12], r1
+    vld1.u8     {d15}, [r3], r1
+    vld1.u8     {d16}, [r12], r1
+    vld1.u8     {d17}, [r3], r1
+    vld1.u8     {d18}, [r12], r1
+    vld1.u8     {d19}, [r3], r1
+    vld1.u8     {d20}, [r12]
+    vld1.u8     {d21}, [r3]
+
+    ldr        r12, [sp, #4]               ; load thresh
+
+    ;transpose to 8x16 matrix
+    vtrn.32     q3, q7
+    vtrn.32     q4, q8
+    vtrn.32     q5, q9
+    vtrn.32     q6, q10
+
+    vdup.u8     q2, r12                     ; duplicate thresh
+
     vtrn.16     q3, q5
     vtrn.16     q4, q6
     vtrn.16     q7, q9
     vtrn.16     q8, q10
 
     vtrn.8      q3, q4
     vtrn.8      q5, q6
     vtrn.8      q7, q8
@@ -176,105 +255,19 @@
 
     bl          vp8_loop_filter_neon
 
     vswp        d12, d11
     vswp        d16, d13
     vswp        d14, d12
     vswp        d16, d15
 
-    ;store op1, op0, oq0, oq1
-    vst4.8      {d10[0], d11[0], d12[0], d13[0]}, [r0], r1
-    vst4.8      {d10[1], d11[1], d12[1], d13[1]}, [r0], r1
-    vst4.8      {d10[2], d11[2], d12[2], d13[2]}, [r0], r1
-    vst4.8      {d10[3], d11[3], d12[3], d13[3]}, [r0], r1
-    vst4.8      {d10[4], d11[4], d12[4], d13[4]}, [r0], r1
-    vst4.8      {d10[5], d11[5], d12[5], d13[5]}, [r0], r1
-    vst4.8      {d10[6], d11[6], d12[6], d13[6]}, [r0], r1
-    vst4.8      {d10[7], d11[7], d12[7], d13[7]}, [r0], r1
-    vst4.8      {d14[0], d15[0], d16[0], d17[0]}, [r0], r1
-    vst4.8      {d14[1], d15[1], d16[1], d17[1]}, [r0], r1
-    vst4.8      {d14[2], d15[2], d16[2], d17[2]}, [r0], r1
-    vst4.8      {d14[3], d15[3], d16[3], d17[3]}, [r0], r1
-    vst4.8      {d14[4], d15[4], d16[4], d17[4]}, [r0], r1
-    vst4.8      {d14[5], d15[5], d16[5], d17[5]}, [r0], r1
-    vst4.8      {d14[6], d15[6], d16[6], d17[6]}, [r0], r1
-    vst4.8      {d14[7], d15[7], d16[7], d17[7]}, [r0]
-
-    ldmia       sp!, {pc}
-    ENDP        ; |vp8_loop_filter_vertical_edge_y_neon|
-
-; void vp8_loop_filter_vertical_edge_uv_neon(unsigned char *u, int pitch
-;                                            const signed char *flimit,
-;                                            const signed char *limit,
-;                                            const signed char *thresh,
-;                                            unsigned char *v)
-; r0    unsigned char *u,
-; r1    int pitch,
-; r2    const signed char *flimit,
-; r3    const signed char *limit,
-; sp    const signed char *thresh,
-; sp+4  unsigned char *v
-|vp8_loop_filter_vertical_edge_uv_neon| PROC
-    stmdb       sp!, {lr}
-    sub         r12, r0, #4                  ; move u pointer down by 4 columns
-    vld1.s8     {d0[], d1[]}, [r2]          ; flimit
-    vld1.s8     {d2[], d3[]}, [r3]          ; limit
-
-    ldr         r2, [sp, #8]                ; load v ptr
-
-    vld1.u8     {d6}, [r12], r1              ;load u data
-    vld1.u8     {d8}, [r12], r1
-    vld1.u8     {d10}, [r12], r1
-    vld1.u8     {d12}, [r12], r1
-    vld1.u8     {d14}, [r12], r1
-    vld1.u8     {d16}, [r12], r1
-    vld1.u8     {d18}, [r12], r1
-    vld1.u8     {d20}, [r12]
-
-    sub         r3, r2, #4                  ; move v pointer down by 4 columns
-    vld1.u8     {d7}, [r3], r1              ;load v data
-    vld1.u8     {d9}, [r3], r1
-    vld1.u8     {d11}, [r3], r1
-    vld1.u8     {d13}, [r3], r1
-    vld1.u8     {d15}, [r3], r1
-    vld1.u8     {d17}, [r3], r1
-    vld1.u8     {d19}, [r3], r1
-    vld1.u8     {d21}, [r3]
-
-    ldr         r12, [sp, #4]               ; load thresh pointer
-
-    ;transpose to 8x16 matrix
-    vtrn.32     q3, q7
-    vtrn.32     q4, q8
-    vtrn.32     q5, q9
-    vtrn.32     q6, q10
-