diff options
Diffstat (limited to 'deps/v8/src/compiler/js-operator.cc')
-rw-r--r-- | deps/v8/src/compiler/js-operator.cc | 100 |
1 files changed, 57 insertions, 43 deletions
diff --git a/deps/v8/src/compiler/js-operator.cc b/deps/v8/src/compiler/js-operator.cc index 7b1df6e5a9..5b5e6589d2 100644 --- a/deps/v8/src/compiler/js-operator.cc +++ b/deps/v8/src/compiler/js-operator.cc @@ -52,17 +52,6 @@ size_t hash_value(VectorSlotPair const& p) { } -ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) { - DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); - return OpParameter<ConvertReceiverMode>(op); -} - - -ToBooleanHints ToBooleanHintsOf(Operator const* op) { - DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); - return OpParameter<ToBooleanHints>(op); -} - std::ostream& operator<<(std::ostream& os, ConstructForwardVarargsParameters const& p) { return os << p.arity() << ", " << p.start_index(); @@ -291,6 +280,7 @@ std::ostream& operator<<(std::ostream& os, FeedbackParameter const& p) { FeedbackParameter const& FeedbackParameterOf(const Operator* op) { DCHECK(op->opcode() == IrOpcode::kJSCreateEmptyLiteralArray || + op->opcode() == IrOpcode::kJSInstanceOf || op->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral); return OpParameter<FeedbackParameter>(op); } @@ -450,6 +440,33 @@ const CreateArrayParameters& CreateArrayParametersOf(const Operator* op) { return OpParameter<CreateArrayParameters>(op); } +bool operator==(CreateBoundFunctionParameters const& lhs, + CreateBoundFunctionParameters const& rhs) { + return lhs.arity() == rhs.arity() && + lhs.map().location() == rhs.map().location(); +} + +bool operator!=(CreateBoundFunctionParameters const& lhs, + CreateBoundFunctionParameters const& rhs) { + return !(lhs == rhs); +} + +size_t hash_value(CreateBoundFunctionParameters const& p) { + return base::hash_combine(p.arity(), p.map().location()); +} + +std::ostream& operator<<(std::ostream& os, + CreateBoundFunctionParameters const& p) { + os << p.arity(); + if (!p.map().is_null()) os << ", " << Brief(*p.map()); + return os; +} + +const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf( + const Operator* op) { + DCHECK_EQ(IrOpcode::kJSCreateBoundFunction, op->opcode()); + return OpParameter<CreateBoundFunctionParameters>(op); +} bool operator==(CreateClosureParameters const& lhs, CreateClosureParameters const& rhs) { @@ -560,20 +577,23 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) { 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(ToInteger, Operator::kNoProperties, 1, 1) \ V(ToLength, Operator::kNoProperties, 1, 1) \ V(ToName, Operator::kNoProperties, 1, 1) \ V(ToNumber, Operator::kNoProperties, 1, 1) \ + V(ToNumeric, Operator::kNoProperties, 1, 1) \ V(ToObject, Operator::kFoldable, 1, 1) \ V(ToString, Operator::kNoProperties, 1, 1) \ V(Create, Operator::kNoProperties, 2, 1) \ V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ V(CreateKeyValueArray, Operator::kEliminatable, 2, 1) \ V(HasProperty, Operator::kNoProperties, 2, 1) \ - V(ClassOf, Operator::kPure, 1, 1) \ - V(TypeOf, Operator::kPure, 1, 1) \ V(HasInPrototypeChain, Operator::kNoProperties, 2, 1) \ - V(InstanceOf, Operator::kNoProperties, 2, 1) \ V(OrdinaryHasInstance, Operator::kNoProperties, 2, 1) \ V(ForInEnumerate, Operator::kNoProperties, 1, 1) \ V(LoadMessage, Operator::kNoThrow | Operator::kNoWrite, 0, 1) \ @@ -731,15 +751,6 @@ const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral( parameters); // parameter } -const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { - // TODO(turbofan): Cache most important versions of this operator. - return new (zone()) Operator1<ToBooleanHints>( //-- - IrOpcode::kJSToBoolean, Operator::kPure, // opcode - "JSToBoolean", // name - 1, 0, 0, 1, 0, 0, // inputs/outputs - hints); // parameter -} - const Operator* JSOperatorBuilder::CallForwardVarargs(size_t arity, uint32_t start_index) { CallForwardVarargsParameters parameters(arity, start_index); @@ -845,18 +856,9 @@ const Operator* JSOperatorBuilder::ConstructWithSpread( parameters); // parameter } -const Operator* JSOperatorBuilder::ConvertReceiver( - ConvertReceiverMode convert_mode) { - return new (zone()) Operator1<ConvertReceiverMode>( // -- - IrOpcode::kJSConvertReceiver, Operator::kEliminatable, // opcode - "JSConvertReceiver", // name - 1, 1, 1, 1, 1, 0, // counts - convert_mode); // parameter -} - const Operator* JSOperatorBuilder::LoadNamed(Handle<Name> name, const VectorSlotPair& feedback) { - NamedAccess access(SLOPPY, name, feedback); + NamedAccess access(LanguageMode::kSloppy, name, feedback); return new (zone()) Operator1<NamedAccess>( // -- IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode "JSLoadNamed", // name @@ -866,7 +868,7 @@ const Operator* JSOperatorBuilder::LoadNamed(Handle<Name> name, const Operator* JSOperatorBuilder::LoadProperty( VectorSlotPair const& feedback) { - PropertyAccess access(SLOPPY, feedback); + PropertyAccess access(LanguageMode::kSloppy, feedback); return new (zone()) Operator1<PropertyAccess>( // -- IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode "JSLoadProperty", // name @@ -874,6 +876,15 @@ const Operator* JSOperatorBuilder::LoadProperty( access); // parameter } +const Operator* JSOperatorBuilder::InstanceOf(VectorSlotPair const& feedback) { + FeedbackParameter parameter(feedback); + return new (zone()) Operator1<FeedbackParameter>( // -- + IrOpcode::kJSInstanceOf, Operator::kNoProperties, // opcode + "JSInstanceOf", // name + 2, 1, 1, 1, 1, 2, // counts + parameter); // parameter +} + const Operator* JSOperatorBuilder::ForInNext(ForInMode mode) { return new (zone()) Operator1<ForInMode>( // -- IrOpcode::kJSForInNext, Operator::kNoProperties, // opcode @@ -1037,6 +1048,18 @@ const Operator* JSOperatorBuilder::CreateArray(size_t arity, parameters); // parameter } +const Operator* JSOperatorBuilder::CreateBoundFunction(size_t arity, + Handle<Map> map) { + // bound_target_function, bound_this, arg1, ..., argN + int const value_input_count = static_cast<int>(arity) + 2; + CreateBoundFunctionParameters parameters(arity, map); + return new (zone()) Operator1<CreateBoundFunctionParameters>( // -- + IrOpcode::kJSCreateBoundFunction, Operator::kEliminatable, // opcode + "JSCreateBoundFunction", // name + value_input_count, 1, 1, 1, 1, 0, // counts + parameters); // parameter +} + const Operator* JSOperatorBuilder::CreateClosure( Handle<SharedFunctionInfo> shared_info, VectorSlotPair const& feedback, PretenureFlag pretenure) { @@ -1145,15 +1168,6 @@ const Operator* JSOperatorBuilder::CreateBlockContext( scope_info); // parameter } -const Operator* JSOperatorBuilder::CreateScriptContext( - const Handle<ScopeInfo>& scope_info) { - return new (zone()) Operator1<Handle<ScopeInfo>>( // -- - IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode - "JSCreateScriptContext", // name - 1, 1, 1, 1, 1, 2, // counts - scope_info); // parameter -} - } // namespace compiler } // namespace internal } // namespace v8 |