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

Issue 23641009: Refactor and cleanup VirtualMemory. (Closed)

Created:
7 years, 3 months ago by Benedikt Meurer
Modified:
7 years, 3 months ago
Reviewers:
Toon Verwaest
CC:
v8-dev
Visibility:
Public.

Description

Refactor and cleanup VirtualMemory. Remove a lot of platform duplication, and simplify the virtual memory implementation. Also improve readability by avoiding bool parameters for executability (use a dedicated Executability type instead). Get rid of the Isolate::UncheckedCurrent() call in the platform code, as part of the Isolate TLS cleanup. Use a dedicated random number generator for the address randomization, instead of messing with the per-isolate random number generators. TEST=cctest/test-virtual-memory R=verwaest@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=16637

Patch Set 1 #

Patch Set 2 : Remove useless test case. #

Total comments: 8

Patch Set 3 : Addressed nits. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1181 lines, -1829 lines) Patch
M include/v8config.h View 4 chunks +25 lines, -0 lines 0 comments Download
M src/arm/codegen-arm.cc View 1 2 6 chunks +15 lines, -6 lines 0 comments Download
M src/deoptimizer.cc View 2 chunks +3 lines, -9 lines 0 comments Download
M src/heap.cc View 1 2 11 chunks +15 lines, -14 lines 0 comments Download
M src/heap-inl.h View 1 2 3 chunks +4 lines, -3 lines 0 comments Download
M src/ia32/codegen-ia32.cc View 1 2 8 chunks +20 lines, -12 lines 0 comments Download
M src/incremental-marking.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/mips/codegen-mips.cc View 1 2 2 chunks +5 lines, -2 lines 0 comments Download
M src/platform.h View 3 chunks +0 lines, -121 lines 0 comments Download
M src/platform-cygwin.cc View 1 2 3 chunks +2 lines, -138 lines 0 comments Download
M src/platform-freebsd.cc View 1 2 2 chunks +0 lines, -153 lines 0 comments Download
M src/platform-linux.cc View 1 2 6 chunks +17 lines, -165 lines 0 comments Download
M src/platform-macos.cc View 5 chunks +3 lines, -164 lines 0 comments Download
M src/platform-openbsd.cc View 1 2 2 chunks +0 lines, -154 lines 0 comments Download
M src/platform-posix.cc View 2 chunks +0 lines, -102 lines 0 comments Download
M src/platform-solaris.cc View 1 2 2 chunks +0 lines, -153 lines 0 comments Download
M src/platform-win32.cc View 1 2 4 chunks +0 lines, -236 lines 0 comments Download
A src/platform/virtual-memory.h View 1 2 1 chunk +211 lines, -0 lines 0 comments Download
A src/platform/virtual-memory.cc View 1 2 1 chunk +510 lines, -0 lines 0 comments Download
M src/spaces.h View 1 2 15 chunks +40 lines, -26 lines 0 comments Download
M src/spaces.cc View 1 2 32 chunks +86 lines, -72 lines 0 comments Download
M src/spaces-inl.h View 1 2 1 chunk +1 line, -33 lines 0 comments Download
M src/store-buffer.cc View 1 2 4 chunks +5 lines, -4 lines 0 comments Download
M src/v8globals.h View 1 chunk +0 lines, -2 lines 0 comments Download
M src/x64/codegen-x64.cc View 1 2 7 chunks +18 lines, -11 lines 0 comments Download
M test/cctest/cctest.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M test/cctest/test-assembler-x64.cc View 8 chunks +29 lines, -49 lines 0 comments Download
M test/cctest/test-code-stubs-arm.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M test/cctest/test-code-stubs-ia32.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M test/cctest/test-code-stubs-x64.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M test/cctest/test-macro-assembler-x64.cc View 23 chunks +89 lines, -125 lines 0 comments Download
M test/cctest/test-platform-linux.cc View 1 chunk +0 lines, -14 lines 0 comments Download
M test/cctest/test-platform-win32.cc View 1 chunk +0 lines, -14 lines 0 comments Download
M test/cctest/test-spaces.cc View 11 chunks +20 lines, -18 lines 0 comments Download
A + test/cctest/test-virtual-memory.cc View 1 2 chunks +47 lines, -19 lines 0 comments Download
M tools/gyp/v8.gyp View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Benedikt Meurer
Hey Toon, Here's the VirtualMemory refactoring, as promised. :-) Mostly mechanical, PTAL. -- Benedikt
7 years, 3 months ago (2013-09-10 13:34:38 UTC) #1
Toon Verwaest
lgtm with nits https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memory.cc File src/platform/virtual-memory.cc (right): https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memory.cc#newcode171 src/platform/virtual-memory.cc:171: // After three attempts give up ...
7 years, 3 months ago (2013-09-10 15:11:40 UTC) #2
Benedikt Meurer
Committed patchset #3 manually as r16637 (presubmit successful).
7 years, 3 months ago (2013-09-11 08:47:42 UTC) #3
Benedikt Meurer
7 years, 3 months ago (2013-09-11 09:38:08 UTC) #4
Message was sent while issue was closed.
https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memor...
File src/platform/virtual-memory.cc (right):

https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memor...
src/platform/virtual-memory.cc:171: // After three attempts give up and let the
kernel find and address.
On 2013/09/10 15:11:41, Toon Verwaest wrote:
> find an address

Done.

https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memor...
src/platform/virtual-memory.cc:454: bool VirtualMemory::ProtectRegion(void*
address, size_t size) {
On 2013/09/10 15:11:41, Toon Verwaest wrote:
> I'd prefer a more descriptive name here. Maybe WriteProtectRegion? And if it's
> called that way, could we mask out the write-bit rather than making whatever
you
> call this with executable?

Done. I think we will replace this method with a better alternative once we can
write protect the code areas in the heap. Until then we'll stick to
WriteProtectRegion().

https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memory.h
File src/platform/virtual-memory.h (right):

https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memor...
src/platform/virtual-memory.h:42: // object by assignment or copy-contructing.
This removes the reserved memory
On 2013/09/10 15:11:41, Toon Verwaest wrote:
> constructing

Done.

https://codereview.chromium.org/23641009/diff/4001/src/platform/virtual-memor...
src/platform/virtual-memory.h:127: // to them will cause a processor exception
then.
On 2013/09/10 15:11:41, Toon Verwaest wrote:
> remove "then" at the end. Reindent.

Done.

Powered by Google App Engine
This is Rietveld 408576698