Commit 10500cb7 authored by jgruber's avatar jgruber Committed by Commit bot

[csa] Replace remaining old-style GetProperty calls

Change

Node* name = HeapConstant(name_string);
Callable callable = CodeFactory::GetProperty(isolate);
CallStub(callable, context, receiver, name);

to

GetProperty(context, receiver, name_string);

BUG=

Review-Url: https://codereview.chromium.org/2751363002
Cr-Commit-Position: refs/heads/master@{#43850}
parent 18c35e49
......@@ -454,8 +454,7 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
Goto(&has_length);
Bind(&not_js_array);
Node* len_property =
CallStub(CodeFactory::GetProperty(isolate()), context, o,
HeapConstant(isolate()->factory()->length_string()));
GetProperty(context, o, isolate()->factory()->length_string());
merged_length.Bind(
CallStub(CodeFactory::ToLength(isolate()), context, len_property));
Goto(&has_length);
......@@ -521,8 +520,7 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
// i. Let kValue be Get(O, Pk).
// ii. ReturnIfAbrupt(kValue).
Node* k_value = CallStub(CodeFactory::GetProperty(isolate()), context,
o, k.value());
Node* k_value = GetProperty(context, o, k.value());
// iii. Let funcResult be Call(callbackfn, T, «kValue, k, O»).
// iv. ReturnIfAbrupt(funcResult).
......@@ -2520,9 +2518,8 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
Bind(&if_isnotarray);
{
Node* length_string = HeapConstant(factory()->length_string());
Callable get_property = CodeFactory::GetProperty(isolate());
Node* length = CallStub(get_property, context, array, length_string);
Node* length =
GetProperty(context, array, factory()->length_string());
Callable to_length = CodeFactory::ToLength(isolate());
var_length.Bind(CallStub(to_length, context, length));
Goto(&done);
......@@ -2545,8 +2542,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
Bind(&generic_values);
{
Callable get_property = CodeFactory::GetProperty(isolate());
var_value.Bind(CallStub(get_property, context, array, index));
var_value.Bind(GetProperty(context, array, index));
Goto(&allocate_entry_if_needed);
}
}
......
......@@ -42,10 +42,8 @@ void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive(
Node* context = Parameter(TypeConversionDescriptor::kContext);
// Lookup the @@toPrimitive property on the {input}.
Callable callable = CodeFactory::GetProperty(isolate());
Node* to_primitive_symbol = HeapConstant(factory()->to_primitive_symbol());
Node* exotic_to_prim =
CallStub(callable, context, input, to_primitive_symbol);
GetProperty(context, input, factory()->to_primitive_symbol());
// Check if {exotic_to_prim} is neither null nor undefined.
Label ordinary_to_primitive(this);
......@@ -204,9 +202,7 @@ void ConversionBuiltinsAssembler::Generate_OrdinaryToPrimitive(
}
for (Handle<String> name : method_names) {
// Lookup the {name} on the {input}.
Callable callable = CodeFactory::GetProperty(isolate());
Node* name_string = HeapConstant(name);
Node* method = CallStub(callable, context, input, name_string);
Node* method = GetProperty(context, input, name);
// Check if the {method} is callable.
Label if_methodiscallable(this),
......
......@@ -280,11 +280,8 @@ Node* PromiseBuiltinsAssembler::SpeciesConstructor(Node* context, Node* object,
var_result.Bind(default_constructor);
// 2. Let C be ? Get(O, "constructor").
Node* const constructor_str =
HeapConstant(isolate->factory()->constructor_string());
Callable getproperty_callable = CodeFactory::GetProperty(isolate);
Node* const constructor =
CallStub(getproperty_callable, context, object, constructor_str);
GetProperty(context, object, isolate->factory()->constructor_string());
// 3. If C is undefined, return defaultConstructor.
Label out(this);
......@@ -295,10 +292,8 @@ Node* PromiseBuiltinsAssembler::SpeciesConstructor(Node* context, Node* object,
MessageTemplate::kConstructorNotReceiver);
// 5. Let S be ? Get(C, @@species).
Node* const species_symbol =
HeapConstant(isolate->factory()->species_symbol());
Node* const species =
CallStub(getproperty_callable, context, constructor, species_symbol);
GetProperty(context, constructor, isolate->factory()->species_symbol());
// 6. If S is either undefined or null, return defaultConstructor.
GotoIf(IsUndefined(species), &out);
......@@ -753,10 +748,8 @@ void PromiseBuiltinsAssembler::InternalResolvePromise(Node* context,
Bind(&if_notnativepromise);
{
// 8. Let then be Get(resolution, "then").
Node* const then_str = HeapConstant(isolate->factory()->then_string());
Callable getproperty_callable = CodeFactory::GetProperty(isolate);
Node* const then =
CallStub(getproperty_callable, context, result, then_str);
GetProperty(context, result, isolate->factory()->then_string());
// 9. If then is an abrupt completion, then
GotoIfException(then, &if_rejectpromise, &var_reason);
......@@ -1367,12 +1360,9 @@ TF_BUILTIN(PromiseCatch, PromiseBuiltinsAssembler) {
Bind(&if_customthen);
{
Isolate* isolate = this->isolate();
Node* const then_str = HeapConstant(isolate->factory()->then_string());
Callable getproperty_callable = CodeFactory::GetProperty(isolate);
Node* const then =
CallStub(getproperty_callable, context, promise, then_str);
Callable call_callable = CodeFactory::Call(isolate);
GetProperty(context, promise, isolate()->factory()->then_string());
Callable call_callable = CodeFactory::Call(isolate());
Node* const result =
CallJS(call_callable, context, then, promise, on_resolve, on_reject);
Return(result);
......@@ -1420,11 +1410,8 @@ TF_BUILTIN(PromiseResolve, PromiseBuiltinsAssembler) {
{
// 3.a Let xConstructor be ? Get(x, "constructor").
// The constructor lookup is observable.
Node* const constructor_str =
HeapConstant(isolate->factory()->constructor_string());
Callable getproperty_callable = CodeFactory::GetProperty(isolate);
Node* const constructor =
CallStub(getproperty_callable, context, value, constructor_str);
GetProperty(context, value, isolate->factory()->constructor_string());
// 3.b If SameValue(xConstructor, C) is true, return x.
GotoIfNot(SameValue(constructor, receiver), &if_valueisnotpromise);
......@@ -1760,12 +1747,9 @@ TF_BUILTIN(PromiseFinally, PromiseBuiltinsAssembler) {
Bind(&if_custompromise);
{
Isolate* isolate = this->isolate();
Node* const then_str = HeapConstant(isolate->factory()->then_string());
Callable getproperty_callable = CodeFactory::GetProperty(isolate);
Node* const then =
CallStub(getproperty_callable, context, promise, then_str);
Callable call_callable = CodeFactory::Call(isolate);
GetProperty(context, promise, isolate()->factory()->then_string());
Callable call_callable = CodeFactory::Call(isolate());
// 5. Return ? Invoke(promise, "then", « thenFinally, catchFinally »).
Node* const result =
CallJS(call_callable, context, then, promise, var_then_finally.value(),
......
......@@ -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,
......@@ -810,21 +808,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);
......@@ -883,9 +878,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);
......@@ -977,9 +971,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);
......@@ -1017,12 +1010,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);
}
......@@ -1030,9 +1020,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);
......@@ -1243,30 +1232,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);
......@@ -1494,9 +1481,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);
......@@ -1856,11 +1842,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);
}
......@@ -2027,11 +2009,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()));
}
}
}
......
......@@ -1226,10 +1226,7 @@ void StringBuiltinsAssembler::MaybeCallFunctionAtSymbol(
// Fall back to a slow lookup of {object[symbol]}.
Callable getproperty_callable = CodeFactory::GetProperty(isolate());
Node* const key = HeapConstant(symbol);
Node* const maybe_func = CallStub(getproperty_callable, context, object, key);
Node* const maybe_func = GetProperty(context, object, symbol);
GotoIf(IsUndefined(maybe_func), &out);
// Attempt to call the function.
......
......@@ -7732,8 +7732,8 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable,
GotoIfNot(IsJSReceiver(callable), &if_notreceiver);
// Load the @@hasInstance property from {callable}.
Node* inst_of_handler = CallStub(CodeFactory::GetProperty(isolate()), context,
callable, HasInstanceSymbolConstant());
Node* inst_of_handler =
GetProperty(context, callable, HasInstanceSymbolConstant());
// Optimize for the likely case where {inst_of_handler} is the builtin
// Function.prototype[@@hasInstance] method, and emit a direct call in
......
......@@ -1018,8 +1018,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Label* if_not_found, Label* if_bailout);
Node* GetProperty(Node* context, Node* receiver, Handle<Name> name) {
return GetProperty(context, receiver, HeapConstant(name));
}
Node* GetProperty(Node* context, Node* receiver, Node* const name) {
return CallStub(CodeFactory::GetProperty(isolate()), context, receiver,
HeapConstant(name));
name);
}
void LoadPropertyFromFastObject(Node* object, Node* map, Node* descriptors,
......
......@@ -1862,10 +1862,8 @@ TEST(AllocatePromiseResolveThenableJobInfo) {
Node* const context = p.Parameter(kNumParams + 2);
Node* const native_context = p.LoadNativeContext(context);
Node* const thenable = p.AllocateAndInitJSPromise(context);
Node* const then_str = p.HeapConstant(isolate->factory()->then_string());
Callable getproperty_callable = CodeFactory::GetProperty(isolate);
Node* const then =
p.CallStub(getproperty_callable, context, thenable, then_str);
p.GetProperty(context, thenable, isolate->factory()->then_string());
Node* resolve = nullptr;
Node* reject = nullptr;
std::tie(resolve, reject) = p.CreatePromiseResolvingFunctions(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment