View | Details | Raw Unified | Return to bug 162019
Collapse All | Expand All

(-)/usr/ports/www/node-devel/Makefile (-1 / +1 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	node
8
PORTNAME=	node
9
PORTVERSION=	0.5.9
9
PORTVERSION=	0.5.10
10
CATEGORIES=	www
10
CATEGORIES=	www
11
MASTER_SITES=	http://nodejs.org/dist/v${PORTVERSION}/
11
MASTER_SITES=	http://nodejs.org/dist/v${PORTVERSION}/
12
PKGNAMESUFFIX=	-devel
12
PKGNAMESUFFIX=	-devel
(-)/usr/ports/www/node-devel/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (node-v0.5.9.tar.gz) = 5659cde8b36cf5c29433e73a351b0bacfac16be1b0b47e64ea138fe270b5607f
1
SHA256 (node-v0.5.10.tar.gz) = 56396854f85a0d2fafc038436be3d84041f991f59613761e61295fc02d662a40
2
SIZE (node-v0.5.9.tar.gz) = 9180989
2
SIZE (node-v0.5.10.tar.gz) = 9325420
(-)/usr/ports/www/node-devel/files/patch-deps-uv-config-unix.mk (-13 lines)
Lines 1-13 Link Here
1
--- deps/uv/config-unix.mk.orig	2011-08-05 10:43:22.000000000 +0800
2
+++ deps/uv/config-unix.mk	2011-08-05 10:43:28.000000000 +0800
3
@@ -18,8 +18,8 @@
4
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
5
 # IN THE SOFTWARE.
6
 
7
-CC = $(PREFIX)gcc
8
-AR = $(PREFIX)ar
9
+#CC = $(PREFIX)gcc
10
+#AR = $(PREFIX)ar
11
 E=
12
 CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
13
 CFLAGS=-g
(-)/usr/ports/www/node-devel/files/patch-platform-freebsd.cc (+136 lines)
Line 0 Link Here
1
--- deps/v8/src/platform-freebsd.cc.orig	2011-10-25 19:44:21.000000000 +0800
2
+++ deps/v8/src/platform-freebsd.cc	2011-10-25 20:08:08.000000000 +0800
3
@@ -333,32 +333,96 @@ int OS::StackWalk(Vector<OS::StackFrame>
4
 static const int kMmapFd = -1;
5
 static const int kMmapFdOffset = 0;
6
 
7
+VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { }
8
+
9
+
10
+VirtualMemory::VirtualMemory(size_t size)
11
+    : address_(ReserveRegion(size)), size_(size) { }
12
 
13
-VirtualMemory::VirtualMemory(size_t size) {
14
-  address_ = mmap(NULL, size, PROT_NONE,
15
-                  MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
16
-                  kMmapFd, kMmapFdOffset);
17
-  size_ = size;
18
-}
19
 
20
+VirtualMemory::VirtualMemory(size_t size, size_t alignment)
21
+    : address_(NULL), size_(0) {
22
+  ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment())));
23
+  size_t request_size = RoundUp(size + alignment,
24
+                                static_cast<intptr_t>(OS::AllocateAlignment()));
25
+  void* reservation = mmap(OS::GetRandomMmapAddr(),
26
+                           request_size,
27
+                           PROT_NONE,
28
+                           MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
29
+                           kMmapFd,
30
+                           kMmapFdOffset);
31
+  if (reservation == MAP_FAILED) return;
32
+
33
+  Address base = static_cast<Address>(reservation);
34
+  Address aligned_base = RoundUp(base, alignment);
35
+  ASSERT_LE(base, aligned_base);
36
+
37
+  // Unmap extra memory reserved before and after the desired block.
38
+  if (aligned_base != base) {
39
+    size_t prefix_size = static_cast<size_t>(aligned_base - base);
40
+    OS::Free(base, prefix_size);
41
+    request_size -= prefix_size;
42
+  }
43
+
44
+  size_t aligned_size = RoundUp(size, OS::AllocateAlignment());
45
+  ASSERT_LE(aligned_size, request_size);
46
+
47
+  if (aligned_size != request_size) {
48
+    size_t suffix_size = request_size - aligned_size;
49
+    OS::Free(aligned_base + aligned_size, suffix_size);
50
+    request_size -= suffix_size;
51
+  }
52
+
53
+  ASSERT(aligned_size == request_size);
54
+
55
+  address_ = static_cast<void*>(aligned_base);
56
+  size_ = aligned_size;
57
+}
58
 
59
 VirtualMemory::~VirtualMemory() {
60
   if (IsReserved()) {
61
-    if (0 == munmap(address(), size())) address_ = MAP_FAILED;
62
+    bool result = ReleaseRegion(address(), size());
63
+    ASSERT(result);
64
+    USE(result);
65
   }
66
 }
67
 
68
+void VirtualMemory::Reset() {
69
+  address_ = NULL;
70
+  size_ = 0;
71
+}
72
+
73
+void* VirtualMemory::ReserveRegion(size_t size) {
74
+  void* result = mmap(OS::GetRandomMmapAddr(),
75
+                      size,
76
+                      PROT_NONE,
77
+                      MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
78
+                      kMmapFd,
79
+                      kMmapFdOffset);
80
+
81
+  if (result == MAP_FAILED) return NULL;
82
+
83
+  return result;
84
+}
85
 
86
 bool VirtualMemory::IsReserved() {
87
   return address_ != MAP_FAILED;
88
 }
89
 
90
+bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
91
+  return CommitRegion(address, size, is_executable);
92
+}
93
 
94
-bool VirtualMemory::Commit(void* address, size_t size, bool executable) {
95
-  int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0);
96
-  if (MAP_FAILED == mmap(address, size, prot,
97
+bool VirtualMemory::CommitRegion(void* address,
98
+                                 size_t size,
99
+                                 bool is_executable) {
100
+  int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
101
+  if (MAP_FAILED == mmap(address,
102
+                         size,
103
+                         prot,
104
                          MAP_PRIVATE | MAP_ANON | MAP_FIXED,
105
-                         kMmapFd, kMmapFdOffset)) {
106
+                         kMmapFd,
107
+                         kMmapFdOffset)) {
108
     return false;
109
   }
110
 
111
@@ -366,13 +430,22 @@ bool VirtualMemory::Commit(void* address
112
   return true;
113
 }
114
 
115
-
116
 bool VirtualMemory::Uncommit(void* address, size_t size) {
117
-  return mmap(address, size, PROT_NONE,
118
+  return UncommitRegion(address, size);
119
+}
120
+
121
+bool VirtualMemory::UncommitRegion(void* address, size_t size) {
122
+  return mmap(address,
123
+              size,
124
+              PROT_NONE,
125
               MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_FIXED,
126
-              kMmapFd, kMmapFdOffset) != MAP_FAILED;
127
+              kMmapFd,
128
+              kMmapFdOffset) != MAP_FAILED;
129
 }
130
 
131
+bool VirtualMemory::ReleaseRegion(void* address, size_t size) {
132
+  return munmap(address, size) == 0;
133
+}
134
 
135
 class Thread::PlatformData : public Malloced {
136
  public:

Return to bug 162019