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

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

Issue 2807031: [Isolates] RegExpStack and memory allocation limits (statics #6) (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: -> is different than . Created 10 years, 5 months 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/platform-macos.cc ('k') | src/regexp-macro-assembler.cc » ('j') | no next file with comments »
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 218
219 namespace v8 { 219 namespace v8 {
220 namespace internal { 220 namespace internal {
221 221
222 double ceiling(double x) { 222 double ceiling(double x) {
223 return ceil(x); 223 return ceil(x);
224 } 224 }
225 225
226
227 static Mutex* limit_mutex = NULL;
228
229
226 #ifdef _WIN64 230 #ifdef _WIN64
227 typedef double (*ModuloFunction)(double, double); 231 typedef double (*ModuloFunction)(double, double);
228 232
229 // Defined in codegen-x64.cc. 233 // Defined in codegen-x64.cc.
230 ModuloFunction CreateModuloFunction(); 234 ModuloFunction CreateModuloFunction();
231 235
232 double modulo(double x, double y) { 236 double modulo(double x, double y) {
233 static ModuloFunction function = CreateModuloFunction(); 237 static ModuloFunction function = CreateModuloFunction();
234 return function(x, y); 238 return function(x, y);
235 } 239 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 587
584 588
585 void OS::Setup() { 589 void OS::Setup() {
586 // Seed the random number generator. 590 // Seed the random number generator.
587 // Convert the current time to a 64-bit integer first, before converting it 591 // Convert the current time to a 64-bit integer first, before converting it
588 // to an unsigned. Going directly can cause an overflow and the seed to be 592 // to an unsigned. Going directly can cause an overflow and the seed to be
589 // set to all ones. The seed will be identical for different instances that 593 // set to all ones. The seed will be identical for different instances that
590 // call this setup code within the same millisecond. 594 // call this setup code within the same millisecond.
591 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); 595 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis());
592 srand(static_cast<unsigned int>(seed)); 596 srand(static_cast<unsigned int>(seed));
597 limit_mutex = CreateMutex();
593 } 598 }
594 599
595 600
596 // Returns the accumulated user time for thread. 601 // Returns the accumulated user time for thread.
597 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { 602 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
598 FILETIME dummy; 603 FILETIME dummy;
599 uint64_t usertime; 604 uint64_t usertime;
600 605
601 // Get the amount of time that the thread has executed in user mode. 606 // Get the amount of time that the thread has executed in user mode.
602 if (!GetThreadTimes(GetCurrentThread(), &dummy, &dummy, &dummy, 607 if (!GetThreadTimes(GetCurrentThread(), &dummy, &dummy, &dummy,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 // We keep the lowest and highest addresses mapped as a quick way of 789 // We keep the lowest and highest addresses mapped as a quick way of
785 // determining that pointers are outside the heap (used mostly in assertions 790 // determining that pointers are outside the heap (used mostly in assertions
786 // and verification). The estimate is conservative, ie, not all addresses in 791 // and verification). The estimate is conservative, ie, not all addresses in
787 // 'allocated' space are actually allocated to our heap. The range is 792 // 'allocated' space are actually allocated to our heap. The range is
788 // [lowest, highest), inclusive on the low and and exclusive on the high end. 793 // [lowest, highest), inclusive on the low and and exclusive on the high end.
789 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1); 794 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1);
790 static void* highest_ever_allocated = reinterpret_cast<void*>(0); 795 static void* highest_ever_allocated = reinterpret_cast<void*>(0);
791 796
792 797
793 static void UpdateAllocatedSpaceLimits(void* address, int size) { 798 static void UpdateAllocatedSpaceLimits(void* address, int size) {
799 ASSERT(limit_mutex != NULL);
800 ScopedLock lock(limit_mutex);
801
794 lowest_ever_allocated = Min(lowest_ever_allocated, address); 802 lowest_ever_allocated = Min(lowest_ever_allocated, address);
795 highest_ever_allocated = 803 highest_ever_allocated =
796 Max(highest_ever_allocated, 804 Max(highest_ever_allocated,
797 reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size)); 805 reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size));
798 } 806 }
799 807
800 808
801 bool OS::IsOutsideAllocatedSpace(void* pointer) { 809 bool OS::IsOutsideAllocatedSpace(void* pointer) {
802 if (pointer < lowest_ever_allocated || pointer >= highest_ever_allocated) 810 if (pointer < lowest_ever_allocated || pointer >= highest_ever_allocated)
803 return true; 811 return true;
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 1910
1903 // Release the thread handles 1911 // Release the thread handles
1904 CloseHandle(data_->sampler_thread_); 1912 CloseHandle(data_->sampler_thread_);
1905 CloseHandle(data_->profiled_thread_); 1913 CloseHandle(data_->profiled_thread_);
1906 } 1914 }
1907 1915
1908 1916
1909 #endif // ENABLE_LOGGING_AND_PROFILING 1917 #endif // ENABLE_LOGGING_AND_PROFILING
1910 1918
1911 } } // namespace v8::internal 1919 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-macos.cc ('k') | src/regexp-macro-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698