summaryrefslogtreecommitdiffstats
path: root/chrome/installer/mini_installer
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 17:01:37 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 17:01:37 +0000
commit96c1332eb584390eba5e1d775f16509247d55364 (patch)
treebbc7db718f8ea61681064413db81a76a62ca0e06 /chrome/installer/mini_installer
parentaf0fb48dc98b57fced84d4d0370cd8f2ab809191 (diff)
downloadchromium_src-96c1332eb584390eba5e1d775f16509247d55364.zip
chromium_src-96c1332eb584390eba5e1d775f16509247d55364.tar.gz
chromium_src-96c1332eb584390eba5e1d775f16509247d55364.tar.bz2
Simpler memset, avoids ICE on VS2013 Update2
The previous code is causing: FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\chrome\installer\mini_installer\mini_installer.mini_installer.obj.rsp /c ..\..\chrome\installer\mini_installer\mini_installer.cc /Foobj\chrome\installer\mini_installer\mini_installer.mini_installer.obj /Fdobj\chrome\installer\mini_installer.cc.pdb c:\b\build\slave\win-latest-rel\build\src\chrome\installer\mini_installer\mini_installer.cc(857) : fatalerror C1001: An internal error has occurred in the compiler. (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 228) To work around this problem, try simplifying or changing the program near the locations listed above. Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information INTERNAL COMPILER ERROR in 'C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe' Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information after Update 2. The CRT's implementation looks like the simple char loop, so simplify here too. In practice, I think this will only rarely get used, as the compiler is allowed to "know" what memset does and replace it with an optimized version. There's an upstream bug filed here: https://connect.microsoft.com/VisualStudio/feedback/details/878340/ice-on-memset-implementation-at-o2 R=grt@chromium.org BUG=372451 Review URL: https://codereview.chromium.org/294943005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271919 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/mini_installer')
-rw-r--r--chrome/installer/mini_installer/mini_installer.cc28
1 files changed, 5 insertions, 23 deletions
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc
index 28a8057..25b0c80 100644
--- a/chrome/installer/mini_installer/mini_installer.cc
+++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -834,29 +834,11 @@ int MainEntryPoint() {
extern "C" {
#pragma function(memset)
void* memset(void* dest, int c, size_t count) {
- // Simplistic 32-bit memset C implementation which assumes properly aligned
- // memory; performance hit on memory that isn't properly aligned, but still
- // better overall then a 8-bit implementation.
- size_t adjcount = count >> 2;
- UINT32 fill = (c << 24 | c << 16 | c << 8 | c);
- UINT32* dest32 = reinterpret_cast<UINT32*>(dest);
- UINT8* dest8 = reinterpret_cast<UINT8*>(dest);
-
- // Take care of the ending 0-3 bytes (binary 11 = 3). The lack of breaks is
- // deliberate; it falls through for each byte. Think of it a simplified for
- // loop.
- switch (count - (adjcount << 2)) {
- case 3:
- dest8[count - 3] = c;
- case 2:
- dest8[count - 2] = c;
- case 1:
- dest8[count - 1] = c;
+ void* start = dest;
+ while (count--) {
+ *reinterpret_cast<char*>(dest) = static_cast<char>(c);
+ dest = reinterpret_cast<char*>(dest) + 1;
}
-
- while (adjcount-- > 0) // Copy the rest, 4 bytes/32 bits at a time
- *(dest32++) = fill;
-
- return dest;
+ return start;
}
} // extern "C"