diff --git a/src/compiler.cc b/src/compiler.cc index 26daec77a3..328b2780fc 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -867,6 +867,9 @@ MaybeHandle Compiler::GetLazyCode(Handle function) { DCHECK(function->shared()->is_compiled()); return info.code(); } + // We have failed compilation. If there was an exception clear it so that + // we can compile unoptimized code. + if (isolate->has_pending_exception()) isolate->clear_pending_exception(); } if (function->shared()->is_compiled()) { diff --git a/test/mjsunit/regress/regress-458987.js b/test/mjsunit/regress/regress-458987.js new file mode 100644 index 0000000000..f7a7edcef4 --- /dev/null +++ b/test/mjsunit/regress/regress-458987.js @@ -0,0 +1,16 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +(function () { + "use asm"; + + function g() {} + + runNearStackLimit(g); +})(); + +function runNearStackLimit(f) { + function g() { try { g(); } catch(e) { f(); } }; + g(); +}