OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // This function assumes that the layout of the file is as follows: | 224 // This function assumes that the layout of the file is as follows: |
225 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] | 225 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] |
226 // If we encounter an unexpected situation we abort scanning further entries. | 226 // If we encounter an unexpected situation we abort scanning further entries. |
227 FILE* fp = fopen("/proc/self/maps", "r"); | 227 FILE* fp = fopen("/proc/self/maps", "r"); |
228 if (fp == NULL) return; | 228 if (fp == NULL) return; |
229 | 229 |
230 // Allocate enough room to be able to store a full file name. | 230 // Allocate enough room to be able to store a full file name. |
231 const int kLibNameLen = FILENAME_MAX + 1; | 231 const int kLibNameLen = FILENAME_MAX + 1; |
232 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); | 232 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); |
233 | 233 |
234 i::Isolate* isolate = ISOLATE; | 234 i::Isolate* isolate = Isolate::Current(); |
235 // This loop will terminate once the scanning hits an EOF. | 235 // This loop will terminate once the scanning hits an EOF. |
236 while (true) { | 236 while (true) { |
237 uintptr_t start, end; | 237 uintptr_t start, end; |
238 char attr_r, attr_w, attr_x, attr_p; | 238 char attr_r, attr_w, attr_x, attr_p; |
239 // Parse the addresses and permission bits at the beginning of the line. | 239 // Parse the addresses and permission bits at the beginning of the line. |
240 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; | 240 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; |
241 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; | 241 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; |
242 | 242 |
243 int c; | 243 int c; |
244 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { | 244 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 460 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
461 return munmap(base, size) == 0; | 461 return munmap(base, size) == 0; |
462 } | 462 } |
463 | 463 |
464 | 464 |
465 bool VirtualMemory::HasLazyCommits() { | 465 bool VirtualMemory::HasLazyCommits() { |
466 return true; | 466 return true; |
467 } | 467 } |
468 | 468 |
469 } } // namespace v8::internal | 469 } } // namespace v8::internal |
OLD | NEW |