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

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

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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-linux.cc ('k') | src/platform-openbsd.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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 99
100 // We keep the lowest and highest addresses mapped as a quick way of 100 // We keep the lowest and highest addresses mapped as a quick way of
101 // determining that pointers are outside the heap (used mostly in assertions 101 // determining that pointers are outside the heap (used mostly in assertions
102 // and verification). The estimate is conservative, ie, not all addresses in 102 // and verification). The estimate is conservative, ie, not all addresses in
103 // 'allocated' space are actually allocated to our heap. The range is 103 // 'allocated' space are actually allocated to our heap. The range is
104 // [lowest, highest), inclusive on the low and and exclusive on the high end. 104 // [lowest, highest), inclusive on the low and and exclusive on the high end.
105 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1); 105 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1);
106 static void* highest_ever_allocated = reinterpret_cast<void*>(0); 106 static void* highest_ever_allocated = reinterpret_cast<void*>(0);
107 107
108 static MutexLockAdapter heap_limits_lock(OS::CreateMutex());
108 109
109 static void UpdateAllocatedSpaceLimits(void* address, int size) { 110 static void UpdateAllocatedSpaceLimits(void* address, int size) {
111 V8SharedStateLocker heap_limits_locker(&heap_limits_lock);
110 lowest_ever_allocated = Min(lowest_ever_allocated, address); 112 lowest_ever_allocated = Min(lowest_ever_allocated, address);
111 highest_ever_allocated = 113 highest_ever_allocated =
112 Max(highest_ever_allocated, 114 Max(highest_ever_allocated,
113 reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size)); 115 reinterpret_cast<void*>(reinterpret_cast<char*>(address) + size));
114 } 116 }
115 117
116 118
117 bool OS::IsOutsideAllocatedSpace(void* address) { 119 bool OS::IsOutsideAllocatedSpace(void* address) {
120 V8SharedStateLocker heap_limits_locker(&heap_limits_lock);
118 return address < lowest_ever_allocated || address >= highest_ever_allocated; 121 return address < lowest_ever_allocated || address >= highest_ever_allocated;
119 } 122 }
120 123
121 124
122 size_t OS::AllocateAlignment() { 125 size_t OS::AllocateAlignment() {
123 return getpagesize(); 126 return getpagesize();
124 } 127 }
125 128
126 129
127 // Constants used for mmap. 130 // Constants used for mmap.
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 637
635 // Deallocate Mach port for thread. 638 // Deallocate Mach port for thread.
636 if (IsProfiling()) { 639 if (IsProfiling()) {
637 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); 640 mach_port_deallocate(data_->task_self_, data_->profiled_thread_);
638 } 641 }
639 } 642 }
640 643
641 #endif // ENABLE_LOGGING_AND_PROFILING 644 #endif // ENABLE_LOGGING_AND_PROFILING
642 645
643 } } // namespace v8::internal 646 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | src/platform-openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698