diff options
Diffstat (limited to 'deps/v8/src/compiler/js-operator.h')
-rw-r--r-- | deps/v8/src/compiler/js-operator.h | 275 |
1 files changed, 156 insertions, 119 deletions
diff --git a/deps/v8/src/compiler/js-operator.h b/deps/v8/src/compiler/js-operator.h index 5bc2734023..260e366af8 100644 --- a/deps/v8/src/compiler/js-operator.h +++ b/deps/v8/src/compiler/js-operator.h @@ -363,28 +363,33 @@ V8_EXPORT_PRIVATE ContextAccess const& ContextAccessOf(Operator const*); // is used as a parameter by the JSCreateFunctionContext operator. class CreateFunctionContextParameters final { public: - CreateFunctionContextParameters(Handle<ScopeInfo> scope_info, int slot_count, - ScopeType scope_type); + CreateFunctionContextParameters(const ScopeInfoRef& scope_info, + int slot_count, ScopeType scope_type) + : scope_info_(scope_info), + slot_count_(slot_count), + scope_type_(scope_type) {} - Handle<ScopeInfo> scope_info() const { return scope_info_; } + ScopeInfoRef scope_info(JSHeapBroker* broker) const { + return scope_info_.AsRef(broker); + } int slot_count() const { return slot_count_; } ScopeType scope_type() const { return scope_type_; } private: - Handle<ScopeInfo> scope_info_; + const ScopeInfoTinyRef scope_info_; int const slot_count_; ScopeType const scope_type_; -}; -bool operator==(CreateFunctionContextParameters const& lhs, - CreateFunctionContextParameters const& rhs); -bool operator!=(CreateFunctionContextParameters const& lhs, - CreateFunctionContextParameters const& rhs); + friend bool operator==(CreateFunctionContextParameters const& lhs, + CreateFunctionContextParameters const& rhs); + friend bool operator!=(CreateFunctionContextParameters const& lhs, + CreateFunctionContextParameters const& rhs); -size_t hash_value(CreateFunctionContextParameters const& parameters); + friend size_t hash_value(CreateFunctionContextParameters const& parameters); -std::ostream& operator<<(std::ostream& os, - CreateFunctionContextParameters const& parameters); + friend std::ostream& operator<<( + std::ostream& os, CreateFunctionContextParameters const& parameters); +}; CreateFunctionContextParameters const& CreateFunctionContextParametersOf( Operator const*); @@ -392,23 +397,24 @@ CreateFunctionContextParameters const& CreateFunctionContextParametersOf( // Defines parameters for JSStoreNamedOwn operator. class StoreNamedOwnParameters final { public: - StoreNamedOwnParameters(Handle<Name> name, FeedbackSource const& feedback) + StoreNamedOwnParameters(const NameRef& name, FeedbackSource const& feedback) : name_(name), feedback_(feedback) {} - Handle<Name> name() const { return name_; } + NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); } FeedbackSource const& feedback() const { return feedback_; } private: - Handle<Name> const name_; + const NameTinyRef name_; FeedbackSource const feedback_; -}; - -bool operator==(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&); -bool operator!=(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&); -size_t hash_value(StoreNamedOwnParameters const&); - -std::ostream& operator<<(std::ostream&, StoreNamedOwnParameters const&); + friend bool operator==(StoreNamedOwnParameters const&, + StoreNamedOwnParameters const&); + friend bool operator!=(StoreNamedOwnParameters const&, + StoreNamedOwnParameters const&); + friend size_t hash_value(StoreNamedOwnParameters const&); + friend std::ostream& operator<<(std::ostream&, + StoreNamedOwnParameters const&); +}; const StoreNamedOwnParameters& StoreNamedOwnParametersOf(const Operator* op); @@ -439,26 +445,26 @@ const FeedbackParameter& FeedbackParameterOf(const Operator* op); // used as a parameter by the JSLoadNamed and JSStoreNamed operators. class NamedAccess final { public: - NamedAccess(LanguageMode language_mode, Handle<Name> name, + NamedAccess(LanguageMode language_mode, const NameRef& name, FeedbackSource const& feedback) : name_(name), feedback_(feedback), language_mode_(language_mode) {} - Handle<Name> name() const { return name_; } + NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); } LanguageMode language_mode() const { return language_mode_; } FeedbackSource const& feedback() const { return feedback_; } private: - Handle<Name> const name_; + const NameTinyRef name_; FeedbackSource const feedback_; LanguageMode const language_mode_; -}; -bool operator==(NamedAccess const&, NamedAccess const&); -bool operator!=(NamedAccess const&, NamedAccess const&); + friend bool operator==(NamedAccess const&, NamedAccess const&); + friend bool operator!=(NamedAccess const&, NamedAccess const&); -size_t hash_value(NamedAccess const&); + friend size_t hash_value(NamedAccess const&); -std::ostream& operator<<(std::ostream&, NamedAccess const&); + friend std::ostream& operator<<(std::ostream&, NamedAccess const&); +}; const NamedAccess& NamedAccessOf(const Operator* op); @@ -467,27 +473,29 @@ const NamedAccess& NamedAccessOf(const Operator* op); // used as a parameter by JSLoadGlobal operator. class LoadGlobalParameters final { public: - LoadGlobalParameters(const Handle<Name>& name, const FeedbackSource& feedback, + LoadGlobalParameters(const NameRef& name, const FeedbackSource& feedback, TypeofMode typeof_mode) : name_(name), feedback_(feedback), typeof_mode_(typeof_mode) {} - const Handle<Name>& name() const { return name_; } + NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); } TypeofMode typeof_mode() const { return typeof_mode_; } const FeedbackSource& feedback() const { return feedback_; } private: - const Handle<Name> name_; + const NameTinyRef name_; const FeedbackSource feedback_; const TypeofMode typeof_mode_; -}; -bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&); -bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&); + friend bool operator==(LoadGlobalParameters const&, + LoadGlobalParameters const&); + friend bool operator!=(LoadGlobalParameters const&, + LoadGlobalParameters const&); -size_t hash_value(LoadGlobalParameters const&); + friend size_t hash_value(LoadGlobalParameters const&); -std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&); + friend std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&); +}; const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op); @@ -497,26 +505,27 @@ const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op); class StoreGlobalParameters final { public: StoreGlobalParameters(LanguageMode language_mode, - const FeedbackSource& feedback, - const Handle<Name>& name) + const FeedbackSource& feedback, const NameRef& name) : language_mode_(language_mode), name_(name), feedback_(feedback) {} LanguageMode language_mode() const { return language_mode_; } FeedbackSource const& feedback() const { return feedback_; } - Handle<Name> const& name() const { return name_; } + NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); } private: LanguageMode const language_mode_; - Handle<Name> const name_; + const NameTinyRef name_; FeedbackSource const feedback_; -}; -bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&); -bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&); + friend bool operator==(StoreGlobalParameters const&, + StoreGlobalParameters const&); + friend bool operator!=(StoreGlobalParameters const&, + StoreGlobalParameters const&); -size_t hash_value(StoreGlobalParameters const&); + friend size_t hash_value(StoreGlobalParameters const&); -std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&); + friend std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&); +}; const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op); @@ -555,24 +564,26 @@ CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op); // used as parameter by JSCreateArray operators. class CreateArrayParameters final { public: - explicit CreateArrayParameters(size_t arity, MaybeHandle<AllocationSite> site) + CreateArrayParameters(size_t arity, base::Optional<AllocationSiteRef> site) : arity_(arity), site_(site) {} size_t arity() const { return arity_; } - MaybeHandle<AllocationSite> site() const { return site_; } + base::Optional<AllocationSiteRef> site(JSHeapBroker* broker) const { + return AllocationSiteTinyRef::AsOptionalRef(broker, site_); + } private: size_t const arity_; - MaybeHandle<AllocationSite> const site_; + base::Optional<AllocationSiteTinyRef> const site_; + + friend bool operator==(CreateArrayParameters const&, + CreateArrayParameters const&); + friend bool operator!=(CreateArrayParameters const&, + CreateArrayParameters const&); + friend size_t hash_value(CreateArrayParameters const&); + friend std::ostream& operator<<(std::ostream&, CreateArrayParameters const&); }; -bool operator==(CreateArrayParameters const&, CreateArrayParameters const&); -bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&); - -size_t hash_value(CreateArrayParameters const&); - -std::ostream& operator<<(std::ostream&, CreateArrayParameters const&); - const CreateArrayParameters& CreateArrayParametersOf(const Operator* op); // Defines shared information for the array iterator that should be created. @@ -635,25 +646,26 @@ const CreateCollectionIteratorParameters& CreateCollectionIteratorParametersOf( // This is used as parameter by JSCreateBoundFunction operators. class CreateBoundFunctionParameters final { public: - CreateBoundFunctionParameters(size_t arity, Handle<Map> map) + CreateBoundFunctionParameters(size_t arity, const MapRef& map) : arity_(arity), map_(map) {} size_t arity() const { return arity_; } - Handle<Map> map() const { return map_; } + MapRef map(JSHeapBroker* broker) const { return map_.AsRef(broker); } private: size_t const arity_; - Handle<Map> const map_; -}; + const MapTinyRef map_; -bool operator==(CreateBoundFunctionParameters const&, - CreateBoundFunctionParameters const&); -bool operator!=(CreateBoundFunctionParameters const&, - CreateBoundFunctionParameters const&); + friend bool operator==(CreateBoundFunctionParameters const&, + CreateBoundFunctionParameters const&); + friend bool operator!=(CreateBoundFunctionParameters const&, + CreateBoundFunctionParameters const&); -size_t hash_value(CreateBoundFunctionParameters const&); + friend size_t hash_value(CreateBoundFunctionParameters const&); -std::ostream& operator<<(std::ostream&, CreateBoundFunctionParameters const&); + friend std::ostream& operator<<(std::ostream&, + CreateBoundFunctionParameters const&); +}; const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf( const Operator* op); @@ -662,54 +674,64 @@ const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf( // used as a parameter by JSCreateClosure operators. class CreateClosureParameters final { public: - CreateClosureParameters(Handle<SharedFunctionInfo> shared_info, - Handle<CodeT> code, AllocationType allocation) + CreateClosureParameters(const SharedFunctionInfoRef& shared_info, + const CodeTRef& code, AllocationType allocation) : shared_info_(shared_info), code_(code), allocation_(allocation) {} - Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } - Handle<CodeT> code() const { return code_; } + SharedFunctionInfoRef shared_info(JSHeapBroker* broker) const { + return shared_info_.AsRef(broker); + } + CodeTRef code(JSHeapBroker* broker) const { return code_.AsRef(broker); } AllocationType allocation() const { return allocation_; } private: - Handle<SharedFunctionInfo> const shared_info_; - Handle<CodeT> const code_; + const SharedFunctionInfoTinyRef shared_info_; + const CodeTTinyRef code_; AllocationType const allocation_; -}; -bool operator==(CreateClosureParameters const&, CreateClosureParameters const&); -bool operator!=(CreateClosureParameters const&, CreateClosureParameters const&); + friend bool operator==(CreateClosureParameters const&, + CreateClosureParameters const&); + friend bool operator!=(CreateClosureParameters const&, + CreateClosureParameters const&); -size_t hash_value(CreateClosureParameters const&); + friend size_t hash_value(CreateClosureParameters const&); -std::ostream& operator<<(std::ostream&, CreateClosureParameters const&); + friend std::ostream& operator<<(std::ostream&, + CreateClosureParameters const&); +}; const CreateClosureParameters& CreateClosureParametersOf(const Operator* op); class GetTemplateObjectParameters final { public: - GetTemplateObjectParameters(Handle<TemplateObjectDescription> description, - Handle<SharedFunctionInfo> shared, + GetTemplateObjectParameters(const TemplateObjectDescriptionRef& description, + const SharedFunctionInfoRef& shared, FeedbackSource const& feedback) : description_(description), shared_(shared), feedback_(feedback) {} - Handle<TemplateObjectDescription> description() const { return description_; } - Handle<SharedFunctionInfo> shared() const { return shared_; } + TemplateObjectDescriptionRef description(JSHeapBroker* broker) const { + return description_.AsRef(broker); + } + SharedFunctionInfoRef shared(JSHeapBroker* broker) const { + return shared_.AsRef(broker); + } FeedbackSource const& feedback() const { return feedback_; } private: - Handle<TemplateObjectDescription> const description_; - Handle<SharedFunctionInfo> const shared_; + const TemplateObjectDescriptionTinyRef description_; + const SharedFunctionInfoTinyRef shared_; FeedbackSource const feedback_; -}; -bool operator==(GetTemplateObjectParameters const&, - GetTemplateObjectParameters const&); -bool operator!=(GetTemplateObjectParameters const&, - GetTemplateObjectParameters const&); + friend bool operator==(GetTemplateObjectParameters const&, + GetTemplateObjectParameters const&); + friend bool operator!=(GetTemplateObjectParameters const&, + GetTemplateObjectParameters const&); -size_t hash_value(GetTemplateObjectParameters const&); + friend size_t hash_value(GetTemplateObjectParameters const&); -std::ostream& operator<<(std::ostream&, GetTemplateObjectParameters const&); + friend std::ostream& operator<<(std::ostream&, + GetTemplateObjectParameters const&); +}; const GetTemplateObjectParameters& GetTemplateObjectParametersOf( const Operator* op); @@ -719,31 +741,36 @@ const GetTemplateObjectParameters& GetTemplateObjectParametersOf( // JSCreateLiteralRegExp operators. class CreateLiteralParameters final { public: - CreateLiteralParameters(Handle<HeapObject> constant, + CreateLiteralParameters(const HeapObjectRef& constant, FeedbackSource const& feedback, int length, int flags) : constant_(constant), feedback_(feedback), length_(length), flags_(flags) {} - Handle<HeapObject> constant() const { return constant_; } + HeapObjectRef constant(JSHeapBroker* broker) const { + return constant_.AsRef(broker); + } FeedbackSource const& feedback() const { return feedback_; } int length() const { return length_; } int flags() const { return flags_; } private: - Handle<HeapObject> const constant_; + const HeapObjectTinyRef constant_; FeedbackSource const feedback_; int const length_; int const flags_; -}; -bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&); -bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&); + friend bool operator==(CreateLiteralParameters const&, + CreateLiteralParameters const&); + friend bool operator!=(CreateLiteralParameters const&, + CreateLiteralParameters const&); -size_t hash_value(CreateLiteralParameters const&); + friend size_t hash_value(CreateLiteralParameters const&); -std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&); + friend std::ostream& operator<<(std::ostream&, + CreateLiteralParameters const&); +}; const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op); @@ -857,7 +884,16 @@ int RegisterCountOf(Operator const* op) V8_WARN_UNUSED_RESULT; int GeneratorStoreValueCountOf(const Operator* op) V8_WARN_UNUSED_RESULT; int RestoreRegisterIndexOf(const Operator* op) V8_WARN_UNUSED_RESULT; -Handle<ScopeInfo> ScopeInfoOf(const Operator* op) V8_WARN_UNUSED_RESULT; +ScopeInfoRef ScopeInfoOf(JSHeapBroker* broker, + const Operator* op) V8_WARN_UNUSED_RESULT; + +bool operator==(ScopeInfoTinyRef const&, ScopeInfoTinyRef const&); +bool operator!=(ScopeInfoTinyRef const&, ScopeInfoTinyRef const&); + +size_t hash_value(ScopeInfoTinyRef const&); + +V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, + ScopeInfoTinyRef const&); // Interface for building JavaScript-level operators, e.g. directly from the // AST. Most operators have no parameters, thus can be globally shared for all @@ -904,13 +940,14 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final const Operator* Create(); const Operator* CreateArguments(CreateArgumentsType type); - const Operator* CreateArray(size_t arity, MaybeHandle<AllocationSite> site); + const Operator* CreateArray(size_t arity, + base::Optional<AllocationSiteRef> site); const Operator* CreateArrayIterator(IterationKind); const Operator* CreateAsyncFunctionObject(int register_count); const Operator* CreateCollectionIterator(CollectionKind, IterationKind); - const Operator* CreateBoundFunction(size_t arity, Handle<Map> map); + const Operator* CreateBoundFunction(size_t arity, const MapRef& map); const Operator* CreateClosure( - Handle<SharedFunctionInfo> shared_info, Handle<CodeT> code, + const SharedFunctionInfoRef& shared_info, const CodeTRef& code, AllocationType allocation = AllocationType::kYoung); const Operator* CreateIterResultObject(); const Operator* CreateStringIterator(); @@ -919,25 +956,25 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final const Operator* CreatePromise(); const Operator* CreateTypedArray(); const Operator* CreateLiteralArray( - Handle<ArrayBoilerplateDescription> constant, + const ArrayBoilerplateDescriptionRef& constant, FeedbackSource const& feedback, int literal_flags, int number_of_elements); const Operator* CreateEmptyLiteralArray(FeedbackSource const& feedback); const Operator* CreateArrayFromIterable(); const Operator* CreateEmptyLiteralObject(); const Operator* CreateLiteralObject( - Handle<ObjectBoilerplateDescription> constant, + const ObjectBoilerplateDescriptionRef& constant, FeedbackSource const& feedback, int literal_flags, int number_of_properties); const Operator* CloneObject(FeedbackSource const& feedback, int literal_flags); - const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, + const Operator* CreateLiteralRegExp(const StringRef& constant_pattern, FeedbackSource const& feedback, int literal_flags); const Operator* GetTemplateObject( - Handle<TemplateObjectDescription> description, - Handle<SharedFunctionInfo> shared, FeedbackSource const& feedback); + const TemplateObjectDescriptionRef& description, + const SharedFunctionInfoRef& shared, FeedbackSource const& feedback); const Operator* CallForwardVarargs(size_t arity, uint32_t start_index); const Operator* Call( @@ -978,16 +1015,17 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final FeedbackSource const& feedback = FeedbackSource()); const Operator* LoadProperty(FeedbackSource const& feedback); - const Operator* LoadNamed(Handle<Name> name, FeedbackSource const& feedback); - const Operator* LoadNamedFromSuper(Handle<Name> name, + const Operator* LoadNamed(const NameRef& name, + FeedbackSource const& feedback); + const Operator* LoadNamedFromSuper(const NameRef& name, FeedbackSource const& feedback); const Operator* StoreProperty(LanguageMode language_mode, FeedbackSource const& feedback); - const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, + const Operator* StoreNamed(LanguageMode language_mode, const NameRef& name, FeedbackSource const& feedback); - const Operator* StoreNamedOwn(Handle<Name> name, + const Operator* StoreNamedOwn(const NameRef& name, FeedbackSource const& feedback); const Operator* StoreDataPropertyInLiteral(const FeedbackSource& feedback); const Operator* StoreInArrayLiteral(const FeedbackSource& feedback); @@ -1000,11 +1038,10 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final const Operator* CreateGeneratorObject(); - const Operator* LoadGlobal(const Handle<Name>& name, + const Operator* LoadGlobal(const NameRef& name, const FeedbackSource& feedback, TypeofMode typeof_mode = TypeofMode::kNotInside); - const Operator* StoreGlobal(LanguageMode language_mode, - const Handle<Name>& name, + const Operator* StoreGlobal(LanguageMode language_mode, const NameRef& name, const FeedbackSource& feedback); const Operator* HasContextExtension(size_t depth); @@ -1051,11 +1088,11 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final const Operator* RejectPromise(); const Operator* ResolvePromise(); - const Operator* CreateFunctionContext(Handle<ScopeInfo> scope_info, + const Operator* CreateFunctionContext(const ScopeInfoRef& scope_info, int slot_count, ScopeType scope_type); - const Operator* CreateCatchContext(const Handle<ScopeInfo>& scope_info); - const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info); - const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info); + const Operator* CreateCatchContext(const ScopeInfoRef& scope_info); + const Operator* CreateWithContext(const ScopeInfoRef& scope_info); + const Operator* CreateBlockContext(const ScopeInfoRef& scpope_info); const Operator* ObjectIsArray(); const Operator* ParseInt(); |