Fix app snapshots on IA32 Windows.

The file size is not rounded up after the isolate snapshot if there are no rodata/instruction pieces. The other OS's use mmap instead of read, which is apparently okay with over-reading the file.

Fixes #27786

R=asiva@google.com

Review URL: https://codereview.chromium.org/2521883002 .
This commit is contained in:
Ryan Macnak 2016-11-22 09:20:51 -08:00
parent 6c45f24fa6
commit f62713e97c
2 changed files with 16 additions and 10 deletions

View file

@ -1240,14 +1240,23 @@ static bool ReadAppSnapshotBlobs(const char* script_name,
return false;
}
int64_t vmisolate_size = header[1];
int64_t vmisolate_position =
Utils::RoundUp(file->Position(), kAppSnapshotPageSize);
int64_t isolate_size = header[2];
int64_t isolate_position =
Utils::RoundUp(vmisolate_position + header[1], kAppSnapshotPageSize);
int64_t rodata_position =
Utils::RoundUp(isolate_position + header[2], kAppSnapshotPageSize);
int64_t instructions_position =
Utils::RoundUp(rodata_position + header[3], kAppSnapshotPageSize);
Utils::RoundUp(vmisolate_position + vmisolate_size, kAppSnapshotPageSize);
int64_t rodata_size = header[3];
int64_t rodata_position = isolate_position + isolate_size;
if (rodata_size != 0) {
rodata_position = Utils::RoundUp(rodata_position, kAppSnapshotPageSize);
}
int64_t instructions_size = header[4];
int64_t instructions_position = rodata_position + rodata_size;
if (instructions_size != 0) {
instructions_position =
Utils::RoundUp(instructions_position, kAppSnapshotPageSize);
}
void* read_only_buffer =
file->Map(File::kReadOnly, vmisolate_position,
@ -1261,14 +1270,14 @@ static bool ReadAppSnapshotBlobs(const char* script_name,
(vmisolate_position - vmisolate_position);
*isolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
(isolate_position - vmisolate_position);
if (header[3] == 0) {
if (rodata_size == 0) {
*rodata_buffer = NULL;
} else {
*rodata_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
(rodata_position - vmisolate_position);
}
if (header[4] == 0) {
if (instructions_size == 0) {
*instructions_buffer = NULL;
} else {
*instructions_buffer = reinterpret_cast<const uint8_t*>(

View file

@ -17,9 +17,6 @@ sample_extension: Crash # Unable to compile UnsupportedError.message.
[ $compiler == dart2analyzer ]
build_dart: Skip
[ $arch == ia32 && $system == windows ]
sample_extension/test/sample_extension_app_snapshot_test: RuntimeError # Issue 27786
[ $arch == arm ]
sample_extension/test/*: Skip # Issue 14705