Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: src/accessors.cc

Issue 753983002: Fix RegExp.source for uncompiled regexp. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-435825.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-435825.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698