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

Unified Diff: src/d8.cc

Issue 2519363002: [d8] Do not try to verify zero-ness of failed virtual memory allocation. (Closed)
Patch Set: [d8] Do not try to verify zero-ness of failed virtual memory allocation. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-667603.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index ff90a320ff2d8e725fa53ac69c0993e904c10082..f6c13c755278ea59c3305069bb8aff236bc27844 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -76,10 +76,13 @@ class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
if (RoundToPageSize(&length)) {
void* data = VirtualMemoryAllocate(length);
#if DEBUG
- // In debug mode, check the memory is zero-initialized.
- uint8_t* ptr = reinterpret_cast<uint8_t*>(data);
- for (size_t i = 0; i < length; i++) {
- DCHECK_EQ(0, ptr[i]);
+ if (data) {
+ // In debug mode, check the memory is zero-initialized.
+ size_t limit = length / sizeof(uint64_t);
+ uint64_t* ptr = reinterpret_cast<uint64_t*>(data);
+ for (size_t i = 0; i < limit; i++) {
+ DCHECK_EQ(0u, ptr[i]);
+ }
}
#endif
return data;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-667603.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698