LCOV - code coverage report
Current view: top level - src/compiler - js-operator.h (source / functions) Hit Total Coverage
Test: app.info Lines: 32 47 68.1 %
Date: 2019-04-19 Functions: 0 2 0.0 %

          Line data    Source code
       1             : // Copyright 2013 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_COMPILER_JS_OPERATOR_H_
       6             : #define V8_COMPILER_JS_OPERATOR_H_
       7             : 
       8             : #include "src/base/compiler-specific.h"
       9             : #include "src/globals.h"
      10             : #include "src/maybe-handles.h"
      11             : #include "src/runtime/runtime.h"
      12             : #include "src/type-hints.h"
      13             : #include "src/vector-slot-pair.h"
      14             : 
      15             : namespace v8 {
      16             : namespace internal {
      17             : 
      18             : class AllocationSite;
      19             : class ObjectBoilerplateDescription;
      20             : class ArrayBoilerplateDescription;
      21             : class FeedbackCell;
      22             : class SharedFunctionInfo;
      23             : 
      24             : namespace compiler {
      25             : 
      26             : // Forward declarations.
      27             : class Operator;
      28             : struct JSOperatorGlobalCache;
      29             : 
      30             : // Defines the frequency a given Call/Construct site was executed. For some
      31             : // call sites the frequency is not known.
      32             : class CallFrequency final {
      33             :  public:
      34      598093 :   CallFrequency() : value_(std::numeric_limits<float>::quiet_NaN()) {}
      35      646695 :   explicit CallFrequency(float value) : value_(value) {
      36             :     DCHECK(!std::isnan(value));
      37             :   }
      38             : 
      39             :   bool IsKnown() const { return !IsUnknown(); }
      40      989653 :   bool IsUnknown() const { return std::isnan(value_); }
      41             :   float value() const {
      42             :     DCHECK(IsKnown());
      43      164261 :     return value_;
      44             :   }
      45             : 
      46             :   bool operator==(CallFrequency const& that) const {
      47           0 :     return bit_cast<uint32_t>(this->value_) == bit_cast<uint32_t>(that.value_);
      48             :   }
      49             :   bool operator!=(CallFrequency const& that) const { return !(*this == that); }
      50             : 
      51             :   friend size_t hash_value(CallFrequency f) {
      52           0 :     return bit_cast<uint32_t>(f.value_);
      53             :   }
      54             : 
      55             :   static constexpr float kNoFeedbackCallFrequency = -1;
      56             : 
      57             :  private:
      58             :   float value_;
      59             : };
      60             : 
      61             : std::ostream& operator<<(std::ostream&, CallFrequency);
      62             : 
      63             : CallFrequency CallFrequencyOf(Operator const* op) V8_WARN_UNUSED_RESULT;
      64             : 
      65             : // Defines the flags for a JavaScript call forwarding parameters. This
      66             : // is used as parameter by JSConstructForwardVarargs operators.
      67             : class ConstructForwardVarargsParameters final {
      68             :  public:
      69             :   ConstructForwardVarargsParameters(size_t arity, uint32_t start_index)
      70         469 :       : bit_field_(ArityField::encode(arity) |
      71             :                    StartIndexField::encode(start_index)) {}
      72             : 
      73             :   size_t arity() const { return ArityField::decode(bit_field_); }
      74           0 :   uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
      75             : 
      76             :   bool operator==(ConstructForwardVarargsParameters const& that) const {
      77           0 :     return this->bit_field_ == that.bit_field_;
      78             :   }
      79             :   bool operator!=(ConstructForwardVarargsParameters const& that) const {
      80             :     return !(*this == that);
      81             :   }
      82             : 
      83             :  private:
      84             :   friend size_t hash_value(ConstructForwardVarargsParameters const& p) {
      85           0 :     return p.bit_field_;
      86             :   }
      87             : 
      88             :   using ArityField = BitField<size_t, 0, 16>;
      89             :   using StartIndexField = BitField<uint32_t, 16, 16>;
      90             : 
      91             :   uint32_t const bit_field_;
      92             : };
      93             : 
      94             : std::ostream& operator<<(std::ostream&,
      95             :                          ConstructForwardVarargsParameters const&);
      96             : 
      97             : ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf(
      98             :     Operator const*) V8_WARN_UNUSED_RESULT;
      99             : 
     100             : // Defines the arity and the feedback for a JavaScript constructor call. This is
     101             : // used as a parameter by JSConstruct and JSConstructWithSpread operators.
     102             : class ConstructParameters final {
     103             :  public:
     104             :   ConstructParameters(uint32_t arity, CallFrequency frequency,
     105             :                       VectorSlotPair const& feedback)
     106       44090 :       : arity_(arity), frequency_(frequency), feedback_(feedback) {}
     107             : 
     108             :   uint32_t arity() const { return arity_; }
     109             :   CallFrequency frequency() const { return frequency_; }
     110           0 :   VectorSlotPair const& feedback() const { return feedback_; }
     111             : 
     112             :  private:
     113             :   uint32_t const arity_;
     114             :   CallFrequency const frequency_;
     115             :   VectorSlotPair const feedback_;
     116             : };
     117             : 
     118             : bool operator==(ConstructParameters const&, ConstructParameters const&);
     119             : bool operator!=(ConstructParameters const&, ConstructParameters const&);
     120             : 
     121             : size_t hash_value(ConstructParameters const&);
     122             : 
     123             : std::ostream& operator<<(std::ostream&, ConstructParameters const&);
     124             : 
     125             : ConstructParameters const& ConstructParametersOf(Operator const*);
     126             : 
     127             : // Defines the flags for a JavaScript call forwarding parameters. This
     128             : // is used as parameter by JSCallForwardVarargs operators.
     129             : class CallForwardVarargsParameters final {
     130             :  public:
     131             :   CallForwardVarargsParameters(size_t arity, uint32_t start_index)
     132         374 :       : bit_field_(ArityField::encode(arity) |
     133             :                    StartIndexField::encode(start_index)) {}
     134             : 
     135             :   size_t arity() const { return ArityField::decode(bit_field_); }
     136           0 :   uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
     137             : 
     138             :   bool operator==(CallForwardVarargsParameters const& that) const {
     139           0 :     return this->bit_field_ == that.bit_field_;
     140             :   }
     141             :   bool operator!=(CallForwardVarargsParameters const& that) const {
     142             :     return !(*this == that);
     143             :   }
     144             : 
     145             :  private:
     146             :   friend size_t hash_value(CallForwardVarargsParameters const& p) {
     147           0 :     return p.bit_field_;
     148             :   }
     149             : 
     150             :   using ArityField = BitField<size_t, 0, 15>;
     151             :   using StartIndexField = BitField<uint32_t, 15, 15>;
     152             : 
     153             :   uint32_t const bit_field_;
     154             : };
     155             : 
     156             : std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&);
     157             : 
     158             : CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
     159             :     Operator const*) V8_WARN_UNUSED_RESULT;
     160             : 
     161             : // Defines the arity and the call flags for a JavaScript function call. This is
     162             : // used as a parameter by JSCall and JSCallWithSpread operators.
     163             : class CallParameters final {
     164             :  public:
     165             :   CallParameters(size_t arity, CallFrequency const& frequency,
     166             :                  VectorSlotPair const& feedback,
     167             :                  ConvertReceiverMode convert_mode,
     168             :                  SpeculationMode speculation_mode)
     169      791666 :       : bit_field_(ArityField::encode(arity) |
     170      791666 :                    SpeculationModeField::encode(speculation_mode) |
     171             :                    ConvertReceiverModeField::encode(convert_mode)),
     172             :         frequency_(frequency),
     173      791666 :         feedback_(feedback) {}
     174             : 
     175             :   size_t arity() const { return ArityField::decode(bit_field_); }
     176      138063 :   CallFrequency const& frequency() const { return frequency_; }
     177             :   ConvertReceiverMode convert_mode() const {
     178             :     return ConvertReceiverModeField::decode(bit_field_);
     179             :   }
     180      199748 :   VectorSlotPair const& feedback() const { return feedback_; }
     181             : 
     182             :   SpeculationMode speculation_mode() const {
     183             :     return SpeculationModeField::decode(bit_field_);
     184             :   }
     185             : 
     186           0 :   bool operator==(CallParameters const& that) const {
     187           0 :     return this->bit_field_ == that.bit_field_ &&
     188           0 :            this->frequency_ == that.frequency_ &&
     189           0 :            this->feedback_ == that.feedback_;
     190             :   }
     191             :   bool operator!=(CallParameters const& that) const { return !(*this == that); }
     192             : 
     193             :  private:
     194           0 :   friend size_t hash_value(CallParameters const& p) {
     195           0 :     return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_);
     196             :   }
     197             : 
     198             :   using ArityField = BitField<size_t, 0, 28>;
     199             :   using SpeculationModeField = BitField<SpeculationMode, 28, 1>;
     200             :   using ConvertReceiverModeField = BitField<ConvertReceiverMode, 29, 2>;
     201             : 
     202             :   uint32_t const bit_field_;
     203             :   CallFrequency const frequency_;
     204             :   VectorSlotPair const feedback_;
     205             : };
     206             : 
     207             : size_t hash_value(CallParameters const&);
     208             : 
     209             : std::ostream& operator<<(std::ostream&, CallParameters const&);
     210             : 
     211             : const CallParameters& CallParametersOf(const Operator* op);
     212             : 
     213             : 
     214             : // Defines the arity and the ID for a runtime function call. This is used as a
     215             : // parameter by JSCallRuntime operators.
     216             : class CallRuntimeParameters final {
     217             :  public:
     218             :   CallRuntimeParameters(Runtime::FunctionId id, size_t arity)
     219             :       : id_(id), arity_(arity) {}
     220             : 
     221             :   Runtime::FunctionId id() const { return id_; }
     222             :   size_t arity() const { return arity_; }
     223             : 
     224             :  private:
     225             :   const Runtime::FunctionId id_;
     226             :   const size_t arity_;
     227             : };
     228             : 
     229             : bool operator==(CallRuntimeParameters const&, CallRuntimeParameters const&);
     230             : bool operator!=(CallRuntimeParameters const&, CallRuntimeParameters const&);
     231             : 
     232             : size_t hash_value(CallRuntimeParameters const&);
     233             : 
     234             : std::ostream& operator<<(std::ostream&, CallRuntimeParameters const&);
     235             : 
     236             : const CallRuntimeParameters& CallRuntimeParametersOf(const Operator* op);
     237             : 
     238             : 
     239             : // Defines the location of a context slot relative to a specific scope. This is
     240             : // used as a parameter by JSLoadContext and JSStoreContext operators and allows
     241             : // accessing a context-allocated variable without keeping track of the scope.
     242             : class ContextAccess final {
     243             :  public:
     244             :   ContextAccess(size_t depth, size_t index, bool immutable);
     245             : 
     246     2493847 :   size_t depth() const { return depth_; }
     247     1739737 :   size_t index() const { return index_; }
     248             :   bool immutable() const { return immutable_; }
     249             : 
     250             :  private:
     251             :   // For space reasons, we keep this tightly packed, otherwise we could just use
     252             :   // a simple int/int/bool POD.
     253             :   const bool immutable_;
     254             :   const uint16_t depth_;
     255             :   const uint32_t index_;
     256             : };
     257             : 
     258             : bool operator==(ContextAccess const&, ContextAccess const&);
     259             : bool operator!=(ContextAccess const&, ContextAccess const&);
     260             : 
     261             : size_t hash_value(ContextAccess const&);
     262             : 
     263             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ContextAccess const&);
     264             : 
     265             : V8_EXPORT_PRIVATE ContextAccess const& ContextAccessOf(Operator const*);
     266             : 
     267             : // Defines the slot count and ScopeType for a new function or eval context. This
     268             : // is used as a parameter by the JSCreateFunctionContext operator.
     269             : class CreateFunctionContextParameters final {
     270             :  public:
     271             :   CreateFunctionContextParameters(Handle<ScopeInfo> scope_info, int slot_count,
     272             :                                   ScopeType scope_type);
     273             : 
     274             :   Handle<ScopeInfo> scope_info() const { return scope_info_; }
     275             :   int slot_count() const { return slot_count_; }
     276             :   ScopeType scope_type() const { return scope_type_; }
     277             : 
     278             :  private:
     279             :   Handle<ScopeInfo> scope_info_;
     280             :   int const slot_count_;
     281             :   ScopeType const scope_type_;
     282             : };
     283             : 
     284             : bool operator==(CreateFunctionContextParameters const& lhs,
     285             :                 CreateFunctionContextParameters const& rhs);
     286             : bool operator!=(CreateFunctionContextParameters const& lhs,
     287             :                 CreateFunctionContextParameters const& rhs);
     288             : 
     289             : size_t hash_value(CreateFunctionContextParameters const& parameters);
     290             : 
     291             : std::ostream& operator<<(std::ostream& os,
     292             :                          CreateFunctionContextParameters const& parameters);
     293             : 
     294             : CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
     295             :     Operator const*);
     296             : 
     297             : // Defines parameters for JSStoreNamedOwn operator.
     298             : class StoreNamedOwnParameters final {
     299             :  public:
     300             :   StoreNamedOwnParameters(Handle<Name> name, VectorSlotPair const& feedback)
     301       32464 :       : name_(name), feedback_(feedback) {}
     302             : 
     303             :   Handle<Name> name() const { return name_; }
     304       30697 :   VectorSlotPair const& feedback() const { return feedback_; }
     305             : 
     306             :  private:
     307             :   Handle<Name> const name_;
     308             :   VectorSlotPair const feedback_;
     309             : };
     310             : 
     311             : bool operator==(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
     312             : bool operator!=(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
     313             : 
     314             : size_t hash_value(StoreNamedOwnParameters const&);
     315             : 
     316             : std::ostream& operator<<(std::ostream&, StoreNamedOwnParameters const&);
     317             : 
     318             : const StoreNamedOwnParameters& StoreNamedOwnParametersOf(const Operator* op);
     319             : 
     320             : // Defines the feedback, i.e., vector and index, for storing a data property in
     321             : // an object literal. This is used as a parameter by JSCreateEmptyLiteralArray
     322             : // and JSStoreDataPropertyInLiteral operators.
     323             : class FeedbackParameter final {
     324             :  public:
     325             :   explicit FeedbackParameter(VectorSlotPair const& feedback)
     326       79091 :       : feedback_(feedback) {}
     327             : 
     328       71592 :   VectorSlotPair const& feedback() const { return feedback_; }
     329             : 
     330             :  private:
     331             :   VectorSlotPair const feedback_;
     332             : };
     333             : 
     334             : bool operator==(FeedbackParameter const&, FeedbackParameter const&);
     335             : bool operator!=(FeedbackParameter const&, FeedbackParameter const&);
     336             : 
     337             : size_t hash_value(FeedbackParameter const&);
     338             : 
     339             : std::ostream& operator<<(std::ostream&, FeedbackParameter const&);
     340             : 
     341             : const FeedbackParameter& FeedbackParameterOf(const Operator* op);
     342             : 
     343             : // Defines the property of an object for a named access. This is
     344             : // used as a parameter by the JSLoadNamed and JSStoreNamed operators.
     345             : class NamedAccess final {
     346             :  public:
     347             :   NamedAccess(LanguageMode language_mode, Handle<Name> name,
     348             :               VectorSlotPair const& feedback)
     349      635993 :       : name_(name), feedback_(feedback), language_mode_(language_mode) {}
     350             : 
     351             :   Handle<Name> name() const { return name_; }
     352             :   LanguageMode language_mode() const { return language_mode_; }
     353      321905 :   VectorSlotPair const& feedback() const { return feedback_; }
     354             : 
     355             :  private:
     356             :   Handle<Name> const name_;
     357             :   VectorSlotPair const feedback_;
     358             :   LanguageMode const language_mode_;
     359             : };
     360             : 
     361             : bool operator==(NamedAccess const&, NamedAccess const&);
     362             : bool operator!=(NamedAccess const&, NamedAccess const&);
     363             : 
     364             : size_t hash_value(NamedAccess const&);
     365             : 
     366             : std::ostream& operator<<(std::ostream&, NamedAccess const&);
     367             : 
     368             : const NamedAccess& NamedAccessOf(const Operator* op);
     369             : 
     370             : 
     371             : // Defines the property being loaded from an object by a named load. This is
     372             : // used as a parameter by JSLoadGlobal operator.
     373             : class LoadGlobalParameters final {
     374             :  public:
     375             :   LoadGlobalParameters(const Handle<Name>& name, const VectorSlotPair& feedback,
     376             :                        TypeofMode typeof_mode)
     377      730342 :       : name_(name), feedback_(feedback), typeof_mode_(typeof_mode) {}
     378             : 
     379             :   const Handle<Name>& name() const { return name_; }
     380             :   TypeofMode typeof_mode() const { return typeof_mode_; }
     381             : 
     382     1288930 :   const VectorSlotPair& feedback() const { return feedback_; }
     383             : 
     384             :  private:
     385             :   const Handle<Name> name_;
     386             :   const VectorSlotPair feedback_;
     387             :   const TypeofMode typeof_mode_;
     388             : };
     389             : 
     390             : bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&);
     391             : bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&);
     392             : 
     393             : size_t hash_value(LoadGlobalParameters const&);
     394             : 
     395             : std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);
     396             : 
     397             : const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op);
     398             : 
     399             : 
     400             : // Defines the property being stored to an object by a named store. This is
     401             : // used as a parameter by JSStoreGlobal operator.
     402             : class StoreGlobalParameters final {
     403             :  public:
     404             :   StoreGlobalParameters(LanguageMode language_mode,
     405             :                         const VectorSlotPair& feedback,
     406             :                         const Handle<Name>& name)
     407      220964 :       : language_mode_(language_mode), name_(name), feedback_(feedback) {}
     408             : 
     409             :   LanguageMode language_mode() const { return language_mode_; }
     410      429334 :   const VectorSlotPair& feedback() const { return feedback_; }
     411             :   const Handle<Name>& name() const { return name_; }
     412             : 
     413             :  private:
     414             :   const LanguageMode language_mode_;
     415             :   const Handle<Name> name_;
     416             :   const VectorSlotPair feedback_;
     417             : };
     418             : 
     419             : bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&);
     420             : bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&);
     421             : 
     422             : size_t hash_value(StoreGlobalParameters const&);
     423             : 
     424             : std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);
     425             : 
     426             : const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op);
     427             : 
     428             : 
     429             : // Defines the property of an object for a keyed access. This is used
     430             : // as a parameter by the JSLoadProperty and JSStoreProperty operators.
     431             : class PropertyAccess final {
     432             :  public:
     433             :   PropertyAccess(LanguageMode language_mode, VectorSlotPair const& feedback)
     434       57252 :       : feedback_(feedback), language_mode_(language_mode) {}
     435             : 
     436             :   LanguageMode language_mode() const { return language_mode_; }
     437       48067 :   VectorSlotPair const& feedback() const { return feedback_; }
     438             : 
     439             :  private:
     440             :   VectorSlotPair const feedback_;
     441             :   LanguageMode const language_mode_;
     442             : };
     443             : 
     444             : bool operator==(PropertyAccess const&, PropertyAccess const&);
     445             : bool operator!=(PropertyAccess const&, PropertyAccess const&);
     446             : 
     447             : size_t hash_value(PropertyAccess const&);
     448             : 
     449             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
     450             :                                            PropertyAccess const&);
     451             : 
     452             : PropertyAccess const& PropertyAccessOf(const Operator* op);
     453             : 
     454             : 
     455             : // CreateArgumentsType is used as parameter to JSCreateArguments nodes.
     456             : CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op);
     457             : 
     458             : 
     459             : // Defines shared information for the array that should be created. This is
     460             : // used as parameter by JSCreateArray operators.
     461             : class CreateArrayParameters final {
     462             :  public:
     463             :   explicit CreateArrayParameters(size_t arity, MaybeHandle<AllocationSite> site)
     464             :       : arity_(arity), site_(site) {}
     465             : 
     466             :   size_t arity() const { return arity_; }
     467             :   MaybeHandle<AllocationSite> site() const { return site_; }
     468             : 
     469             :  private:
     470             :   size_t const arity_;
     471             :   MaybeHandle<AllocationSite> const site_;
     472             : };
     473             : 
     474             : bool operator==(CreateArrayParameters const&, CreateArrayParameters const&);
     475             : bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&);
     476             : 
     477             : size_t hash_value(CreateArrayParameters const&);
     478             : 
     479             : std::ostream& operator<<(std::ostream&, CreateArrayParameters const&);
     480             : 
     481             : const CreateArrayParameters& CreateArrayParametersOf(const Operator* op);
     482             : 
     483             : // Defines shared information for the array iterator that should be created.
     484             : // This is used as parameter by JSCreateArrayIterator operators.
     485             : class CreateArrayIteratorParameters final {
     486             :  public:
     487             :   explicit CreateArrayIteratorParameters(IterationKind kind) : kind_(kind) {}
     488             : 
     489        1640 :   IterationKind kind() const { return kind_; }
     490             : 
     491             :  private:
     492             :   IterationKind const kind_;
     493             : };
     494             : 
     495             : bool operator==(CreateArrayIteratorParameters const&,
     496             :                 CreateArrayIteratorParameters const&);
     497             : bool operator!=(CreateArrayIteratorParameters const&,
     498             :                 CreateArrayIteratorParameters const&);
     499             : 
     500             : size_t hash_value(CreateArrayIteratorParameters const&);
     501             : 
     502             : std::ostream& operator<<(std::ostream&, CreateArrayIteratorParameters const&);
     503             : 
     504             : const CreateArrayIteratorParameters& CreateArrayIteratorParametersOf(
     505             :     const Operator* op);
     506             : 
     507             : // Defines shared information for the array iterator that should be created.
     508             : // This is used as parameter by JSCreateCollectionIterator operators.
     509             : class CreateCollectionIteratorParameters final {
     510             :  public:
     511             :   explicit CreateCollectionIteratorParameters(CollectionKind collection_kind,
     512             :                                               IterationKind iteration_kind)
     513             :       : collection_kind_(collection_kind), iteration_kind_(iteration_kind) {
     514         211 :     CHECK(!(collection_kind == CollectionKind::kSet &&
     515             :             iteration_kind == IterationKind::kKeys));
     516             :   }
     517             : 
     518             :   CollectionKind collection_kind() const { return collection_kind_; }
     519             :   IterationKind iteration_kind() const { return iteration_kind_; }
     520             : 
     521             :  private:
     522             :   CollectionKind const collection_kind_;
     523             :   IterationKind const iteration_kind_;
     524             : };
     525             : 
     526             : bool operator==(CreateCollectionIteratorParameters const&,
     527             :                 CreateCollectionIteratorParameters const&);
     528             : bool operator!=(CreateCollectionIteratorParameters const&,
     529             :                 CreateCollectionIteratorParameters const&);
     530             : 
     531             : size_t hash_value(CreateCollectionIteratorParameters const&);
     532             : 
     533             : std::ostream& operator<<(std::ostream&,
     534             :                          CreateCollectionIteratorParameters const&);
     535             : 
     536             : const CreateCollectionIteratorParameters& CreateCollectionIteratorParametersOf(
     537             :     const Operator* op);
     538             : 
     539             : // Defines shared information for the bound function that should be created.
     540             : // This is used as parameter by JSCreateBoundFunction operators.
     541             : class CreateBoundFunctionParameters final {
     542             :  public:
     543             :   CreateBoundFunctionParameters(size_t arity, Handle<Map> map)
     544             :       : arity_(arity), map_(map) {}
     545             : 
     546             :   size_t arity() const { return arity_; }
     547             :   Handle<Map> map() const { return map_; }
     548             : 
     549             :  private:
     550             :   size_t const arity_;
     551             :   Handle<Map> const map_;
     552             : };
     553             : 
     554             : bool operator==(CreateBoundFunctionParameters const&,
     555             :                 CreateBoundFunctionParameters const&);
     556             : bool operator!=(CreateBoundFunctionParameters const&,
     557             :                 CreateBoundFunctionParameters const&);
     558             : 
     559             : size_t hash_value(CreateBoundFunctionParameters const&);
     560             : 
     561             : std::ostream& operator<<(std::ostream&, CreateBoundFunctionParameters const&);
     562             : 
     563             : const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf(
     564             :     const Operator* op);
     565             : 
     566             : // Defines shared information for the closure that should be created. This is
     567             : // used as a parameter by JSCreateClosure operators.
     568             : class CreateClosureParameters final {
     569             :  public:
     570             :   CreateClosureParameters(Handle<SharedFunctionInfo> shared_info,
     571             :                           Handle<FeedbackCell> feedback_cell, Handle<Code> code,
     572             :                           AllocationType allocation)
     573             :       : shared_info_(shared_info),
     574             :         feedback_cell_(feedback_cell),
     575             :         code_(code),
     576             :         allocation_(allocation) {}
     577             : 
     578             :   Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
     579             :   Handle<FeedbackCell> feedback_cell() const { return feedback_cell_; }
     580             :   Handle<Code> code() const { return code_; }
     581             :   AllocationType allocation() const { return allocation_; }
     582             : 
     583             :  private:
     584             :   Handle<SharedFunctionInfo> const shared_info_;
     585             :   Handle<FeedbackCell> const feedback_cell_;
     586             :   Handle<Code> const code_;
     587             :   AllocationType const allocation_;
     588             : };
     589             : 
     590             : bool operator==(CreateClosureParameters const&, CreateClosureParameters const&);
     591             : bool operator!=(CreateClosureParameters const&, CreateClosureParameters const&);
     592             : 
     593             : size_t hash_value(CreateClosureParameters const&);
     594             : 
     595             : std::ostream& operator<<(std::ostream&, CreateClosureParameters const&);
     596             : 
     597             : const CreateClosureParameters& CreateClosureParametersOf(const Operator* op);
     598             : 
     599             : // Defines shared information for the literal that should be created. This is
     600             : // used as parameter by JSCreateLiteralArray, JSCreateLiteralObject and
     601             : // JSCreateLiteralRegExp operators.
     602             : class CreateLiteralParameters final {
     603             :  public:
     604             :   CreateLiteralParameters(Handle<HeapObject> constant,
     605             :                           VectorSlotPair const& feedback, int length, int flags)
     606             :       : constant_(constant),
     607             :         feedback_(feedback),
     608             :         length_(length),
     609       30752 :         flags_(flags) {}
     610             : 
     611             :   Handle<HeapObject> constant() const { return constant_; }
     612       24538 :   VectorSlotPair const& feedback() const { return feedback_; }
     613             :   int length() const { return length_; }
     614             :   int flags() const { return flags_; }
     615             : 
     616             :  private:
     617             :   Handle<HeapObject> const constant_;
     618             :   VectorSlotPair const feedback_;
     619             :   int const length_;
     620             :   int const flags_;
     621             : };
     622             : 
     623             : bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&);
     624             : bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&);
     625             : 
     626             : size_t hash_value(CreateLiteralParameters const&);
     627             : 
     628             : std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&);
     629             : 
     630             : const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op);
     631             : 
     632             : class CloneObjectParameters final {
     633             :  public:
     634             :   CloneObjectParameters(VectorSlotPair const& feedback, int flags)
     635          78 :       : feedback_(feedback), flags_(flags) {}
     636             : 
     637          94 :   VectorSlotPair const& feedback() const { return feedback_; }
     638             :   int flags() const { return flags_; }
     639             : 
     640             :  private:
     641             :   VectorSlotPair const feedback_;
     642             :   int const flags_;
     643             : };
     644             : 
     645             : bool operator==(CloneObjectParameters const&, CloneObjectParameters const&);
     646             : bool operator!=(CloneObjectParameters const&, CloneObjectParameters const&);
     647             : 
     648             : size_t hash_value(CloneObjectParameters const&);
     649             : 
     650             : std::ostream& operator<<(std::ostream&, CloneObjectParameters const&);
     651             : 
     652             : const CloneObjectParameters& CloneObjectParametersOf(const Operator* op);
     653             : 
     654             : // Descriptor used by the JSForInPrepare and JSForInNext opcodes.
     655             : enum class ForInMode : uint8_t {
     656             :   kUseEnumCacheKeysAndIndices,
     657             :   kUseEnumCacheKeys,
     658             :   kGeneric
     659             : };
     660             : 
     661             : size_t hash_value(ForInMode);
     662             : 
     663             : std::ostream& operator<<(std::ostream&, ForInMode);
     664             : 
     665             : ForInMode ForInModeOf(Operator const* op) V8_WARN_UNUSED_RESULT;
     666             : 
     667             : BinaryOperationHint BinaryOperationHintOf(const Operator* op);
     668             : 
     669             : CompareOperationHint CompareOperationHintOf(const Operator* op);
     670             : 
     671             : int RegisterCountOf(Operator const* op) V8_WARN_UNUSED_RESULT;
     672             : 
     673             : int GeneratorStoreValueCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     674             : int RestoreRegisterIndexOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     675             : 
     676             : Handle<ScopeInfo> ScopeInfoOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     677             : 
     678             : // Interface for building JavaScript-level operators, e.g. directly from the
     679             : // AST. Most operators have no parameters, thus can be globally shared for all
     680             : // graphs.
     681             : class V8_EXPORT_PRIVATE JSOperatorBuilder final
     682             :     : public NON_EXPORTED_BASE(ZoneObject) {
     683             :  public:
     684             :   explicit JSOperatorBuilder(Zone* zone);
     685             : 
     686             :   const Operator* Equal(CompareOperationHint hint);
     687             :   const Operator* StrictEqual(CompareOperationHint hint);
     688             :   const Operator* LessThan(CompareOperationHint hint);
     689             :   const Operator* GreaterThan(CompareOperationHint hint);
     690             :   const Operator* LessThanOrEqual(CompareOperationHint hint);
     691             :   const Operator* GreaterThanOrEqual(CompareOperationHint hint);
     692             : 
     693             :   const Operator* BitwiseOr();
     694             :   const Operator* BitwiseXor();
     695             :   const Operator* BitwiseAnd();
     696             :   const Operator* ShiftLeft();
     697             :   const Operator* ShiftRight();
     698             :   const Operator* ShiftRightLogical();
     699             :   const Operator* Add(BinaryOperationHint hint);
     700             :   const Operator* Subtract();
     701             :   const Operator* Multiply();
     702             :   const Operator* Divide();
     703             :   const Operator* Modulus();
     704             :   const Operator* Exponentiate();
     705             : 
     706             :   const Operator* BitwiseNot();
     707             :   const Operator* Decrement();
     708             :   const Operator* Increment();
     709             :   const Operator* Negate();
     710             : 
     711             :   const Operator* ToLength();
     712             :   const Operator* ToName();
     713             :   const Operator* ToNumber();
     714             :   const Operator* ToNumberConvertBigInt();
     715             :   const Operator* ToNumeric();
     716             :   const Operator* ToObject();
     717             :   const Operator* ToString();
     718             : 
     719             :   const Operator* Create();
     720             :   const Operator* CreateArguments(CreateArgumentsType type);
     721             :   const Operator* CreateArray(size_t arity, MaybeHandle<AllocationSite> site);
     722             :   const Operator* CreateArrayIterator(IterationKind);
     723             :   const Operator* CreateAsyncFunctionObject(int register_count);
     724             :   const Operator* CreateCollectionIterator(CollectionKind, IterationKind);
     725             :   const Operator* CreateBoundFunction(size_t arity, Handle<Map> map);
     726             :   const Operator* CreateClosure(
     727             :       Handle<SharedFunctionInfo> shared_info,
     728             :       Handle<FeedbackCell> feedback_cell, Handle<Code> code,
     729             :       AllocationType allocation = AllocationType::kYoung);
     730             :   const Operator* CreateIterResultObject();
     731             :   const Operator* CreateStringIterator();
     732             :   const Operator* CreateKeyValueArray();
     733             :   const Operator* CreateObject();
     734             :   const Operator* CreatePromise();
     735             :   const Operator* CreateTypedArray();
     736             :   const Operator* CreateLiteralArray(
     737             :       Handle<ArrayBoilerplateDescription> constant,
     738             :       VectorSlotPair const& feedback, int literal_flags,
     739             :       int number_of_elements);
     740             :   const Operator* CreateEmptyLiteralArray(VectorSlotPair const& feedback);
     741             :   const Operator* CreateArrayFromIterable();
     742             :   const Operator* CreateEmptyLiteralObject();
     743             : 
     744             :   const Operator* CreateLiteralObject(
     745             :       Handle<ObjectBoilerplateDescription> constant,
     746             :       VectorSlotPair const& feedback, int literal_flags,
     747             :       int number_of_properties);
     748             :   const Operator* CloneObject(VectorSlotPair const& feedback,
     749             :                               int literal_flags);
     750             :   const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
     751             :                                       VectorSlotPair const& feedback,
     752             :                                       int literal_flags);
     753             : 
     754             :   const Operator* CallForwardVarargs(size_t arity, uint32_t start_index);
     755             :   const Operator* Call(
     756             :       size_t arity, CallFrequency const& frequency = CallFrequency(),
     757             :       VectorSlotPair const& feedback = VectorSlotPair(),
     758             :       ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
     759             :       SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation);
     760             :   const Operator* CallWithArrayLike(CallFrequency frequency);
     761             :   const Operator* CallWithSpread(
     762             :       uint32_t arity, CallFrequency const& frequency = CallFrequency(),
     763             :       VectorSlotPair const& feedback = VectorSlotPair(),
     764             :       SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation);
     765             :   const Operator* CallRuntime(Runtime::FunctionId id);
     766             :   const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
     767             :   const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
     768             : 
     769             :   const Operator* ConstructForwardVarargs(size_t arity, uint32_t start_index);
     770             :   const Operator* Construct(uint32_t arity,
     771             :                             CallFrequency frequency = CallFrequency(),
     772             :                             VectorSlotPair const& feedback = VectorSlotPair());
     773             :   const Operator* ConstructWithArrayLike(CallFrequency frequency);
     774             :   const Operator* ConstructWithSpread(
     775             :       uint32_t arity, CallFrequency frequency = CallFrequency(),
     776             :       VectorSlotPair const& feedback = VectorSlotPair());
     777             : 
     778             :   const Operator* LoadProperty(VectorSlotPair const& feedback);
     779             :   const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback);
     780             : 
     781             :   const Operator* StoreProperty(LanguageMode language_mode,
     782             :                                 VectorSlotPair const& feedback);
     783             :   const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name,
     784             :                              VectorSlotPair const& feedback);
     785             : 
     786             :   const Operator* StoreNamedOwn(Handle<Name> name,
     787             :                                 VectorSlotPair const& feedback);
     788             :   const Operator* StoreDataPropertyInLiteral(const VectorSlotPair& feedback);
     789             :   const Operator* StoreInArrayLiteral(const VectorSlotPair& feedback);
     790             : 
     791             :   const Operator* DeleteProperty();
     792             : 
     793             :   const Operator* HasProperty(VectorSlotPair const& feedback);
     794             : 
     795             :   const Operator* GetSuperConstructor();
     796             : 
     797             :   const Operator* CreateGeneratorObject();
     798             : 
     799             :   const Operator* LoadGlobal(const Handle<Name>& name,
     800             :                              const VectorSlotPair& feedback,
     801             :                              TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
     802             :   const Operator* StoreGlobal(LanguageMode language_mode,
     803             :                               const Handle<Name>& name,
     804             :                               const VectorSlotPair& feedback);
     805             : 
     806             :   const Operator* LoadContext(size_t depth, size_t index, bool immutable);
     807             :   const Operator* StoreContext(size_t depth, size_t index);
     808             : 
     809             :   const Operator* LoadModule(int32_t cell_index);
     810             :   const Operator* StoreModule(int32_t cell_index);
     811             : 
     812             :   const Operator* HasInPrototypeChain();
     813             :   const Operator* InstanceOf(const VectorSlotPair& feedback);
     814             :   const Operator* OrdinaryHasInstance();
     815             : 
     816             :   const Operator* AsyncFunctionEnter();
     817             :   const Operator* AsyncFunctionReject();
     818             :   const Operator* AsyncFunctionResolve();
     819             : 
     820             :   const Operator* ForInEnumerate();
     821             :   const Operator* ForInNext(ForInMode);
     822             :   const Operator* ForInPrepare(ForInMode);
     823             : 
     824             :   const Operator* LoadMessage();
     825             :   const Operator* StoreMessage();
     826             : 
     827             :   // Used to implement Ignition's SuspendGenerator bytecode.
     828             :   const Operator* GeneratorStore(int value_count);
     829             : 
     830             :   // Used to implement Ignition's SwitchOnGeneratorState bytecode.
     831             :   const Operator* GeneratorRestoreContinuation();
     832             :   const Operator* GeneratorRestoreContext();
     833             : 
     834             :   // Used to implement Ignition's ResumeGenerator bytecode.
     835             :   const Operator* GeneratorRestoreRegister(int index);
     836             :   const Operator* GeneratorRestoreInputOrDebugPos();
     837             : 
     838             :   const Operator* StackCheck();
     839             :   const Operator* Debugger();
     840             : 
     841             :   const Operator* FulfillPromise();
     842             :   const Operator* PerformPromiseThen();
     843             :   const Operator* PromiseResolve();
     844             :   const Operator* RejectPromise();
     845             :   const Operator* ResolvePromise();
     846             : 
     847             :   const Operator* CreateFunctionContext(Handle<ScopeInfo> scope_info,
     848             :                                         int slot_count, ScopeType scope_type);
     849             :   const Operator* CreateCatchContext(const Handle<ScopeInfo>& scope_info);
     850             :   const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info);
     851             :   const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info);
     852             : 
     853             :   const Operator* ObjectIsArray();
     854             :   const Operator* ParseInt();
     855             :   const Operator* RegExpTest();
     856             : 
     857             :  private:
     858             :   Zone* zone() const { return zone_; }
     859             : 
     860             :   const JSOperatorGlobalCache& cache_;
     861             :   Zone* const zone_;
     862             : 
     863             :   DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
     864             : };
     865             : 
     866             : }  // namespace compiler
     867             : }  // namespace internal
     868             : }  // namespace v8
     869             : 
     870             : #endif  // V8_COMPILER_JS_OPERATOR_H_

Generated by: LCOV version 1.10