Reviewers: Kevin Millikin,

Description:
Report out of memory if we cannot allocate memory for the deoptimization table.

Currently we pass a null pointer to memcpy. We will crash either way,
but going through FatalProcessOutOfMemory makes it clear what is going
on.

[email protected]
BUG=http://crbug.com/84717


Please review this at http://codereview.chromium.org/6993022/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/deoptimizer.cc


Index: src/deoptimizer.cc
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index 2fc0e47bdad18f0d884cc561eed917ca2dba60c8..47ee0a89e17ee948f458a0301e62ec29877ad920 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -901,6 +901,9 @@ LargeObjectChunk* Deoptimizer::CreateCode(BailoutType type) {
   ASSERT(desc.reloc_size == 0);

LargeObjectChunk* chunk = LargeObjectChunk::New(desc.instr_size, EXECUTABLE);
+  if (chunk == NULL) {
+ V8::FatalProcessOutOfMemory("Not enough memory for deoptimization table");
+  }
   memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size);
   CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size);
   return chunk;


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to