Forgotten: regression test is painfully slow, so it should be probably
somehow specially marked in the status file.  Any suggestions are most
appreciated.

yours,
anton.

On Fri, Feb 11, 2011 at 2:14 PM,  <[email protected]> wrote:
> Reviewers: Kevin Millikin,
>
> Message:
> Kevin, may you have a look, please?
>
> I am not best versed in this part of the system, so there might be better
> way to
> attack the problem---exception thrown in ParseLazy.  For example, it might
> be
> not the best idea to disable optimization, although it at the very least
> correct.
>
> Description:
> Properly treat exceptions thrown while compiling.
>
> BUG=v8:1132
> TEST=test/mjsunit/regress/regress-1132.js
>
> Please review this at http://codereview.chromium.org/6487021/
>
> SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
>
> Affected files:
>  M src/compiler.cc
>  M src/hydrogen.cc
>  A test/mjsunit/regress/regress-1132.js
>
>
> Index: src/compiler.cc
> diff --git a/src/compiler.cc b/src/compiler.cc
> index
> 77111a842e7d55e6aa4a7ea8dfa02635ee431f3c..54f52fc77ba8ad104f0cfd5d9d281dc31f2e4cf8
> 100755
> --- a/src/compiler.cc
> +++ b/src/compiler.cc
> @@ -289,6 +289,11 @@ static bool MakeCrankshaftCode(CompilationInfo* info) {
>   HGraphBuilder builder(&oracle);
>   HPhase phase(HPhase::kTotal);
>   HGraph* graph = builder.CreateGraph(info);
> +  if (Top::has_pending_exception()) {
> +    info->SetCode(Handle<Code>::null());
> +    return false;
> +  }
> +
>   if (graph != NULL && FLAG_build_lithium) {
>     Handle<Code> code = graph->Compile();
>     if (!code.is_null()) {
> @@ -608,7 +613,9 @@ bool Compiler::CompileLazy(CompilationInfo* info) {
>
>     // Compile the code.
>     if (!MakeCode(info)) {
> -      Top::StackOverflow();
> +      if (!Top::has_pending_exception()) {
> +        Top::StackOverflow();
> +      }
>     } else {
>       ASSERT(!info->code().is_null());
>       Handle<Code> code = info->code();
> Index: src/hydrogen.cc
> diff --git a/src/hydrogen.cc b/src/hydrogen.cc
> index
> c3dfd5ff261db65fa7ad2c1d148253ed4baa9967..fb027e9bfe5e49410c7bec98deae76838880cc35
> 100644
> --- a/src/hydrogen.cc
> +++ b/src/hydrogen.cc
> @@ -4049,6 +4049,9 @@ bool HGraphBuilder::TryInline(Call* expr) {
>   CompilationInfo inner_info(target);
>   if (!ParserApi::Parse(&inner_info) ||
>       !Scope::Analyze(&inner_info)) {
> +    if (Top::has_pending_exception()) {
> +      SetStackOverflow();
> +    }
>     return false;
>   }
>   FunctionLiteral* function = inner_info.function();
> Index: test/mjsunit/regress/regress-1132.js
> diff --git a/test/mjsunit/regress/regress-1132.js
> b/test/mjsunit/regress/regress-1132.js
> new file mode 100644
> index
> 0000000000000000000000000000000000000000..09dac2a2436301b9463d2caeed65e196daf64e1d
> --- /dev/null
> +++ b/test/mjsunit/regress/regress-1132.js
> @@ -0,0 +1,43 @@
> +// 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:
> +//
> +//     * Redistributions of source code must retain the above copyright
> +//       notice, this list of conditions and the following disclaimer.
> +//     * Redistributions in binary form must reproduce the above
> +//       copyright notice, this list of conditions and the following
> +//       disclaimer in the documentation and/or other materials provided
> +//       with the distribution.
> +//     * Neither the name of Google Inc. nor the names of its
> +//       contributors may be used to endorse or promote products derived
> +//       from this software without specific prior written permission.
> +//
> +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +// Test the case when exception is thrown from the parser when lazy
> +// compiling a function.
> +function test() {
> +  try {
> +    test(1, test(1));
> +  } catch(e) {
> +    assertFalse(delete e, "deleting catch variable");
> +    assertEquals(42, e);
> +  }
> +}
> +
> +try {
> +  test();
> +  assertUnreachable();
> +} catch (e) {
> +}
>
>
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
>

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

Reply via email to