Index: src/builtins/builtins-regexp-gen.cc |
diff --git a/src/builtins/builtins-regexp-gen.cc b/src/builtins/builtins-regexp-gen.cc |
index 9e5c5cb0fd03d58e0f9308789deb043abc8a7c17..ee49d8d16bc18a0c9d3dd19b26efbf732f3fd596 100644 |
--- a/src/builtins/builtins-regexp-gen.cc |
+++ b/src/builtins/builtins-regexp-gen.cc |
@@ -781,6 +781,8 @@ Node* RegExpBuiltinsAssembler::FlagsGetter(Node* const context, |
Variable var_length(this, MachineType::PointerRepresentation(), int_zero); |
Variable var_flags(this, MachineType::PointerRepresentation()); |
+ Node* const is_dotall_enabled = IsDotAllEnabled(isolate); |
+ |
// First, count the number of characters we will need and check which flags |
// are set. |
@@ -802,6 +804,13 @@ Node* RegExpBuiltinsAssembler::FlagsGetter(Node* const context, |
CASE_FOR_FLAG(JSRegExp::kGlobal); |
CASE_FOR_FLAG(JSRegExp::kIgnoreCase); |
CASE_FOR_FLAG(JSRegExp::kMultiline); |
+ { |
+ Label next(this); |
+ GotoIfNot(is_dotall_enabled, &next); |
+ CASE_FOR_FLAG(JSRegExp::kDotAll); |
+ Goto(&next); |
+ Bind(&next); |
+ } |
CASE_FOR_FLAG(JSRegExp::kUnicode); |
CASE_FOR_FLAG(JSRegExp::kSticky); |
#undef CASE_FOR_FLAG |
@@ -828,6 +837,13 @@ Node* RegExpBuiltinsAssembler::FlagsGetter(Node* const context, |
CASE_FOR_FLAG("global", JSRegExp::kGlobal); |
CASE_FOR_FLAG("ignoreCase", JSRegExp::kIgnoreCase); |
CASE_FOR_FLAG("multiline", JSRegExp::kMultiline); |
+ { |
+ Label next(this); |
+ GotoIfNot(is_dotall_enabled, &next); |
+ CASE_FOR_FLAG("dotAll", JSRegExp::kDotAll); |
+ Goto(&next); |
+ Bind(&next); |
+ } |
CASE_FOR_FLAG("unicode", JSRegExp::kUnicode); |
CASE_FOR_FLAG("sticky", JSRegExp::kSticky); |
#undef CASE_FOR_FLAG |
@@ -859,6 +875,13 @@ Node* RegExpBuiltinsAssembler::FlagsGetter(Node* const context, |
CASE_FOR_FLAG(JSRegExp::kGlobal, 'g'); |
CASE_FOR_FLAG(JSRegExp::kIgnoreCase, 'i'); |
CASE_FOR_FLAG(JSRegExp::kMultiline, 'm'); |
+ { |
+ Label next(this); |
+ GotoIfNot(is_dotall_enabled, &next); |
+ CASE_FOR_FLAG(JSRegExp::kDotAll, 's'); |
+ Goto(&next); |
+ Bind(&next); |
+ } |
CASE_FOR_FLAG(JSRegExp::kUnicode, 'u'); |
CASE_FOR_FLAG(JSRegExp::kSticky, 'y'); |
#undef CASE_FOR_FLAG |
@@ -1211,6 +1234,9 @@ Node* RegExpBuiltinsAssembler::SlowFlagGetter(Node* const context, |
case JSRegExp::kMultiline: |
name = factory->multiline_string(); |
break; |
+ case JSRegExp::kDotAll: |
+ UNREACHABLE(); // Never called for dotAll. |
+ break; |
case JSRegExp::kSticky: |
name = factory->sticky_string(); |
break; |
@@ -1251,8 +1277,7 @@ Node* RegExpBuiltinsAssembler::FlagGetter(Node* const context, |
} |
void RegExpBuiltinsAssembler::FlagGetter(Node* context, Node* receiver, |
- JSRegExp::Flag flag, |
- v8::Isolate::UseCounterFeature counter, |
+ JSRegExp::Flag flag, int counter, |
const char* method_name) { |
Isolate* isolate = this->isolate(); |
@@ -1290,8 +1315,10 @@ void RegExpBuiltinsAssembler::FlagGetter(Node* context, Node* receiver, |
Bind(&if_isprototype); |
{ |
- Node* const counter_smi = SmiConstant(Smi::FromInt(counter)); |
- CallRuntime(Runtime::kIncrementUseCounter, context, counter_smi); |
+ if (counter != -1) { |
+ Node* const counter_smi = SmiConstant(Smi::FromInt(counter)); |
+ CallRuntime(Runtime::kIncrementUseCounter, context, counter_smi); |
+ } |
Return(UndefinedConstant()); |
} |
@@ -1338,6 +1365,23 @@ TF_BUILTIN(RegExpPrototypeMultilineGetter, RegExpBuiltinsAssembler) { |
"RegExp.prototype.multiline"); |
} |
+Node* RegExpBuiltinsAssembler::IsDotAllEnabled(Isolate* isolate) { |
+ Node* flag_ptr = ExternalConstant( |
+ ExternalReference::address_of_regexp_dotall_flag(isolate)); |
+ Node* flag_value = Load(MachineType::IntPtr(), flag_ptr); |
+ return WordNotEqual(flag_value, IntPtrConstant(0)); |
+} |
+ |
+// ES #sec-get-regexp.prototype.dotAll |
+TF_BUILTIN(RegExpPrototypeDotAllGetter, RegExpBuiltinsAssembler) { |
+ Node* context = Parameter(Descriptor::kContext); |
+ Node* receiver = Parameter(Descriptor::kReceiver); |
+ static const int kNoCounter = -1; |
+ CSA_ASSERT(this, IsDotAllEnabled(isolate())); |
+ FlagGetter(context, receiver, JSRegExp::kDotAll, kNoCounter, |
+ "RegExp.prototype.dotAll"); |
+} |
+ |
// ES6 21.2.5.12. |
// ES #sec-get-regexp.prototype.sticky |
TF_BUILTIN(RegExpPrototypeStickyGetter, RegExpBuiltinsAssembler) { |