| OLD | NEW | 
|---|
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 96 | 96 | 
| 97 | 97 | 
| 98 // We keep the lowest and highest addresses mapped as a quick way of | 98 // We keep the lowest and highest addresses mapped as a quick way of | 
| 99 // determining that pointers are outside the heap (used mostly in assertions | 99 // determining that pointers are outside the heap (used mostly in assertions | 
| 100 // and verification).  The estimate is conservative, ie, not all addresses in | 100 // and verification).  The estimate is conservative, ie, not all addresses in | 
| 101 // 'allocated' space are actually allocated to our heap.  The range is | 101 // 'allocated' space are actually allocated to our heap.  The range is | 
| 102 // [lowest, highest), inclusive on the low and and exclusive on the high end. | 102 // [lowest, highest), inclusive on the low and and exclusive on the high end. | 
| 103 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1); | 103 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1); | 
| 104 static void* highest_ever_allocated = reinterpret_cast<void*>(0); | 104 static void* highest_ever_allocated = reinterpret_cast<void*>(0); | 
| 105 | 105 | 
|  | 106 static MutexLockAdapter heap_limits_lock(OS::CreateMutex()); | 
| 106 | 107 | 
| 107 static void UpdateAllocatedSpaceLimits(void* address, int size) { | 108 static void UpdateAllocatedSpaceLimits(void* address, int size) { | 
|  | 109   V8SharedStateLocker heap_limits_locker(&heap_limits_lock); | 
| 108   lowest_ever_allocated = Min(lowest_ever_allocated, address); | 110   lowest_ever_allocated = Min(lowest_ever_allocated, address); | 
| 109   highest_ever_allocated = | 111   highest_ever_allocated = | 
| 110       Max(highest_ever_allocated, | 112       Max(highest_ever_allocated, | 
| 111           reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size)); | 113           reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size)); | 
| 112 } | 114 } | 
| 113 | 115 | 
| 114 | 116 | 
| 115 bool OS::IsOutsideAllocatedSpace(void* address) { | 117 bool OS::IsOutsideAllocatedSpace(void* address) { | 
|  | 118   V8SharedStateLocker heap_limits_locker(&heap_limits_lock); | 
| 116   return address < lowest_ever_allocated || address >= highest_ever_allocated; | 119   return address < lowest_ever_allocated || address >= highest_ever_allocated; | 
| 117 } | 120 } | 
| 118 | 121 | 
| 119 | 122 | 
| 120 size_t OS::AllocateAlignment() { | 123 size_t OS::AllocateAlignment() { | 
| 121   return getpagesize(); | 124   return getpagesize(); | 
| 122 } | 125 } | 
| 123 | 126 | 
| 124 | 127 | 
| 125 void* OS::Allocate(const size_t requested, | 128 void* OS::Allocate(const size_t requested, | 
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 636   } | 639   } | 
| 637 | 640 | 
| 638   // This sampler is no longer the active sampler. | 641   // This sampler is no longer the active sampler. | 
| 639   active_sampler_ = NULL; | 642   active_sampler_ = NULL; | 
| 640   active_ = false; | 643   active_ = false; | 
| 641 } | 644 } | 
| 642 | 645 | 
| 643 #endif  // ENABLE_LOGGING_AND_PROFILING | 646 #endif  // ENABLE_LOGGING_AND_PROFILING | 
| 644 | 647 | 
| 645 } }  // namespace v8::internal | 648 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|