Index: src/accessors.cc |
diff --git a/src/accessors.cc b/src/accessors.cc |
index c108236b855703b6b3e0398d52fd862520c72eae..6b7ec058d93c59bfda56bf936dba56b5fcee9ecc 100644 |
--- a/src/accessors.cc |
+++ b/src/accessors.cc |
@@ -385,13 +385,16 @@ void Accessors::RegExpSourceGetter( |
Handle<Object> receiver = |
Utils::OpenHandle(*v8::Local<v8::Value>(info.This())); |
Handle<JSRegExp> regexp = Handle<JSRegExp>::cast(receiver); |
- Handle<String> pattern(regexp->Pattern(), isolate); |
- MaybeHandle<String> maybe = EscapeRegExpSource(isolate, pattern); |
- |
Handle<String> result; |
- if (!maybe.ToHandle(&result)) { |
- isolate->OptionalRescheduleException(false); |
- return; |
+ if (regexp->TypeTag() == JSRegExp::NOT_COMPILED) { |
+ result = isolate->factory()->empty_string(); |
+ } else { |
+ Handle<String> pattern(regexp->Pattern(), isolate); |
+ MaybeHandle<String> maybe = EscapeRegExpSource(isolate, pattern); |
+ if (!maybe.ToHandle(&result)) { |
+ isolate->OptionalRescheduleException(false); |
+ return; |
+ } |
} |
info.GetReturnValue().Set(Utils::ToLocal(result)); |
} |