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

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

Issue 5143004: Split out the random number state between JavaScript and private API... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/v8.h » ('j') | src/v8.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 // VirtualAlloc rounds allocated size to page size automatically. 859 // VirtualAlloc rounds allocated size to page size automatically.
860 size_t msize = RoundUp(requested, static_cast<int>(GetPageSize())); 860 size_t msize = RoundUp(requested, static_cast<int>(GetPageSize()));
861 intptr_t address = NULL; 861 intptr_t address = NULL;
862 862
863 // Windows XP SP2 allows Data Excution Prevention (DEP). 863 // Windows XP SP2 allows Data Excution Prevention (DEP).
864 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; 864 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
865 865
866 // For exectutable pages try and randomize the allocation address 866 // For exectutable pages try and randomize the allocation address
867 if (prot == PAGE_EXECUTE_READWRITE && msize >= Page::kPageSize) { 867 if (prot == PAGE_EXECUTE_READWRITE && msize >= Page::kPageSize) {
868 address = (V8::Random() << kPageSizeBits) | kAllocationRandomAddressMin; 868 address = (V8::RandomPrivate() << kPageSizeBits)
869 address &= kAllocationRandomAddressMax; 869 | kAllocationRandomAddressMin;
870 address &= kAllocationRandomAddressMax;
870 } 871 }
871 872
872 LPVOID mbase = VirtualAlloc(reinterpret_cast<void *>(address), 873 LPVOID mbase = VirtualAlloc(reinterpret_cast<void *>(address),
873 msize, 874 msize,
874 MEM_COMMIT | MEM_RESERVE, 875 MEM_COMMIT | MEM_RESERVE,
875 prot); 876 prot);
876 if (mbase == NULL && address != NULL) 877 if (mbase == NULL && address != NULL)
877 mbase = VirtualAlloc(NULL, msize, MEM_COMMIT | MEM_RESERVE, prot); 878 mbase = VirtualAlloc(NULL, msize, MEM_COMMIT | MEM_RESERVE, prot);
878 879
879 if (mbase == NULL) { 880 if (mbase == NULL) {
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 1953
1953 // Release the thread handles 1954 // Release the thread handles
1954 CloseHandle(data_->sampler_thread_); 1955 CloseHandle(data_->sampler_thread_);
1955 CloseHandle(data_->profiled_thread_); 1956 CloseHandle(data_->profiled_thread_);
1956 } 1957 }
1957 1958
1958 1959
1959 #endif // ENABLE_LOGGING_AND_PROFILING 1960 #endif // ENABLE_LOGGING_AND_PROFILING
1960 1961
1961 } } // namespace v8::internal 1962 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/v8.h » ('j') | src/v8.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698