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

Unified Diff: src/builtins/builtins-regexp.cc

Issue 2751363002: [csa] Replace remaining old-style GetProperty calls (Closed)
Patch Set: Created 3 years, 9 months 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 | « src/builtins/builtins-promise.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-regexp.cc
diff --git a/src/builtins/builtins-regexp.cc b/src/builtins/builtins-regexp.cc
index 731e4dd82491dcdc33f63df82173ed14e27453a3..3afc94eb8d33d87a95d11c340ad50d9cfa0b0b8f 100644
--- a/src/builtins/builtins-regexp.cc
+++ b/src/builtins/builtins-regexp.cc
@@ -34,9 +34,7 @@ Node* RegExpBuiltinsAssembler::FastLoadLastIndex(Node* regexp) {
Node* RegExpBuiltinsAssembler::SlowLoadLastIndex(Node* context, Node* regexp) {
// Load through the GetProperty stub.
- Node* const name = HeapConstant(isolate()->factory()->lastIndex_string());
- Callable getproperty_callable = CodeFactory::GetProperty(isolate());
- return CallStub(getproperty_callable, context, regexp, name);
+ return GetProperty(context, regexp, isolate()->factory()->lastIndex_string());
}
Node* RegExpBuiltinsAssembler::LoadLastIndex(Node* context, Node* regexp,
@@ -830,21 +828,18 @@ Node* RegExpBuiltinsAssembler::FlagsGetter(Node* const context,
// Fall back to GetProperty stub on the slow-path.
var_flags.Bind(int_zero);
- Callable getproperty_callable = CodeFactory::GetProperty(isolate);
-
-#define CASE_FOR_FLAG(NAME, FLAG) \
- do { \
- Label next(this); \
- Node* const name = \
- HeapConstant(isolate->factory()->InternalizeUtf8String(NAME)); \
- Node* const flag = CallStub(getproperty_callable, context, regexp, name); \
- Label if_isflagset(this); \
- BranchIfToBooleanIsTrue(flag, &if_isflagset, &next); \
- Bind(&if_isflagset); \
- var_length.Bind(IntPtrAdd(var_length.value(), int_one)); \
- var_flags.Bind(WordOr(var_flags.value(), IntPtrConstant(FLAG))); \
- Goto(&next); \
- Bind(&next); \
+#define CASE_FOR_FLAG(NAME, FLAG) \
+ do { \
+ Label next(this); \
+ Node* const flag = GetProperty( \
+ context, regexp, isolate->factory()->InternalizeUtf8String(NAME)); \
+ Label if_isflagset(this); \
+ BranchIfToBooleanIsTrue(flag, &if_isflagset, &next); \
+ Bind(&if_isflagset); \
+ var_length.Bind(IntPtrAdd(var_length.value(), int_one)); \
+ var_flags.Bind(WordOr(var_flags.value(), IntPtrConstant(FLAG))); \
+ Goto(&next); \
+ Bind(&next); \
} while (false)
CASE_FOR_FLAG("global", JSRegExp::kGlobal);
@@ -903,9 +898,8 @@ Node* RegExpBuiltinsAssembler::IsRegExp(Node* const context,
// Check @@match.
{
- Callable getproperty_callable = CodeFactory::GetProperty(isolate());
- Node* const name = HeapConstant(isolate()->factory()->match_symbol());
- Node* const value = CallStub(getproperty_callable, context, receiver, name);
+ Node* const value =
+ GetProperty(context, receiver, isolate()->factory()->match_symbol());
Label match_isundefined(this), match_isnotundefined(this);
Branch(IsUndefined(value), &match_isundefined, &match_isnotundefined);
@@ -997,9 +991,8 @@ TF_BUILTIN(RegExpConstructor, RegExpBuiltinsAssembler) {
GotoIfNot(pattern_is_regexp, &next);
GotoIfNot(IsUndefined(flags), &next);
- Callable getproperty_callable = CodeFactory::GetProperty(isolate);
- Node* const name = HeapConstant(isolate->factory()->constructor_string());
- Node* const value = CallStub(getproperty_callable, context, pattern, name);
+ Node* const value =
+ GetProperty(context, pattern, isolate->factory()->constructor_string());
GotoIfNot(WordEqual(value, regexp_function), &next);
Return(pattern);
@@ -1037,12 +1030,9 @@ TF_BUILTIN(RegExpConstructor, RegExpBuiltinsAssembler) {
Bind(&if_patternisslowregexp);
{
- Callable getproperty_callable = CodeFactory::GetProperty(isolate);
-
{
- Node* const name = HeapConstant(isolate->factory()->source_string());
Node* const value =
- CallStub(getproperty_callable, context, pattern, name);
+ GetProperty(context, pattern, isolate->factory()->source_string());
var_pattern.Bind(value);
}
@@ -1050,9 +1040,8 @@ TF_BUILTIN(RegExpConstructor, RegExpBuiltinsAssembler) {
Label inner_next(this);
GotoIfNot(IsUndefined(flags), &inner_next);
- Node* const name = HeapConstant(isolate->factory()->flags_string());
Node* const value =
- CallStub(getproperty_callable, context, pattern, name);
+ GetProperty(context, pattern, isolate->factory()->flags_string());
var_flags.Bind(value);
Goto(&inner_next);
@@ -1263,30 +1252,28 @@ Node* RegExpBuiltinsAssembler::SlowFlagGetter(Node* const context,
Label out(this);
Variable var_result(this, MachineRepresentation::kWord32);
- Node* name;
-
+ Handle<String> name;
switch (flag) {
case JSRegExp::kGlobal:
- name = HeapConstant(factory->global_string());
+ name = factory->global_string();
break;
case JSRegExp::kIgnoreCase:
- name = HeapConstant(factory->ignoreCase_string());
+ name = factory->ignoreCase_string();
break;
case JSRegExp::kMultiline:
- name = HeapConstant(factory->multiline_string());
+ name = factory->multiline_string();
break;
case JSRegExp::kSticky:
- name = HeapConstant(factory->sticky_string());
+ name = factory->sticky_string();
break;
case JSRegExp::kUnicode:
- name = HeapConstant(factory->unicode_string());
+ name = factory->unicode_string();
break;
default:
UNREACHABLE();
}
- Callable getproperty_callable = CodeFactory::GetProperty(isolate());
- Node* const value = CallStub(getproperty_callable, context, regexp, name);
+ Node* const value = GetProperty(context, regexp, name);
Label if_true(this), if_false(this);
BranchIfToBooleanIsTrue(value, &if_true, &if_false);
@@ -1514,9 +1501,8 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp,
// verifying its return value.
// Get the exec property.
- Node* const name = HeapConstant(isolate->factory()->exec_string());
- Callable getproperty_callable = CodeFactory::GetProperty(isolate);
- Node* const exec = CallStub(getproperty_callable, context, regexp, name);
+ Node* const exec =
+ GetProperty(context, regexp, isolate->factory()->exec_string());
// Is {exec} callable?
Label if_iscallable(this), if_isnotcallable(this);
@@ -1876,11 +1862,7 @@ void RegExpBuiltinsAssembler::RegExpPrototypeMatchBody(Node* const context,
Bind(&slow_result);
{
// TODO(ishell): Use GetElement stub once it's available.
- Node* const name = smi_zero;
- Callable getproperty_callable = CodeFactory::GetProperty(isolate);
- Node* const match =
- CallStub(getproperty_callable, context, result, name);
-
+ Node* const match = GetProperty(context, result, smi_zero);
var_match.Bind(ToString(context, match));
Goto(&if_didmatch);
}
@@ -2047,11 +2029,8 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSearchBodySlow(
Bind(&slow_result);
{
- Node* const name = HeapConstant(isolate->factory()->index_string());
- Callable getproperty_callable = CodeFactory::GetProperty(isolate);
- Node* const index =
- CallStub(getproperty_callable, context, exec_result, name);
- Return(index);
+ Return(GetProperty(context, exec_result,
+ isolate->factory()->index_string()));
}
}
}
« no previous file with comments | « src/builtins/builtins-promise.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698