Commit aef551aa authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[nci] Add feedback input to remaining operators

This is the last batch of operators which used to embed the feedback
vector as a HeapConstant:

- CreateEmptyLiteralArray
- LoadGlobal
- LoadNamed
- StoreDataPropertyInLiteral
- StoreGlobal
- StoreInArrayLiteral
- StoreNamed
- StoreNamedOwn

They now take the vector as an input. In NCI mode, the vector is
loaded from the closure at the beginning of the function.

Bug: v8:8888
Change-Id: Ifd2d2a556db343512b61e099a73702822b1ba9f0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2282525
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68695}
parent a608e4a6
......@@ -97,29 +97,9 @@ class BytecodeGraphBuilder {
return MakeNode(op, 0, static_cast<Node**>(nullptr), incomplete);
}
Node* NewNode(const Operator* op, Node* n1) {
Node* buffer[] = {n1};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(const Operator* op, Node* n1, Node* n2) {
Node* buffer[] = {n1, n2};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) {
Node* buffer[] = {n1, n2, n3};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
Node* buffer[] = {n1, n2, n3, n4};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5, Node* n6) {
Node* buffer[] = {n1, n2, n3, n4, n5, n6};
template <class... Args>
Node* NewNode(const Operator* op, Node* n0, Args... nodes) {
Node* buffer[] = {n0, nodes...};
return MakeNode(op, arraysize(buffer), buffer);
}
......@@ -1474,7 +1454,7 @@ Node* BytecodeGraphBuilder::BuildLoadGlobal(NameRef name,
DCHECK(IsLoadGlobalICKind(broker()->GetFeedbackSlotKind(feedback)));
const Operator* op =
javascript()->LoadGlobal(name.object(), feedback, typeof_mode);
return NewNode(op);
return NewNode(op, feedback_vector_node());
}
void BytecodeGraphBuilder::VisitLdaGlobal() {
......@@ -1509,7 +1489,7 @@ void BytecodeGraphBuilder::VisitStaGlobal() {
GetLanguageModeFromSlotKind(broker()->GetFeedbackSlotKind(feedback));
const Operator* op =
javascript()->StoreGlobal(language_mode, name.object(), feedback);
Node* node = NewNode(op, value);
Node* node = NewNode(op, value, feedback_vector_node());
environment()->RecordAfterState(node, Environment::kAttachFrameState);
}
......@@ -1533,7 +1513,7 @@ void BytecodeGraphBuilder::VisitStaInArrayLiteral() {
node = lowering.value();
} else {
DCHECK(!lowering.Changed());
node = NewNode(op, array, index, value);
node = NewNode(op, array, index, value, feedback_vector_node());
}
environment()->RecordAfterState(node, Environment::kAttachFrameState);
......@@ -1561,7 +1541,8 @@ void BytecodeGraphBuilder::VisitStaDataPropertyInLiteral() {
node = lowering.value();
} else {
DCHECK(!lowering.Changed());
node = NewNode(op, object, name, value, jsgraph()->Constant(flags));
node = NewNode(op, object, name, value, jsgraph()->Constant(flags),
feedback_vector_node());
}
environment()->RecordAfterState(node, Environment::kAttachFrameState);
......@@ -1914,7 +1895,7 @@ void BytecodeGraphBuilder::VisitLdaNamedProperty() {
node = lowering.value();
} else {
DCHECK(!lowering.Changed());
node = NewNode(op, object);
node = NewNode(op, object, feedback_vector_node());
}
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
......@@ -1926,7 +1907,7 @@ void BytecodeGraphBuilder::VisitLdaNamedPropertyNoFeedback() {
NameRef name(broker(),
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
const Operator* op = javascript()->LoadNamed(name.object(), FeedbackSource());
Node* node = NewNode(op, object);
Node* node = NewNode(op, object, feedback_vector_node());
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
......@@ -1988,7 +1969,7 @@ void BytecodeGraphBuilder::BuildNamedStore(StoreMode store_mode) {
node = lowering.value();
} else {
DCHECK(!lowering.Changed());
node = NewNode(op, object, value);
node = NewNode(op, object, value, feedback_vector_node());
}
environment()->RecordAfterState(node, Environment::kAttachFrameState);
}
......@@ -2008,7 +1989,7 @@ void BytecodeGraphBuilder::VisitStaNamedPropertyNoFeedback() {
static_cast<LanguageMode>(bytecode_iterator().GetFlagOperand(2));
const Operator* op =
javascript()->StoreNamed(language_mode, name.object(), FeedbackSource());
Node* node = NewNode(op, object, value);
Node* node = NewNode(op, object, value, feedback_vector_node());
environment()->RecordAfterState(node, Environment::kAttachFrameState);
}
......@@ -2211,7 +2192,8 @@ void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
void BytecodeGraphBuilder::VisitCreateEmptyArrayLiteral() {
int const slot_id = bytecode_iterator().GetIndexOperand(0);
FeedbackSource pair = CreateFeedbackSource(slot_id);
Node* literal = NewNode(javascript()->CreateEmptyLiteralArray(pair));
Node* literal = NewNode(javascript()->CreateEmptyLiteralArray(pair),
feedback_vector_node());
environment()->BindAccumulator(literal);
}
......
......@@ -1119,8 +1119,8 @@ Reduction JSCreateLowering::ReduceJSCreateLiteralArrayOrObject(Node* node) {
}
Reduction JSCreateLowering::ReduceJSCreateEmptyLiteralArray(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateEmptyLiteralArray, node->opcode());
FeedbackParameter const& p = FeedbackParameterOf(node->op());
JSCreateEmptyLiteralArrayNode n(node);
FeedbackParameter const& p = n.Parameters();
ProcessedFeedback const& feedback =
broker()->GetFeedbackForArrayOrObjectLiteral(p.feedback());
if (!feedback.IsInsufficient()) {
......
This diff is collapsed.
......@@ -984,8 +984,8 @@ Reduction JSNativeContextSpecialization::ReduceGlobalAccess(
}
Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadGlobal, node->opcode());
LoadGlobalParameters const& p = LoadGlobalParametersOf(node->op());
JSLoadGlobalNode n(node);
LoadGlobalParameters const& p = n.Parameters();
if (!p.feedback().IsValid()) return NoChange();
ProcessedFeedback const& processed =
......@@ -994,7 +994,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) {
GlobalAccessFeedback const& feedback = processed.AsGlobalAccess();
if (feedback.IsScriptContextSlot()) {
Node* effect = NodeProperties::GetEffectInput(node);
Effect effect = n.effect();
Node* script_context = jsgraph()->Constant(feedback.script_context());
Node* value = effect =
graph()->NewNode(javascript()->LoadContext(0, feedback.slot_index(),
......@@ -1013,9 +1013,9 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) {
}
Reduction JSNativeContextSpecialization::ReduceJSStoreGlobal(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreGlobal, node->opcode());
Node* value = NodeProperties::GetValueInput(node, 0);
StoreGlobalParameters const& p = StoreGlobalParametersOf(node->op());
JSStoreGlobalNode n(node);
StoreGlobalParameters const& p = n.Parameters();
Node* value = n.value();
if (!p.feedback().IsValid()) return NoChange();
ProcessedFeedback const& processed =
......@@ -1025,8 +1025,8 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreGlobal(Node* node) {
GlobalAccessFeedback const& feedback = processed.AsGlobalAccess();
if (feedback.IsScriptContextSlot()) {
if (feedback.immutable()) return NoChange();
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Effect effect = n.effect();
Control control = n.control();
Node* script_context = jsgraph()->Constant(feedback.script_context());
effect =
graph()->NewNode(javascript()->StoreContext(0, feedback.slot_index()),
......@@ -1053,6 +1053,14 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
node->opcode() == IrOpcode::kJSStoreNamedOwn ||
node->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral ||
node->opcode() == IrOpcode::kJSHasProperty);
STATIC_ASSERT(JSLoadNamedNode::ObjectIndex() == 0 &&
JSStoreNamedNode::ObjectIndex() == 0 &&
JSLoadPropertyNode::ObjectIndex() == 0 &&
JSStorePropertyNode::ObjectIndex() == 0 &&
JSStoreNamedOwnNode::ObjectIndex() == 0 &&
JSStoreNamedNode::ObjectIndex() == 0 &&
JSStoreDataPropertyInLiteralNode::ObjectIndex() == 0 &&
JSHasPropertyNode::ObjectIndex() == 0);
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* context = NodeProperties::GetContextInput(node);
Node* frame_state = NodeProperties::GetFrameStateInput(node);
......@@ -1323,9 +1331,9 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
}
Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
NamedAccess const& p = NamedAccessOf(node->op());
Node* const receiver = NodeProperties::GetValueInput(node, 0);
JSLoadNamedNode n(node);
NamedAccess const& p = n.Parameters();
Node* const receiver = n.object();
NameRef name(broker(), p.name());
// Check if we have a constant receiver.
......@@ -1388,8 +1396,9 @@ Reduction JSNativeContextSpecialization::ReduceJSGetIterator(Node* node) {
jsgraph(), Builtins::kGetIteratorWithFeedbackLazyDeoptContinuation,
context, lazy_deopt_parameters, arraysize(lazy_deopt_parameters),
frame_state, ContinuationFrameStateMode::LAZY);
Node* load_property = graph()->NewNode(
load_op, receiver, context, lazy_deopt_frame_state, effect, control);
Node* load_property =
graph()->NewNode(load_op, receiver, n.feedback_vector(), context,
lazy_deopt_frame_state, effect, control);
effect = load_property;
control = load_property;
......@@ -1448,23 +1457,20 @@ Reduction JSNativeContextSpecialization::ReduceJSGetIterator(Node* node) {
}
Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreNamed, node->opcode());
NamedAccess const& p = NamedAccessOf(node->op());
Node* const value = NodeProperties::GetValueInput(node, 1);
JSStoreNamedNode n(node);
NamedAccess const& p = n.Parameters();
if (!p.feedback().IsValid()) return NoChange();
return ReducePropertyAccess(node, nullptr, NameRef(broker(), p.name()), value,
FeedbackSource(p.feedback()), AccessMode::kStore);
return ReducePropertyAccess(node, nullptr, NameRef(broker(), p.name()),
n.value(), FeedbackSource(p.feedback()),
AccessMode::kStore);
}
Reduction JSNativeContextSpecialization::ReduceJSStoreNamedOwn(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreNamedOwn, node->opcode());
StoreNamedOwnParameters const& p = StoreNamedOwnParametersOf(node->op());
Node* const value = NodeProperties::GetValueInput(node, 1);
JSStoreNamedOwnNode n(node);
StoreNamedOwnParameters const& p = n.Parameters();
if (!p.feedback().IsValid()) return NoChange();
return ReducePropertyAccess(node, nullptr, NameRef(broker(), p.name()), value,
FeedbackSource(p.feedback()),
return ReducePropertyAccess(node, nullptr, NameRef(broker(), p.name()),
n.value(), FeedbackSource(p.feedback()),
AccessMode::kStoreInLiteral);
}
......@@ -1554,6 +1560,11 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
node->opcode() == IrOpcode::kJSStoreInArrayLiteral ||
node->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral ||
node->opcode() == IrOpcode::kJSHasProperty);
STATIC_ASSERT(JSLoadPropertyNode::ObjectIndex() == 0 &&
JSStorePropertyNode::ObjectIndex() == 0 &&
JSStoreInArrayLiteralNode::ArrayIndex() == 0 &&
JSStoreDataPropertyInLiteralNode::ObjectIndex() == 0 &&
JSHasPropertyNode::ObjectIndex() == 0);
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
......@@ -2457,34 +2468,27 @@ JSNativeContextSpecialization::BuildPropertyStore(
Reduction JSNativeContextSpecialization::ReduceJSStoreDataPropertyInLiteral(
Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreDataPropertyInLiteral, node->opcode());
FeedbackParameter const& p = FeedbackParameterOf(node->op());
Node* const key = NodeProperties::GetValueInput(node, 1);
Node* const value = NodeProperties::GetValueInput(node, 2);
Node* const flags = NodeProperties::GetValueInput(node, 3);
JSStoreDataPropertyInLiteralNode n(node);
FeedbackParameter const& p = n.Parameters();
if (!p.feedback().IsValid()) return NoChange();
NumberMatcher mflags(flags);
NumberMatcher mflags(n.flags());
CHECK(mflags.HasValue());
DataPropertyInLiteralFlags cflags(mflags.Value());
DCHECK(!(cflags & DataPropertyInLiteralFlag::kDontEnum));
if (cflags & DataPropertyInLiteralFlag::kSetFunctionName) return NoChange();
return ReducePropertyAccess(node, key, base::nullopt, value,
return ReducePropertyAccess(node, n.name(), base::nullopt, n.value(),
FeedbackSource(p.feedback()),
AccessMode::kStoreInLiteral);
}
Reduction JSNativeContextSpecialization::ReduceJSStoreInArrayLiteral(
Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreInArrayLiteral, node->opcode());
FeedbackParameter const& p = FeedbackParameterOf(node->op());
Node* const index = NodeProperties::GetValueInput(node, 1);
Node* const value = NodeProperties::GetValueInput(node, 2);
JSStoreInArrayLiteralNode n(node);
FeedbackParameter const& p = n.Parameters();
if (!p.feedback().IsValid()) return NoChange();
return ReducePropertyAccess(node, index, base::nullopt, value,
return ReducePropertyAccess(node, n.index(), base::nullopt, n.value(),
FeedbackSource(p.feedback()),
AccessMode::kStoreInLiteral);
}
......
......@@ -742,23 +742,35 @@ JS_BINOP_WITH_FEEDBACK(BINARY_OP)
const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral(
const FeedbackSource& feedback) {
static constexpr int kObject = 1;
static constexpr int kName = 1;
static constexpr int kValue = 1;
static constexpr int kFlags = 1;
static constexpr int kFeedbackVector = 1;
static constexpr int kArity =
kObject + kName + kValue + kFlags + kFeedbackVector;
FeedbackParameter parameters(feedback);
return new (zone()) Operator1<FeedbackParameter>( // --
IrOpcode::kJSStoreDataPropertyInLiteral,
Operator::kNoThrow, // opcode
"JSStoreDataPropertyInLiteral", // name
4, 1, 1, 0, 1, 1, // counts
kArity, 1, 1, 0, 1, 1, // counts
parameters); // parameter
}
const Operator* JSOperatorBuilder::StoreInArrayLiteral(
const FeedbackSource& feedback) {
static constexpr int kArray = 1;
static constexpr int kIndex = 1;
static constexpr int kValue = 1;
static constexpr int kFeedbackVector = 1;
static constexpr int kArity = kArray + kIndex + kValue + kFeedbackVector;
FeedbackParameter parameters(feedback);
return new (zone()) Operator1<FeedbackParameter>( // --
IrOpcode::kJSStoreInArrayLiteral,
Operator::kNoThrow, // opcode
"JSStoreInArrayLiteral", // name
3, 1, 1, 0, 1, 1, // counts
kArity, 1, 1, 0, 1, 1, // counts
parameters); // parameter
}
......@@ -889,11 +901,14 @@ const Operator* JSOperatorBuilder::ConstructWithSpread(
const Operator* JSOperatorBuilder::LoadNamed(Handle<Name> name,
const FeedbackSource& feedback) {
static constexpr int kObject = 1;
static constexpr int kFeedbackVector = 1;
static constexpr int kArity = kObject + kFeedbackVector;
NamedAccess access(LanguageMode::kSloppy, name, feedback);
return new (zone()) Operator1<NamedAccess>( // --
IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
"JSLoadNamed", // name
1, 1, 1, 1, 1, 2, // counts
kArity, 1, 1, 1, 1, 2, // counts
access); // parameter
}
......@@ -986,11 +1001,15 @@ int RestoreRegisterIndexOf(const Operator* op) {
const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
Handle<Name> name,
FeedbackSource const& feedback) {
static constexpr int kObject = 1;
static constexpr int kValue = 1;
static constexpr int kFeedbackVector = 1;
static constexpr int kArity = kObject + kValue + kFeedbackVector;
NamedAccess access(language_mode, name, feedback);
return new (zone()) Operator1<NamedAccess>( // --
IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode
"JSStoreNamed", // name
2, 1, 1, 0, 1, 2, // counts
kArity, 1, 1, 0, 1, 2, // counts
access); // parameter
}
......@@ -1006,11 +1025,15 @@ const Operator* JSOperatorBuilder::StoreProperty(
const Operator* JSOperatorBuilder::StoreNamedOwn(
Handle<Name> name, FeedbackSource const& feedback) {
static constexpr int kObject = 1;
static constexpr int kValue = 1;
static constexpr int kFeedbackVector = 1;
static constexpr int kArity = kObject + kValue + kFeedbackVector;
StoreNamedOwnParameters parameters(name, feedback);
return new (zone()) Operator1<StoreNamedOwnParameters>( // --
IrOpcode::kJSStoreNamedOwn, Operator::kNoProperties, // opcode
"JSStoreNamedOwn", // name
2, 1, 1, 0, 1, 2, // counts
kArity, 1, 1, 0, 1, 2, // counts
parameters); // parameter
}
......@@ -1031,22 +1054,27 @@ const Operator* JSOperatorBuilder::CreateGeneratorObject() {
const Operator* JSOperatorBuilder::LoadGlobal(const Handle<Name>& name,
const FeedbackSource& feedback,
TypeofMode typeof_mode) {
static constexpr int kFeedbackVector = 1;
static constexpr int kArity = kFeedbackVector;
LoadGlobalParameters parameters(name, feedback, typeof_mode);
return new (zone()) Operator1<LoadGlobalParameters>( // --
IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode
"JSLoadGlobal", // name
0, 1, 1, 1, 1, 2, // counts
kArity, 1, 1, 1, 1, 2, // counts
parameters); // parameter
}
const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode,
const Handle<Name>& name,
const FeedbackSource& feedback) {
static constexpr int kValue = 1;
static constexpr int kFeedbackVector = 1;
static constexpr int kArity = kValue + kFeedbackVector;
StoreGlobalParameters parameters(language_mode, feedback, name);
return new (zone()) Operator1<StoreGlobalParameters>( // --
IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode
"JSStoreGlobal", // name
1, 1, 1, 0, 1, 2, // counts
kArity, 1, 1, 0, 1, 2, // counts
parameters); // parameter
}
......@@ -1186,12 +1214,14 @@ const Operator* JSOperatorBuilder::CreateLiteralArray(
const Operator* JSOperatorBuilder::CreateEmptyLiteralArray(
FeedbackSource const& feedback) {
static constexpr int kFeedbackVector = 1;
static constexpr int kArity = kFeedbackVector;
FeedbackParameter parameters(feedback);
return new (zone()) Operator1<FeedbackParameter>( // --
IrOpcode::kJSCreateEmptyLiteralArray, // opcode
Operator::kEliminatable, // properties
"JSCreateEmptyLiteralArray", // name
0, 1, 1, 1, 1, 0, // counts
kArity, 1, 1, 1, 1, 0, // counts
parameters); // parameter
}
......
......@@ -1374,6 +1374,144 @@ using JSConstructWithSpreadNode =
using JSConstructWithArrayLikeNode =
JSConstructNodeBase<IrOpcode::kJSConstructWithArrayLike>;
class JSLoadNamedNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSLoadNamedNode(Node* node) : JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSLoadNamed);
}
const NamedAccess& Parameters() const { return NamedAccessOf(node()->op()); }
#define INPUTS(V) \
V(Object, object, 0, Object) \
V(FeedbackVector, feedback_vector, 1, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
class JSStoreNamedNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSStoreNamedNode(Node* node) : JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSStoreNamed);
}
const NamedAccess& Parameters() const { return NamedAccessOf(node()->op()); }
#define INPUTS(V) \
V(Object, object, 0, Object) \
V(Value, value, 1, Object) \
V(FeedbackVector, feedback_vector, 2, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
class JSStoreNamedOwnNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSStoreNamedOwnNode(Node* node) : JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSStoreNamedOwn);
}
const StoreNamedOwnParameters& Parameters() const {
return StoreNamedOwnParametersOf(node()->op());
}
#define INPUTS(V) \
V(Object, object, 0, Object) \
V(Value, value, 1, Object) \
V(FeedbackVector, feedback_vector, 2, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
class JSStoreGlobalNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSStoreGlobalNode(Node* node) : JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSStoreGlobal);
}
const StoreGlobalParameters& Parameters() const {
return StoreGlobalParametersOf(node()->op());
}
#define INPUTS(V) \
V(Value, value, 0, Object) \
V(FeedbackVector, feedback_vector, 1, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
class JSLoadGlobalNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSLoadGlobalNode(Node* node) : JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSLoadGlobal);
}
const LoadGlobalParameters& Parameters() const {
return LoadGlobalParametersOf(node()->op());
}
#define INPUTS(V) V(FeedbackVector, feedback_vector, 0, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
class JSCreateEmptyLiteralArrayNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSCreateEmptyLiteralArrayNode(Node* node)
: JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSCreateEmptyLiteralArray);
}
const FeedbackParameter& Parameters() const {
return FeedbackParameterOf(node()->op());
}
#define INPUTS(V) V(FeedbackVector, feedback_vector, 0, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
class JSStoreDataPropertyInLiteralNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSStoreDataPropertyInLiteralNode(Node* node)
: JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral);
}
const FeedbackParameter& Parameters() const {
return FeedbackParameterOf(node()->op());
}
#define INPUTS(V) \
V(Object, object, 0, Object) \
V(Name, name, 1, Object) \
V(Value, value, 2, Object) \
V(Flags, flags, 3, Object) \
V(FeedbackVector, feedback_vector, 4, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
class JSStoreInArrayLiteralNode final : public JSNodeWrapperBase {
public:
explicit constexpr JSStoreInArrayLiteralNode(Node* node)
: JSNodeWrapperBase(node) {
CONSTEXPR_DCHECK(node->opcode() == IrOpcode::kJSStoreInArrayLiteral);
}
const FeedbackParameter& Parameters() const {
return FeedbackParameterOf(node()->op());
}
#define INPUTS(V) \
V(Array, array, 0, Object) \
V(Index, index, 1, Object) \
V(Value, value, 2, Object) \
V(FeedbackVector, feedback_vector, 3, HeapObject)
INPUTS(DEFINE_INPUT_ACCESSORS)
#undef INPUTS
};
#undef DEFINE_INPUT_ACCESSORS
} // namespace compiler
......
......@@ -1160,8 +1160,8 @@ Reduction JSTypedLowering::ReduceJSToObject(Node* node) {
}
Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
Node* receiver = NodeProperties::GetValueInput(node, 0);
JSLoadNamedNode n(node);
Node* receiver = n.object();
Type receiver_type = NodeProperties::GetType(receiver);
NameRef name(broker(), NamedAccessOf(node->op()).name());
NameRef length_str(broker(), factory()->length_string());
......
......@@ -398,15 +398,15 @@ TEST_F(JSTypedLoweringTest, JSStoreContext) {
TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) {
FeedbackSource feedback;
Handle<Name> name = factory()->length_string();
Node* const receiver = Parameter(Type::String(), 0);
Node* const feedback = UndefinedConstant();
Node* const context = UndefinedConstant();
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction const r =
Reduce(graph()->NewNode(javascript()->LoadNamed(name, feedback), receiver,
context, EmptyFrameState(), effect, control));
Reduction const r = Reduce(graph()->NewNode(
javascript()->LoadNamed(name, FeedbackSource{}), receiver, feedback,
context, EmptyFrameState(), effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsStringLength(receiver));
}
......
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