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

Unified Diff: src/compiler/simplified-operator.cc

Issue 2692753004: [turbofan] escape analysis supports arguments object and rest elements (Closed)
Patch Set: handle the case where Deoptimizer::function_ is a Smi Created 3 years, 10 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/compiler/simplified-operator.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator.cc
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc
index 90a4e344d807f4275a5a5474dd2919c63a262b98..6c6ee3cd63aad0768509fcdbe59c19a5cdc32cc8 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -388,12 +388,6 @@ NumberOperationHint NumberOperationHintOf(const Operator* op) {
return OpParameter<NumberOperationHint>(op);
}
-int ParameterCountOf(const Operator* op) {
- DCHECK(op->opcode() == IrOpcode::kNewUnmappedArgumentsElements ||
- op->opcode() == IrOpcode::kNewRestParameterElements);
- return OpParameter<int>(op);
-}
-
PretenureFlag PretenureFlagOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
return OpParameter<PretenureFlag>(op);
@@ -564,6 +558,21 @@ struct SimplifiedOperatorGlobalCache final {
};
ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered;
+ struct ArgumentsFrameOperator final : public Operator {
+ ArgumentsFrameOperator()
+ : Operator(IrOpcode::kArgumentsFrame, Operator::kPure, "ArgumentsFrame",
+ 0, 0, 0, 1, 0, 0) {}
+ };
+ ArgumentsFrameOperator kArgumentsFrame;
+
+ struct NewUnmappedArgumentsElementsOperator final : public Operator {
+ NewUnmappedArgumentsElementsOperator()
+ : Operator(IrOpcode::kNewUnmappedArgumentsElements,
+ Operator::kEliminatable, "NewUnmappedArgumentsElements", 2,
+ 1, 0, 1, 1, 0) {}
+ };
+ NewUnmappedArgumentsElementsOperator kNewUnmappedArgumentsElements;
+
template <CheckForMinusZeroMode kMode>
struct CheckedInt32MulOperator final
: public Operator1<CheckForMinusZeroMode> {
@@ -708,6 +717,8 @@ SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
PURE_OP_LIST(GET_FROM_CACHE)
CHECKED_OP_LIST(GET_FROM_CACHE)
GET_FROM_CACHE(ArrayBufferWasNeutered)
+GET_FROM_CACHE(ArgumentsFrame)
+GET_FROM_CACHE(NewUnmappedArgumentsElements)
#undef GET_FROM_CACHE
const Operator* SimplifiedOperatorBuilder::CheckedInt32Mul(
@@ -805,24 +816,49 @@ const Operator* SimplifiedOperatorBuilder::TransitionElementsKind(
transition); // parameter
}
-const Operator* SimplifiedOperatorBuilder::NewUnmappedArgumentsElements(
- int parameter_count) {
- return new (zone()) Operator1<int>( // --
- IrOpcode::kNewUnmappedArgumentsElements, // opcode
- Operator::kEliminatable, // flags
- "NewUnmappedArgumentsElements", // name
- 0, 1, 0, 1, 1, 0, // counts
- parameter_count); // parameter
-}
-
-const Operator* SimplifiedOperatorBuilder::NewRestParameterElements(
- int parameter_count) {
- return new (zone()) Operator1<int>( // --
- IrOpcode::kNewRestParameterElements, // opcode
- Operator::kEliminatable, // flags
- "NewRestParameterElements", // name
- 0, 1, 0, 1, 1, 0, // counts
- parameter_count); // parameter
+namespace {
+
+struct ArgumentsLengthParameters {
+ int formal_parameter_count;
+ bool is_rest_length;
+};
+
+bool operator==(ArgumentsLengthParameters first,
+ ArgumentsLengthParameters second) {
+ return first.formal_parameter_count == second.formal_parameter_count &&
+ first.is_rest_length == second.is_rest_length;
+}
+
+size_t hash_value(ArgumentsLengthParameters param) {
+ return base::hash_combine(param.formal_parameter_count, param.is_rest_length);
+}
+
+std::ostream& operator<<(std::ostream& os, ArgumentsLengthParameters param) {
+ return os << param.formal_parameter_count << ", "
+ << (param.is_rest_length ? "rest length" : "not rest length");
+}
+
+} // namespace
+
+const Operator* SimplifiedOperatorBuilder::ArgumentsLength(
+ int formal_parameter_count, bool is_rest_length) {
+ return new (zone()) Operator1<ArgumentsLengthParameters>( // --
+ IrOpcode::kArgumentsLength, // opcode
+ Operator::kPure, // flags
+ "ArgumentsLength", // name
+ 1, 0, 0, 1, 0, 0, // counts
+ ArgumentsLengthParameters{formal_parameter_count,
+ is_rest_length}); // parameter
+}
+
+int FormalParameterCountOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kArgumentsLength);
+ return OpParameter<ArgumentsLengthParameters>(op).formal_parameter_count;
+}
+
+bool IsRestLengthOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kArgumentsLength);
+ return OpParameter<ArgumentsLengthParameters>(op).is_rest_length;
}
const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) {
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698