From: ager@chromium.org Date: Fri, 3 Jun 2011 10:11:10 +0000 (+0000) Subject: Report out of memory if we cannot allocate memory for the deoptimization table. X-Git-Tag: upstream/4.7.83~19236 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=945bd3e70cdb1f5e2585e346d816050eceaa96b9;p=platform%2Fupstream%2Fv8.git 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. R=kmillikin@chromium.org BUG=http://crbug.com/84717 Review URL: http://codereview.chromium.org/6993022 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8163 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc index 2fc0e47..47ee0a8 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;