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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // This function assumes that the layout of the file is as follows: | 153 // This function assumes that the layout of the file is as follows: |
154 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] | 154 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] |
155 // If we encounter an unexpected situation we abort scanning further entries. | 155 // If we encounter an unexpected situation we abort scanning further entries. |
156 FILE* fp = fopen("/proc/self/maps", "r"); | 156 FILE* fp = fopen("/proc/self/maps", "r"); |
157 if (fp == NULL) return; | 157 if (fp == NULL) return; |
158 | 158 |
159 // Allocate enough room to be able to store a full file name. | 159 // Allocate enough room to be able to store a full file name. |
160 const int kLibNameLen = FILENAME_MAX + 1; | 160 const int kLibNameLen = FILENAME_MAX + 1; |
161 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); | 161 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); |
162 | 162 |
163 i::Isolate* isolate = ISOLATE; | 163 i::Isolate* isolate = Isolate::Current(); |
164 // This loop will terminate once the scanning hits an EOF. | 164 // This loop will terminate once the scanning hits an EOF. |
165 while (true) { | 165 while (true) { |
166 uintptr_t start, end; | 166 uintptr_t start, end; |
167 char attr_r, attr_w, attr_x, attr_p; | 167 char attr_r, attr_w, attr_x, attr_p; |
168 // Parse the addresses and permission bits at the beginning of the line. | 168 // Parse the addresses and permission bits at the beginning of the line. |
169 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; | 169 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; |
170 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; | 170 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; |
171 | 171 |
172 int c; | 172 int c; |
173 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { | 173 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return munmap(base, size) == 0; | 391 return munmap(base, size) == 0; |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 bool VirtualMemory::HasLazyCommits() { | 395 bool VirtualMemory::HasLazyCommits() { |
396 // TODO(alph): implement for the platform. | 396 // TODO(alph): implement for the platform. |
397 return false; | 397 return false; |
398 } | 398 } |
399 | 399 |
400 } } // namespace v8::internal | 400 } } // namespace v8::internal |
OLD | NEW |