Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: src/platform-win32.cc

Issue 390004: Fix warnings on Win64. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 allocate_alignment = info.dwAllocationGranularity; 832 allocate_alignment = info.dwAllocationGranularity;
833 } 833 }
834 return allocate_alignment; 834 return allocate_alignment;
835 } 835 }
836 836
837 837
838 void* OS::Allocate(const size_t requested, 838 void* OS::Allocate(const size_t requested,
839 size_t* allocated, 839 size_t* allocated,
840 bool is_executable) { 840 bool is_executable) {
841 // VirtualAlloc rounds allocated size to page size automatically. 841 // VirtualAlloc rounds allocated size to page size automatically.
842 size_t msize = RoundUp(requested, GetPageSize()); 842 size_t msize = RoundUp(requested, static_cast<int>(GetPageSize()));
843 843
844 // Windows XP SP2 allows Data Excution Prevention (DEP). 844 // Windows XP SP2 allows Data Excution Prevention (DEP).
845 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; 845 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
846 LPVOID mbase = VirtualAlloc(NULL, msize, MEM_COMMIT | MEM_RESERVE, prot); 846 LPVOID mbase = VirtualAlloc(NULL, msize, MEM_COMMIT | MEM_RESERVE, prot);
847 if (mbase == NULL) { 847 if (mbase == NULL) {
848 LOG(StringEvent("OS::Allocate", "VirtualAlloc failed")); 848 LOG(StringEvent("OS::Allocate", "VirtualAlloc failed"));
849 return NULL; 849 return NULL;
850 } 850 }
851 851
852 ASSERT(IsAligned(reinterpret_cast<size_t>(mbase), OS::AllocateAlignment())); 852 ASSERT(IsAligned(reinterpret_cast<size_t>(mbase), OS::AllocateAlignment()));
853 853
854 *allocated = msize; 854 *allocated = msize;
855 UpdateAllocatedSpaceLimits(mbase, msize); 855 UpdateAllocatedSpaceLimits(mbase, static_cast<int>(msize));
856 return mbase; 856 return mbase;
857 } 857 }
858 858
859 859
860 void OS::Free(void* address, const size_t size) { 860 void OS::Free(void* address, const size_t size) {
861 // TODO(1240712): VirtualFree has a return value which is ignored here. 861 // TODO(1240712): VirtualFree has a return value which is ignored here.
862 VirtualFree(address, 0, MEM_RELEASE); 862 VirtualFree(address, 0, MEM_RELEASE);
863 USE(size); 863 USE(size);
864 } 864 }
865 865
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 } 1354 }
1355 } 1355 }
1356 1356
1357 1357
1358 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { 1358 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
1359 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; 1359 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
1360 if (NULL == VirtualAlloc(address, size, MEM_COMMIT, prot)) { 1360 if (NULL == VirtualAlloc(address, size, MEM_COMMIT, prot)) {
1361 return false; 1361 return false;
1362 } 1362 }
1363 1363
1364 UpdateAllocatedSpaceLimits(address, size); 1364 UpdateAllocatedSpaceLimits(address, static_cast<int>(size));
1365 return true; 1365 return true;
1366 } 1366 }
1367 1367
1368 1368
1369 bool VirtualMemory::Uncommit(void* address, size_t size) { 1369 bool VirtualMemory::Uncommit(void* address, size_t size) {
1370 ASSERT(IsReserved()); 1370 ASSERT(IsReserved());
1371 return VirtualFree(address, size, MEM_DECOMMIT) != FALSE; 1371 return VirtualFree(address, size, MEM_DECOMMIT) != FALSE;
1372 } 1372 }
1373 1373
1374 1374
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 memset(&hints, 0, sizeof(addrinfo)); 1682 memset(&hints, 0, sizeof(addrinfo));
1683 hints.ai_family = AF_INET; 1683 hints.ai_family = AF_INET;
1684 hints.ai_socktype = SOCK_STREAM; 1684 hints.ai_socktype = SOCK_STREAM;
1685 hints.ai_protocol = IPPROTO_TCP; 1685 hints.ai_protocol = IPPROTO_TCP;
1686 int status = getaddrinfo(host, port, &hints, &result); 1686 int status = getaddrinfo(host, port, &hints, &result);
1687 if (status != 0) { 1687 if (status != 0) {
1688 return false; 1688 return false;
1689 } 1689 }
1690 1690
1691 // Connect. 1691 // Connect.
1692 status = connect(socket_, result->ai_addr, result->ai_addrlen); 1692 status = connect(socket_,
1693 result->ai_addr,
1694 static_cast<int>(result->ai_addrlen));
1693 freeaddrinfo(result); 1695 freeaddrinfo(result);
1694 return status == 0; 1696 return status == 0;
1695 } 1697 }
1696 1698
1697 1699
1698 bool Win32Socket::Shutdown() { 1700 bool Win32Socket::Shutdown() {
1699 if (IsValid()) { 1701 if (IsValid()) {
1700 // Shutdown socket for both read and write. 1702 // Shutdown socket for both read and write.
1701 int status = shutdown(socket_, SD_BOTH); 1703 int status = shutdown(socket_, SD_BOTH);
1702 closesocket(socket_); 1704 closesocket(socket_);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 1894
1893 // Release the thread handles 1895 // Release the thread handles
1894 CloseHandle(data_->sampler_thread_); 1896 CloseHandle(data_->sampler_thread_);
1895 CloseHandle(data_->profiled_thread_); 1897 CloseHandle(data_->profiled_thread_);
1896 } 1898 }
1897 1899
1898 1900
1899 #endif // ENABLE_LOGGING_AND_PROFILING 1901 #endif // ENABLE_LOGGING_AND_PROFILING
1900 1902
1901 } } // namespace v8::internal 1903 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/objects-inl.h ('k') | src/regexp-stack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698