Home | History | Annotate | Download | only in builtins

Lines Matching refs:regexp

5 #include "src/builtins/builtins-regexp.h"
14 #include "src/objects/regexp-match-info.h"
15 #include "src/regexp/jsregexp.h"
16 #include "src/regexp/regexp-utils.h"
26 // ES6 section 21.2 RegExp Objects
28 Node* RegExpBuiltinsAssembler::FastLoadLastIndex(Node* regexp) {
32 return LoadObjectField(regexp, field_offset);
35 Node* RegExpBuiltinsAssembler::SlowLoadLastIndex(Node* context, Node* regexp) {
39 return CallStub(getproperty_callable, context, regexp, name);
42 Node* RegExpBuiltinsAssembler::LoadLastIndex(Node* context, Node* regexp,
44 return is_fastpath ? FastLoadLastIndex(regexp)
45 : SlowLoadLastIndex(context, regexp);
48 // The fast-path of StoreLastIndex when regexp is guaranteed to be an unmodified
50 void RegExpBuiltinsAssembler::FastStoreLastIndex(Node* regexp, Node* value) {
54 StoreObjectField(regexp, field_offset, value);
57 void RegExpBuiltinsAssembler::SlowStoreLastIndex(Node* context, Node* regexp,
63 CallRuntime(Runtime::kSetProperty, context, regexp, name, value,
67 void RegExpBuiltinsAssembler::StoreLastIndex(Node* context, Node* regexp,
70 FastStoreLastIndex(regexp, value);
72 SlowStoreLastIndex(context, regexp, value);
77 Node* const context, Node* const regexp, Node* const match_info,
144 CSA_ASSERT(this, HasInstanceType(regexp, JS_REGEXP_TYPE));
150 Node* const data = LoadObjectField(regexp, JSRegExp::kDataOffset);
218 // ES#sec-regexp.prototype.exec
219 // RegExp.prototype.exec ( string )
220 // Implements the core of RegExp.prototype.exec but without actually
221 // constructing the JSRegExpResult. Returns either null (if the RegExp did not
225 Node* const context, Node* const regexp, Node* const string,
234 ThrowIfNotInstanceType(context, regexp, JS_REGEXP_TYPE,
235 "RegExp.prototype.exec");
239 CSA_ASSERT(this, HasInstanceType(regexp, JS_REGEXP_TYPE));
247 Node* const regexp_lastindex = LoadLastIndex(context, regexp, is_fastpath);
270 // Check whether the regexp is global or sticky, which determines whether we
272 Node* const flags = LoadObjectField(regexp, JSRegExp::kFlagsOffset);
296 StoreLastIndex(context, regexp, smi_zero, is_fastpath);
320 match_indices = CallStub(exec_callable, context, regexp, string,
330 StoreLastIndex(context, regexp, smi_zero, is_fastpath);
342 StoreLastIndex(context, regexp, new_lastindex, is_fastpath);
350 // ES#sec-regexp.prototype.exec
351 // RegExp.prototype.exec ( string )
353 Node* const regexp,
362 context, regexp, string, &if_didnotmatch, is_fastpath);
368 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string);
441 // RegExp fast path implementations rely on unmodified JSRegExp instances.
443 // the regexp itself is unmodified (i.e. its map has not changed), its
509 // ES#sec-regexp.prototype.exec
510 // RegExp.prototype.exec ( string )
518 "RegExp.prototype.exec");
544 Node* const regexp,
558 Node* const flags_smi = LoadObjectField(regexp, JSRegExp::kFlagsOffset);
590 Node* const flag = CallStub(getproperty_callable, context, regexp, name); \
681 Node* const regexp,
698 return CallRuntime(Runtime::kRegExpInitializeAndCompile, context, regexp,
708 "RegExp.prototype.flags");
722 // ES#sec-regexp-pattern-flags
723 // RegExp ( pattern, flags )
832 Node* const regexp = AllocateJSObjectFromMap(initial_map);
833 var_regexp.Bind(regexp);
840 Node* const regexp = constructor_assembler.EmitFastNewObject(
842 var_regexp.Bind(regexp);
854 // ES#sec-regexp.prototype.compile
855 // RegExp.prototype.compile ( pattern, flags )
863 "RegExp.prototype.compile");
909 // Check whether we have an unmodified regexp instance.
953 "RegExp.prototype.source"));
962 CHECK_RECEIVER(JSReceiver, recv, "RegExp.prototype.toString");
998 Node* RegExpBuiltinsAssembler::FastFlagGetter(Node* const regexp,
1001 Node* const flags = LoadObjectField(regexp, JSRegExp::kFlagsOffset);
1010 Node* const regexp,
1040 Node* const value = CallStub(getproperty_callable, context, regexp, name);
1062 Node* const regexp,
1065 return is_fastpath ? FastFlagGetter(regexp, flag)
1066 : SlowFlagGetter(context, regexp, flag);
1077 // Check whether we have an unmodified regexp instance.
1132 "RegExp.prototype.global");
1138 "RegExp.prototype.ignoreCase");
1144 "RegExp.prototype.multiline");
1150 "RegExp.prototype.sticky");
1156 "RegExp.prototype.unicode");
1201 // rightContext of the RegExp constructor. The properties are computed based
1243 Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp,
1252 Node* const map = LoadMap(regexp);
1253 BranchIfFastRegExp(context, regexp, map, &if_isfastpath, &if_isslowpath);
1257 Node* const result = RegExpPrototypeExecBody(context, regexp, string, true);
1270 Node* const exec = CallStub(getproperty_callable, context, regexp, name);
1283 Node* const result = CallJS(call_callable, context, exec, regexp, string);
1296 ThrowIfNotInstanceType(context, regexp, JS_REGEXP_TYPE,
1297 "RegExp.prototype.exec");
1300 RegExpPrototypeExecBody(context, regexp, string, false);
1310 // ES#sec-regexp.prototype.test
1311 // RegExp.prototype.test ( S )
1320 "RegExp.prototype.test");
1564 Node* const regexp,
1574 FlagGetter(context, regexp, JSRegExp::kGlobal, is_fastpath);
1582 is_fastpath ? RegExpPrototypeExecBody(context, regexp, string, true)
1583 : RegExpExec(context, regexp, string);
1590 FlagGetter(context, regexp, JSRegExp::kUnicode, is_fastpath);
1592 StoreLastIndex(context, regexp, smi_zero, is_fastpath);
1615 context, regexp, string, &if_didnotmatch, true);
1628 Node* const result = RegExpExec(context, regexp, string);
1685 Node* last_index = LoadLastIndex(context, regexp, is_fastpath);
1704 StoreLastIndex(context, regexp, new_last_index, is_fastpath);
1720 // ES#sec-regexp.prototype-@@match
1721 // RegExp.prototype [ @@match ] ( string )
1730 "RegExp.prototype.@@match");
1748 Node* const context, Node* const regexp, Node* const string) {
1750 Node* const previous_last_index = FastLoadLastIndex(regexp);
1753 FastStoreLastIndex(regexp, SmiConstant(Smi::kZero));
1758 context, regexp, string, &if_didnotmatch, true);
1763 FastStoreLastIndex(regexp, previous_last_index);
1774 FastStoreLastIndex(regexp, previous_last_index);
1780 Node* const context, Node* const regexp, Node* const string) {
1786 Node* const previous_last_index = SlowLoadLastIndex(context, regexp);
1793 SlowStoreLastIndex(context, regexp, smi_zero);
1799 Node* const exec_result = RegExpExec(context, regexp, string);
1804 Node* const current_last_index = SlowLoadLastIndex(context, regexp);
1808 SlowStoreLastIndex(context, regexp, previous_last_index);
1846 // ES#sec-regexp.prototype-@@search
1847 // RegExp.prototype [ @@search ] ( string )
1856 "RegExp.prototype.@@search");
1873 // Generates the fast path for @@split. {regexp} is an unmodified JSRegExp,
1876 Node* const regexp,
1905 // array depending on whether the {regexp} matches.
1916 Node* const match_indices = CallStub(exec_callable, context, regexp,
1970 // Search for the given {regexp}.
1976 Node* const match_indices = CallStub(exec_callable, context, regexp, string,
2006 Node* const is_unicode = FastFlagGetter(regexp, JSRegExp::kUnicode);
2123 Node* const regexp = Parameter(Descriptor::kReceiver);
2128 CSA_ASSERT(this, IsFastRegExpMap(context, regexp, LoadMap(regexp)));
2144 // ToUint32(limit) could potentially change the shape of the RegExp
2149 BranchIfFastRegExp(context, regexp, LoadMap(regexp), &next, &runtime);
2170 RegExpPrototypeSplitBody(context, regexp, string, limit);
2178 Return(CallRuntime(Runtime::kRegExpSplit, context, regexp, string, limit));
2182 // ES#sec-regexp.prototype-@@split
2183 // RegExp.prototype [ @@split ] ( string, limit )
2193 "RegExp.prototype.@@split");
2212 Node* context, Node* regexp, Node* string, Node* replace_callable) {
2230 FastStoreLastIndex(regexp, smi_zero);
2249 Node* const res = CallRuntime(Runtime::kRegExpExecMultiple, context, regexp,
2253 FastStoreLastIndex(regexp, smi_zero);
2278 // the regexp, just the implicit capture that captures the whole match. In
2378 // Use the apply argument as backing for global RegExp properties.
2419 Node* context, Node* regexp, Node* string, Node* replace_string) {
2436 // Is {regexp} global?
2438 Node* const flags = LoadObjectField(regexp, JSRegExp::kFlagsOffset);
2446 FastStoreLastIndex(regexp, smi_zero);
2449 string, regexp, replace_string, last_match_info);
2459 context, regexp, string, &if_didnotmatch, true);
2521 Node* const regexp = Parameter(Descriptor::kReceiver);
2526 CSA_ASSERT(this, IsFastRegExpMap(context, regexp, LoadMap(regexp)));
2544 // ToString(replaceValue) could potentially change the shape of the RegExp
2549 BranchIfFastRegExp(context, regexp, LoadMap(regexp), &next, &runtime);
2561 ReplaceSimpleStringFastPath(context, regexp, string, replace_string));
2564 // {regexp} is unmodified and {replace_value} is callable.
2569 // Check if the {regexp} is global.
2572 Node* const is_global = FastFlagGetter(regexp, JSRegExp::kGlobal);
2576 Return(ReplaceGlobalCallableFastPath(context, regexp, string, replace_fn));
2580 context, string, regexp, replace_fn));
2584 Return(CallRuntime(Runtime::kRegExpReplace, context, regexp, string,
2588 // ES#sec-regexp.prototype-@@replace
2589 // RegExp.prototype [ @@replace ] ( string, replaceValue )
2617 "RegExp.prototype.@@replace");
2640 Node* const regexp = Parameter(1);
2652 Node* const match_indices = CallStub(exec_callable, context, regexp, string,
2664 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string);