From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- chromium/v8/src/compiler/js-operator.cc | 206 +++++++------------------------- 1 file changed, 43 insertions(+), 163 deletions(-) (limited to 'chromium/v8/src/compiler/js-operator.cc') diff --git a/chromium/v8/src/compiler/js-operator.cc b/chromium/v8/src/compiler/js-operator.cc index 45e144094b9..b152569ae1f 100644 --- a/chromium/v8/src/compiler/js-operator.cc +++ b/chromium/v8/src/compiler/js-operator.cc @@ -7,7 +7,6 @@ #include #include "src/base/lazy-instance.h" -#include "src/compiler/opcodes.h" #include "src/compiler/operator.h" #include "src/handles/handles-inl.h" #include "src/objects/objects-inl.h" @@ -17,16 +16,22 @@ namespace v8 { namespace internal { namespace compiler { +namespace { + +// Returns properties for the given binary op. +constexpr Operator::Properties BinopProperties(Operator::Opcode opcode) { + CONSTEXPR_DCHECK(JSOperator::IsBinaryWithFeedback(opcode)); + return opcode == IrOpcode::kJSStrictEqual ? Operator::kPure + : Operator::kNoProperties; +} + +} // namespace + std::ostream& operator<<(std::ostream& os, CallFrequency const& f) { if (f.IsUnknown()) return os << "unknown"; return os << f.value(); } -CallFrequency CallFrequencyOf(Operator const* op) { - DCHECK_EQ(op->opcode(), IrOpcode::kJSConstructWithArrayLike); - return OpParameter(op); -} - std::ostream& operator<<(std::ostream& os, ConstructForwardVarargsParameters const& p) { return os << p.arity() << ", " << p.start_index(); @@ -60,6 +65,7 @@ std::ostream& operator<<(std::ostream& os, ConstructParameters const& p) { ConstructParameters const& ConstructParametersOf(Operator const* op) { DCHECK(op->opcode() == IrOpcode::kJSConstruct || + op->opcode() == IrOpcode::kJSConstructWithArrayLike || op->opcode() == IrOpcode::kJSConstructWithSpread); return OpParameter(op); } @@ -230,7 +236,9 @@ std::ostream& operator<<(std::ostream& os, FeedbackParameter const& p) { } FeedbackParameter const& FeedbackParameterOf(const Operator* op) { - DCHECK(op->opcode() == IrOpcode::kJSCreateEmptyLiteralArray || + DCHECK(JSOperator::IsUnaryWithFeedback(op->opcode()) || + JSOperator::IsBinaryWithFeedback(op->opcode()) || + op->opcode() == IrOpcode::kJSCreateEmptyLiteralArray || op->opcode() == IrOpcode::kJSInstanceOf || op->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral || op->opcode() == IrOpcode::kJSStoreInArrayLiteral); @@ -636,37 +644,7 @@ ForInMode ForInModeOf(Operator const* op) { return OpParameter(op); } -BinaryOperationHint BinaryOperationHintOf(const Operator* op) { - DCHECK_EQ(IrOpcode::kJSAdd, op->opcode()); - return OpParameter(op); -} - -CompareOperationHint CompareOperationHintOf(const Operator* op) { - DCHECK(op->opcode() == IrOpcode::kJSEqual || - op->opcode() == IrOpcode::kJSStrictEqual || - op->opcode() == IrOpcode::kJSLessThan || - op->opcode() == IrOpcode::kJSGreaterThan || - op->opcode() == IrOpcode::kJSLessThanOrEqual || - op->opcode() == IrOpcode::kJSGreaterThanOrEqual); - return OpParameter(op); -} - #define CACHED_OP_LIST(V) \ - V(BitwiseOr, Operator::kNoProperties, 2, 1) \ - V(BitwiseXor, Operator::kNoProperties, 2, 1) \ - V(BitwiseAnd, Operator::kNoProperties, 2, 1) \ - V(ShiftLeft, Operator::kNoProperties, 2, 1) \ - V(ShiftRight, Operator::kNoProperties, 2, 1) \ - V(ShiftRightLogical, Operator::kNoProperties, 2, 1) \ - V(Subtract, Operator::kNoProperties, 2, 1) \ - V(Multiply, Operator::kNoProperties, 2, 1) \ - V(Divide, Operator::kNoProperties, 2, 1) \ - V(Modulus, Operator::kNoProperties, 2, 1) \ - V(Exponentiate, Operator::kNoProperties, 2, 1) \ - V(BitwiseNot, Operator::kNoProperties, 1, 1) \ - V(Decrement, Operator::kNoProperties, 1, 1) \ - V(Increment, Operator::kNoProperties, 1, 1) \ - V(Negate, Operator::kNoProperties, 1, 1) \ V(ToLength, Operator::kNoProperties, 1, 1) \ V(ToName, Operator::kNoProperties, 1, 1) \ V(ToNumber, Operator::kNoProperties, 1, 1) \ @@ -703,16 +681,6 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) { V(ParseInt, Operator::kNoProperties, 2, 1) \ V(RegExpTest, Operator::kNoProperties, 2, 1) -#define BINARY_OP_LIST(V) V(Add) - -#define COMPARE_OP_LIST(V) \ - V(Equal, Operator::kNoProperties) \ - V(StrictEqual, Operator::kPure) \ - V(LessThan, Operator::kNoProperties) \ - V(GreaterThan, Operator::kNoProperties) \ - V(LessThanOrEqual, Operator::kNoProperties) \ - V(GreaterThanOrEqual, Operator::kNoProperties) - struct JSOperatorGlobalCache final { #define CACHED_OP(Name, properties, value_input_count, value_output_count) \ struct Name##Operator final : public Operator { \ @@ -726,55 +694,6 @@ struct JSOperatorGlobalCache final { Name##Operator k##Name##Operator; CACHED_OP_LIST(CACHED_OP) #undef CACHED_OP - -#define BINARY_OP(Name) \ - template \ - struct Name##Operator final : public Operator1 { \ - Name##Operator() \ - : Operator1(IrOpcode::kJS##Name, \ - Operator::kNoProperties, "JS" #Name, \ - 2, 1, 1, 1, 1, 2, kHint) {} \ - }; \ - Name##Operator k##Name##NoneOperator; \ - Name##Operator \ - k##Name##SignedSmallOperator; \ - Name##Operator \ - k##Name##SignedSmallInputsOperator; \ - Name##Operator k##Name##Signed32Operator; \ - Name##Operator k##Name##NumberOperator; \ - Name##Operator \ - k##Name##NumberOrOddballOperator; \ - Name##Operator k##Name##StringOperator; \ - Name##Operator k##Name##BigIntOperator; \ - Name##Operator k##Name##AnyOperator; - BINARY_OP_LIST(BINARY_OP) -#undef BINARY_OP - -#define COMPARE_OP(Name, properties) \ - template \ - struct Name##Operator final : public Operator1 { \ - Name##Operator() \ - : Operator1( \ - IrOpcode::kJS##Name, properties, "JS" #Name, 2, 1, 1, 1, 1, \ - Operator::ZeroIfNoThrow(properties), kHint) {} \ - }; \ - Name##Operator k##Name##NoneOperator; \ - Name##Operator \ - k##Name##SignedSmallOperator; \ - Name##Operator k##Name##NumberOperator; \ - Name##Operator \ - k##Name##NumberOrOddballOperator; \ - Name##Operator \ - k##Name##InternalizedStringOperator; \ - Name##Operator k##Name##StringOperator; \ - Name##Operator k##Name##SymbolOperator; \ - Name##Operator k##Name##BigIntOperator; \ - Name##Operator k##Name##ReceiverOperator; \ - Name##Operator \ - k##Name##ReceiverOrNullOrUndefinedOperator; \ - Name##Operator k##Name##AnyOperator; - COMPARE_OP_LIST(COMPARE_OP) -#undef COMPARE_OP }; namespace { @@ -791,65 +710,26 @@ JSOperatorBuilder::JSOperatorBuilder(Zone* zone) CACHED_OP_LIST(CACHED_OP) #undef CACHED_OP -#define BINARY_OP(Name) \ - const Operator* JSOperatorBuilder::Name(BinaryOperationHint hint) { \ - switch (hint) { \ - case BinaryOperationHint::kNone: \ - return &cache_.k##Name##NoneOperator; \ - case BinaryOperationHint::kSignedSmall: \ - return &cache_.k##Name##SignedSmallOperator; \ - case BinaryOperationHint::kSignedSmallInputs: \ - return &cache_.k##Name##SignedSmallInputsOperator; \ - case BinaryOperationHint::kSigned32: \ - return &cache_.k##Name##Signed32Operator; \ - case BinaryOperationHint::kNumber: \ - return &cache_.k##Name##NumberOperator; \ - case BinaryOperationHint::kNumberOrOddball: \ - return &cache_.k##Name##NumberOrOddballOperator; \ - case BinaryOperationHint::kString: \ - return &cache_.k##Name##StringOperator; \ - case BinaryOperationHint::kBigInt: \ - return &cache_.k##Name##BigIntOperator; \ - case BinaryOperationHint::kAny: \ - return &cache_.k##Name##AnyOperator; \ - } \ - UNREACHABLE(); \ - return nullptr; \ +#define UNARY_OP(JSName, Name) \ + const Operator* JSOperatorBuilder::Name(FeedbackSource const& feedback) { \ + FeedbackParameter parameters(feedback); \ + return new (zone()) Operator1( \ + IrOpcode::k##JSName, Operator::kNoProperties, #JSName, 2, 1, 1, 1, 1, \ + 2, parameters); \ } -BINARY_OP_LIST(BINARY_OP) -#undef BINARY_OP - -#define COMPARE_OP(Name, ...) \ - const Operator* JSOperatorBuilder::Name(CompareOperationHint hint) { \ - switch (hint) { \ - case CompareOperationHint::kNone: \ - return &cache_.k##Name##NoneOperator; \ - case CompareOperationHint::kSignedSmall: \ - return &cache_.k##Name##SignedSmallOperator; \ - case CompareOperationHint::kNumber: \ - return &cache_.k##Name##NumberOperator; \ - case CompareOperationHint::kNumberOrOddball: \ - return &cache_.k##Name##NumberOrOddballOperator; \ - case CompareOperationHint::kInternalizedString: \ - return &cache_.k##Name##InternalizedStringOperator; \ - case CompareOperationHint::kString: \ - return &cache_.k##Name##StringOperator; \ - case CompareOperationHint::kSymbol: \ - return &cache_.k##Name##SymbolOperator; \ - case CompareOperationHint::kBigInt: \ - return &cache_.k##Name##BigIntOperator; \ - case CompareOperationHint::kReceiver: \ - return &cache_.k##Name##ReceiverOperator; \ - case CompareOperationHint::kReceiverOrNullOrUndefined: \ - return &cache_.k##Name##ReceiverOrNullOrUndefinedOperator; \ - case CompareOperationHint::kAny: \ - return &cache_.k##Name##AnyOperator; \ - } \ - UNREACHABLE(); \ - return nullptr; \ +JS_UNOP_WITH_FEEDBACK(UNARY_OP) +#undef UNARY_OP + +#define BINARY_OP(JSName, Name) \ + const Operator* JSOperatorBuilder::Name(FeedbackSource const& feedback) { \ + static constexpr auto kProperties = BinopProperties(IrOpcode::k##JSName); \ + FeedbackParameter parameters(feedback); \ + return new (zone()) Operator1( \ + IrOpcode::k##JSName, kProperties, #JSName, 3, 1, 1, 1, 1, \ + Operator::ZeroIfNoThrow(kProperties), parameters); \ } -COMPARE_OP_LIST(COMPARE_OP) -#undef COMPARE_OP +JS_BINOP_WITH_FEEDBACK(BINARY_OP) +#undef BINARY_OP const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral( const FeedbackSource& feedback) { @@ -972,13 +852,15 @@ const Operator* JSOperatorBuilder::Construct(uint32_t arity, } const Operator* JSOperatorBuilder::ConstructWithArrayLike( - CallFrequency const& frequency) { - return new (zone()) Operator1( // -- - IrOpcode::kJSConstructWithArrayLike, // opcode - Operator::kNoProperties, // properties - "JSConstructWithArrayLike", // name - 3, 1, 1, 1, 1, 2, // counts - frequency); // parameter + CallFrequency const& frequency, FeedbackSource const& feedback) { + static constexpr uint32_t arity = 3; + ConstructParameters parameters(arity, frequency, feedback); + return new (zone()) Operator1( // -- + IrOpcode::kJSConstructWithArrayLike, // opcode + Operator::kNoProperties, // properties + "JSConstructWithArrayLike", // name + parameters.arity(), 1, 1, 1, 1, 2, // counts + parameters); // parameter } const Operator* JSOperatorBuilder::ConstructWithSpread( @@ -1359,7 +1241,7 @@ const Operator* JSOperatorBuilder::CreateEmptyLiteralObject() { IrOpcode::kJSCreateEmptyLiteralObject, // opcode Operator::kNoProperties, // properties "JSCreateEmptyLiteralObject", // name - 1, 1, 1, 1, 1, 2); // counts + 0, 1, 1, 1, 1, 2); // counts } const Operator* JSOperatorBuilder::CreateLiteralRegExp( @@ -1420,9 +1302,7 @@ Handle ScopeInfoOf(const Operator* op) { return OpParameter>(op); } -#undef BINARY_OP_LIST #undef CACHED_OP_LIST -#undef COMPARE_OP_LIST } // namespace compiler } // namespace internal -- cgit v1.2.1