Reviewers: Michael Starzinger,

Description:
Merge r11471 from the bleeding_edge to the 3.9 branch.

Don't ignore return value of CommitCodePage in AllocateAlignedMemory.

Release the mapping as whole if commit failed to avoid leaking virtual address
space.

[email protected]
BUG=chromium:118625

Review URL: https://chromiumcodereview.appspot.com/10260012
------------------------------------------------------------------------

Please review this at https://chromiumcodereview.appspot.com/10270015/

SVN Base: http://v8.googlecode.com/svn/branches/3.9/

Affected files:
  M     src/spaces.h
  M     src/spaces.cc
  M     src/version.cc


Index: src/spaces.cc
===================================================================
--- src/spaces.cc       (revision 11472)
+++ src/spaces.cc       (working copy)
@@ -362,15 +362,22 @@
   if (base == NULL) return NULL;

   if (executable == EXECUTABLE) {
-    CommitCodePage(&reservation, base, size);
+    if (!CommitCodePage(&reservation, base, size)) {
+      base = NULL;
+    }
   } else {
-    if (!reservation.Commit(base,
-                            size,
-                            executable == EXECUTABLE)) {
-      return NULL;
+    if (!reservation.Commit(base, size, false)) {
+      base = NULL;
     }
   }

+  if (base == NULL) {
+    // Failed to commit the body. Release the mapping and any partially
+    // commited regions inside it.
+    reservation.Release();
+    return NULL;
+  }
+
   controller->TakeControl(&reservation);
   return base;
 }
Index: src/spaces.h
===================================================================
--- src/spaces.h        (revision 11472)
+++ src/spaces.h        (working copy)
@@ -1040,7 +1040,9 @@
     return CodePageAreaEndOffset() - CodePageAreaStartOffset();
   }

- static bool CommitCodePage(VirtualMemory* vm, Address start, size_t size);
+  MUST_USE_RESULT static bool CommitCodePage(VirtualMemory* vm,
+                                             Address start,
+                                             size_t size);

  private:
   Isolate* isolate_;
Index: src/version.cc
===================================================================
--- src/version.cc      (revision 11472)
+++ src/version.cc      (working copy)
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     9
 #define BUILD_NUMBER      24
-#define PATCH_LEVEL       17
+#define PATCH_LEVEL       18
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to