diff --git a/src/accessors.cc b/src/accessors.cc index c108236b85..6b7ec058d9 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -385,13 +385,16 @@ void Accessors::RegExpSourceGetter( Handle receiver = Utils::OpenHandle(*v8::Local(info.This())); Handle regexp = Handle::cast(receiver); - Handle pattern(regexp->Pattern(), isolate); - MaybeHandle maybe = EscapeRegExpSource(isolate, pattern); - Handle result; - if (!maybe.ToHandle(&result)) { - isolate->OptionalRescheduleException(false); - return; + if (regexp->TypeTag() == JSRegExp::NOT_COMPILED) { + result = isolate->factory()->empty_string(); + } else { + Handle pattern(regexp->Pattern(), isolate); + MaybeHandle maybe = EscapeRegExpSource(isolate, pattern); + if (!maybe.ToHandle(&result)) { + isolate->OptionalRescheduleException(false); + return; + } } info.GetReturnValue().Set(Utils::ToLocal(result)); } diff --git a/test/mjsunit/regress/regress-crbug-435825.js b/test/mjsunit/regress/regress-crbug-435825.js new file mode 100644 index 0000000000..e10b812d4d --- /dev/null +++ b/test/mjsunit/regress/regress-crbug-435825.js @@ -0,0 +1,11 @@ +// 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. + +Error.prepareStackTrace = function (a,b) { return b; }; + +try { + /(invalid regexp/; +} catch (e) { + e.stack[0].getThis().toString(); +}