Commit e592fc42 authored by franzih's avatar franzih Committed by Commit bot

[compiler] Rename JS operator parameters.

DataPropertyParameters are not specific to StoreDataProperty.
Rename it to FeedbackParameter, so it can be used for similar
ICs, e.g., future CollectTypeProfile. Also, the parameter for spread calls contains just one parameter, remove the plural s.

BUG=

Review-Url: https://codereview.chromium.org/2725263003
Cr-Commit-Position: refs/heads/master@{#43604}
parent 66964e68
......@@ -664,7 +664,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
Reduction JSCallReducer::ReduceJSCallWithSpread(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallWithSpread, node->opcode());
SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op());
SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op());
DCHECK_LE(3u, p.arity());
int arity = static_cast<int>(p.arity() - 1);
......@@ -791,7 +791,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) {
DCHECK_EQ(IrOpcode::kJSConstructWithSpread, node->opcode());
SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op());
SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op());
DCHECK_LE(3u, p.arity());
int arity = static_cast<int>(p.arity() - 2);
......
......@@ -282,7 +282,7 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
}
void JSGenericLowering::LowerJSStoreDataPropertyInLiteral(Node* node) {
DataPropertyParameters const& p = DataPropertyParametersOf(node->op());
FeedbackParameter const& p = FeedbackParameterOf(node->op());
node->InsertInputs(zone(), 4, 2);
node->ReplaceInput(4, jsgraph()->HeapConstant(p.feedback().vector()));
node->ReplaceInput(5, jsgraph()->SmiConstant(p.feedback().index()));
......@@ -519,7 +519,7 @@ void JSGenericLowering::LowerJSConstruct(Node* node) {
}
void JSGenericLowering::LowerJSConstructWithSpread(Node* node) {
SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op());
SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2);
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
Callable callable = CodeFactory::ConstructWithSpread(isolate());
......@@ -572,7 +572,7 @@ void JSGenericLowering::LowerJSCall(Node* node) {
}
void JSGenericLowering::LowerJSCallWithSpread(Node* node) {
SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op());
SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2);
Callable callable = CodeFactory::CallWithSpread(isolate());
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
......
......@@ -1682,7 +1682,7 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreDataPropertyInLiteral(
// If deoptimization is disabled, we cannot optimize.
if (!(flags() & kDeoptimizationEnabled)) return NoChange();
DataPropertyParameters const& p = DataPropertyParametersOf(node->op());
FeedbackParameter const& p = FeedbackParameterOf(node->op());
if (!p.feedback().IsValid()) return NoChange();
......
......@@ -76,29 +76,28 @@ ConstructParameters const& ConstructParametersOf(Operator const* op) {
return OpParameter<ConstructParameters>(op);
}
bool operator==(SpreadWithArityParameters const& lhs,
SpreadWithArityParameters const& rhs) {
bool operator==(SpreadWithArityParameter const& lhs,
SpreadWithArityParameter const& rhs) {
return lhs.arity() == rhs.arity();
}
bool operator!=(SpreadWithArityParameters const& lhs,
SpreadWithArityParameters const& rhs) {
bool operator!=(SpreadWithArityParameter const& lhs,
SpreadWithArityParameter const& rhs) {
return !(lhs == rhs);
}
size_t hash_value(SpreadWithArityParameters const& p) {
size_t hash_value(SpreadWithArityParameter const& p) {
return base::hash_combine(p.arity());
}
std::ostream& operator<<(std::ostream& os, SpreadWithArityParameters const& p) {
std::ostream& operator<<(std::ostream& os, SpreadWithArityParameter const& p) {
return os << p.arity();
}
SpreadWithArityParameters const& SpreadWithArityParametersOf(
Operator const* op) {
SpreadWithArityParameter const& SpreadWithArityParameterOf(Operator const* op) {
DCHECK(op->opcode() == IrOpcode::kJSConstructWithSpread ||
op->opcode() == IrOpcode::kJSCallWithSpread);
return OpParameter<SpreadWithArityParameters>(op);
return OpParameter<SpreadWithArityParameter>(op);
}
std::ostream& operator<<(std::ostream& os, CallParameters const& p) {
......@@ -276,27 +275,25 @@ StoreNamedOwnParameters const& StoreNamedOwnParametersOf(const Operator* op) {
return OpParameter<StoreNamedOwnParameters>(op);
}
bool operator==(DataPropertyParameters const& lhs,
DataPropertyParameters const& rhs) {
bool operator==(FeedbackParameter const& lhs, FeedbackParameter const& rhs) {
return lhs.feedback() == rhs.feedback();
}
bool operator!=(DataPropertyParameters const& lhs,
DataPropertyParameters const& rhs) {
bool operator!=(FeedbackParameter const& lhs, FeedbackParameter const& rhs) {
return !(lhs == rhs);
}
size_t hash_value(DataPropertyParameters const& p) {
size_t hash_value(FeedbackParameter const& p) {
return base::hash_combine(p.feedback());
}
std::ostream& operator<<(std::ostream& os, DataPropertyParameters const& p) {
std::ostream& operator<<(std::ostream& os, FeedbackParameter const& p) {
return os;
}
DataPropertyParameters const& DataPropertyParametersOf(const Operator* op) {
FeedbackParameter const& FeedbackParameterOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral);
return OpParameter<DataPropertyParameters>(op);
return OpParameter<FeedbackParameter>(op);
}
bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) {
......@@ -699,8 +696,8 @@ COMPARE_OP_LIST(COMPARE_OP)
const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral(
const VectorSlotPair& feedback) {
DataPropertyParameters parameters(feedback);
return new (zone()) Operator1<DataPropertyParameters>( // --
FeedbackParameter parameters(feedback);
return new (zone()) Operator1<FeedbackParameter>( // --
IrOpcode::kJSStoreDataPropertyInLiteral,
Operator::kNoThrow, // opcode
"JSStoreDataPropertyInLiteral", // name
......@@ -741,8 +738,8 @@ const Operator* JSOperatorBuilder::Call(size_t arity, float frequency,
}
const Operator* JSOperatorBuilder::CallWithSpread(uint32_t arity) {
SpreadWithArityParameters parameters(arity);
return new (zone()) Operator1<SpreadWithArityParameters>( // --
SpreadWithArityParameter parameters(arity);
return new (zone()) Operator1<SpreadWithArityParameter>( // --
IrOpcode::kJSCallWithSpread, Operator::kNoProperties, // opcode
"JSCallWithSpread", // name
parameters.arity(), 1, 1, 1, 1, 2, // counts
......@@ -784,8 +781,8 @@ const Operator* JSOperatorBuilder::Construct(uint32_t arity, float frequency,
}
const Operator* JSOperatorBuilder::ConstructWithSpread(uint32_t arity) {
SpreadWithArityParameters parameters(arity);
return new (zone()) Operator1<SpreadWithArityParameters>( // --
SpreadWithArityParameter parameters(arity);
return new (zone()) Operator1<SpreadWithArityParameter>( // --
IrOpcode::kJSConstructWithSpread, Operator::kNoProperties, // opcode
"JSConstructWithSpread", // name
parameters.arity(), 1, 1, 1, 1, 2, // counts
......
......@@ -90,9 +90,9 @@ ConstructParameters const& ConstructParametersOf(Operator const*);
// Defines the arity for JavaScript calls with a spread as the last
// parameter. This is used as a parameter by JSConstructWithSpread and
// JSCallWithSpread operators.
class SpreadWithArityParameters final {
class SpreadWithArityParameter final {
public:
explicit SpreadWithArityParameters(uint32_t arity) : arity_(arity) {}
explicit SpreadWithArityParameter(uint32_t arity) : arity_(arity) {}
uint32_t arity() const { return arity_; }
......@@ -100,16 +100,16 @@ class SpreadWithArityParameters final {
uint32_t const arity_;
};
bool operator==(SpreadWithArityParameters const&,
SpreadWithArityParameters const&);
bool operator!=(SpreadWithArityParameters const&,
SpreadWithArityParameters const&);
bool operator==(SpreadWithArityParameter const&,
SpreadWithArityParameter const&);
bool operator!=(SpreadWithArityParameter const&,
SpreadWithArityParameter const&);
size_t hash_value(SpreadWithArityParameters const&);
size_t hash_value(SpreadWithArityParameter const&);
std::ostream& operator<<(std::ostream&, SpreadWithArityParameters const&);
std::ostream& operator<<(std::ostream&, SpreadWithArityParameter const&);
SpreadWithArityParameters const& SpreadWithArityParametersOf(Operator const*);
SpreadWithArityParameter const& SpreadWithArityParameterOf(Operator const*);
// Defines the flags for a JavaScript call forwarding parameters. This
// is used as parameter by JSCallForwardVarargs operators.
......@@ -332,9 +332,9 @@ const StoreNamedOwnParameters& StoreNamedOwnParametersOf(const Operator* op);
// Defines the feedback, i.e., vector and index, for storing a data property in
// an object literal. This is
// used as a parameter by the JSStoreDataPropertyInLiteral operator.
class DataPropertyParameters final {
class FeedbackParameter final {
public:
explicit DataPropertyParameters(VectorSlotPair const& feedback)
explicit FeedbackParameter(VectorSlotPair const& feedback)
: feedback_(feedback) {}
VectorSlotPair const& feedback() const { return feedback_; }
......@@ -343,14 +343,14 @@ class DataPropertyParameters final {
VectorSlotPair const feedback_;
};
bool operator==(DataPropertyParameters const&, DataPropertyParameters const&);
bool operator!=(DataPropertyParameters const&, DataPropertyParameters const&);
bool operator==(FeedbackParameter const&, FeedbackParameter const&);
bool operator!=(FeedbackParameter const&, FeedbackParameter const&);
size_t hash_value(DataPropertyParameters const&);
size_t hash_value(FeedbackParameter const&);
std::ostream& operator<<(std::ostream&, DataPropertyParameters const&);
std::ostream& operator<<(std::ostream&, FeedbackParameter const&);
const DataPropertyParameters& DataPropertyParametersOf(const Operator* op);
const FeedbackParameter& FeedbackParameterOf(const Operator* op);
// Defines the property of an object for a named access. This is
// used as a parameter by the JSLoadNamed and JSStoreNamed operators.
......
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