LCOV - code coverage report
Current view: top level - src/compiler - js-operator.h (source / functions) Hit Total Coverage
Test: app.info Lines: 16 24 66.7 %
Date: 2017-04-26 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/handles.h"
      11             : #include "src/runtime/runtime.h"
      12             : #include "src/type-hints.h"
      13             : 
      14             : namespace v8 {
      15             : namespace internal {
      16             : 
      17             : class AllocationSite;
      18             : class BoilerplateDescription;
      19             : class ConstantElementsPair;
      20             : class SharedFunctionInfo;
      21             : class FeedbackVector;
      22             : 
      23             : namespace compiler {
      24             : 
      25             : // Forward declarations.
      26             : class Operator;
      27             : struct JSOperatorGlobalCache;
      28             : 
      29             : // Defines a pair of {FeedbackVector} and {FeedbackSlot}, which
      30             : // is used to access the type feedback for a certain {Node}.
      31             : class V8_EXPORT_PRIVATE VectorSlotPair {
      32             :  public:
      33             :   VectorSlotPair();
      34             :   VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot)
      35             :       : vector_(vector), slot_(slot) {}
      36             : 
      37     2249165 :   bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); }
      38             : 
      39             :   Handle<FeedbackVector> vector() const { return vector_; }
      40             :   FeedbackSlot slot() const { return slot_; }
      41             : 
      42             :   int index() const;
      43             : 
      44             :  private:
      45             :   const Handle<FeedbackVector> vector_;
      46             :   const FeedbackSlot slot_;
      47             : };
      48             : 
      49             : bool operator==(VectorSlotPair const&, VectorSlotPair const&);
      50             : bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
      51             : 
      52             : size_t hash_value(VectorSlotPair const&);
      53             : 
      54             : 
      55             : // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators.
      56             : ConvertReceiverMode ConvertReceiverModeOf(Operator const* op);
      57             : 
      58             : 
      59             : // The ToBooleanHints are used as parameter by JSToBoolean operators.
      60             : ToBooleanHints ToBooleanHintsOf(Operator const* op);
      61             : 
      62             : 
      63             : // Defines the arity and the feedback for a JavaScript constructor call. This is
      64             : // used as a parameter by JSConstruct operators.
      65             : class ConstructParameters final {
      66             :  public:
      67             :   ConstructParameters(uint32_t arity, float frequency,
      68             :                       VectorSlotPair const& feedback)
      69       34118 :       : arity_(arity), frequency_(frequency), feedback_(feedback) {}
      70             : 
      71             :   uint32_t arity() const { return arity_; }
      72             :   float frequency() const { return frequency_; }
      73             :   VectorSlotPair const& feedback() const { return feedback_; }
      74             : 
      75             :  private:
      76             :   uint32_t const arity_;
      77             :   float const frequency_;
      78             :   VectorSlotPair const feedback_;
      79             : };
      80             : 
      81             : bool operator==(ConstructParameters const&, ConstructParameters const&);
      82             : bool operator!=(ConstructParameters const&, ConstructParameters const&);
      83             : 
      84             : size_t hash_value(ConstructParameters const&);
      85             : 
      86             : std::ostream& operator<<(std::ostream&, ConstructParameters const&);
      87             : 
      88             : ConstructParameters const& ConstructParametersOf(Operator const*);
      89             : 
      90             : // Defines the arity for JavaScript calls with a spread as the last
      91             : // parameter. This is used as a parameter by JSConstructWithSpread and
      92             : // JSCallWithSpread operators.
      93             : class SpreadWithArityParameter final {
      94             :  public:
      95             :   explicit SpreadWithArityParameter(uint32_t arity) : arity_(arity) {}
      96             : 
      97         965 :   uint32_t arity() const { return arity_; }
      98             : 
      99             :  private:
     100             :   uint32_t const arity_;
     101             : };
     102             : 
     103             : bool operator==(SpreadWithArityParameter const&,
     104             :                 SpreadWithArityParameter const&);
     105             : bool operator!=(SpreadWithArityParameter const&,
     106             :                 SpreadWithArityParameter const&);
     107             : 
     108             : size_t hash_value(SpreadWithArityParameter const&);
     109             : 
     110             : std::ostream& operator<<(std::ostream&, SpreadWithArityParameter const&);
     111             : 
     112             : SpreadWithArityParameter const& SpreadWithArityParameterOf(Operator const*);
     113             : 
     114             : // Defines the flags for a JavaScript call forwarding parameters. This
     115             : // is used as parameter by JSCallForwardVarargs operators.
     116             : class CallForwardVarargsParameters final {
     117             :  public:
     118             :   CallForwardVarargsParameters(uint32_t start_index,
     119             :                                TailCallMode tail_call_mode)
     120         215 :       : bit_field_(StartIndexField::encode(start_index) |
     121             :                    TailCallModeField::encode(tail_call_mode)) {}
     122             : 
     123             :   uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
     124             :   TailCallMode tail_call_mode() const {
     125           0 :     return TailCallModeField::decode(bit_field_);
     126             :   }
     127             : 
     128             :   bool operator==(CallForwardVarargsParameters const& that) const {
     129           0 :     return this->bit_field_ == that.bit_field_;
     130             :   }
     131             :   bool operator!=(CallForwardVarargsParameters const& that) const {
     132             :     return !(*this == that);
     133             :   }
     134             : 
     135             :  private:
     136           0 :   friend size_t hash_value(CallForwardVarargsParameters const& p) {
     137           0 :     return p.bit_field_;
     138             :   }
     139             : 
     140             :   typedef BitField<uint32_t, 0, 30> StartIndexField;
     141             :   typedef BitField<TailCallMode, 31, 1> TailCallModeField;
     142             : 
     143             :   uint32_t const bit_field_;
     144             : };
     145             : 
     146             : std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&);
     147             : 
     148             : CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
     149             :     Operator const*) WARN_UNUSED_RESULT;
     150             : 
     151             : // Defines the arity and the call flags for a JavaScript function call. This is
     152             : // used as a parameter by JSCall operators.
     153             : class CallParameters final {
     154             :  public:
     155             :   CallParameters(size_t arity, float frequency, VectorSlotPair const& feedback,
     156             :                  TailCallMode tail_call_mode, ConvertReceiverMode convert_mode)
     157      640791 :       : bit_field_(ArityField::encode(arity) |
     158      640791 :                    ConvertReceiverModeField::encode(convert_mode) |
     159             :                    TailCallModeField::encode(tail_call_mode)),
     160             :         frequency_(frequency),
     161      640791 :         feedback_(feedback) {}
     162             : 
     163             :   size_t arity() const { return ArityField::decode(bit_field_); }
     164             :   float frequency() const { return frequency_; }
     165             :   ConvertReceiverMode convert_mode() const {
     166             :     return ConvertReceiverModeField::decode(bit_field_);
     167             :   }
     168             :   TailCallMode tail_call_mode() const {
     169             :     return TailCallModeField::decode(bit_field_);
     170             :   }
     171             :   VectorSlotPair const& feedback() const { return feedback_; }
     172             : 
     173             :   bool operator==(CallParameters const& that) const {
     174           0 :     return this->bit_field_ == that.bit_field_ &&
     175           0 :            this->frequency_ == that.frequency_ &&
     176             :            this->feedback_ == that.feedback_;
     177             :   }
     178             :   bool operator!=(CallParameters const& that) const { return !(*this == that); }
     179             : 
     180             :  private:
     181           0 :   friend size_t hash_value(CallParameters const& p) {
     182           0 :     return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_);
     183             :   }
     184             : 
     185             :   typedef BitField<size_t, 0, 29> ArityField;
     186             :   typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField;
     187             :   typedef BitField<TailCallMode, 31, 1> TailCallModeField;
     188             : 
     189             :   uint32_t const bit_field_;
     190             :   float const frequency_;
     191             :   VectorSlotPair const feedback_;
     192             : };
     193             : 
     194             : size_t hash_value(CallParameters const&);
     195             : 
     196             : std::ostream& operator<<(std::ostream&, CallParameters const&);
     197             : 
     198             : const CallParameters& CallParametersOf(const Operator* op);
     199             : 
     200             : 
     201             : // Defines the arity and the ID for a runtime function call. This is used as a
     202             : // parameter by JSCallRuntime operators.
     203             : class CallRuntimeParameters final {
     204             :  public:
     205             :   CallRuntimeParameters(Runtime::FunctionId id, size_t arity)
     206             :       : id_(id), arity_(arity) {}
     207             : 
     208             :   Runtime::FunctionId id() const { return id_; }
     209             :   size_t arity() const { return arity_; }
     210             : 
     211             :  private:
     212             :   const Runtime::FunctionId id_;
     213             :   const size_t arity_;
     214             : };
     215             : 
     216             : bool operator==(CallRuntimeParameters const&, CallRuntimeParameters const&);
     217             : bool operator!=(CallRuntimeParameters const&, CallRuntimeParameters const&);
     218             : 
     219             : size_t hash_value(CallRuntimeParameters const&);
     220             : 
     221             : std::ostream& operator<<(std::ostream&, CallRuntimeParameters const&);
     222             : 
     223             : const CallRuntimeParameters& CallRuntimeParametersOf(const Operator* op);
     224             : 
     225             : 
     226             : // Defines the location of a context slot relative to a specific scope. This is
     227             : // used as a parameter by JSLoadContext and JSStoreContext operators and allows
     228             : // accessing a context-allocated variable without keeping track of the scope.
     229             : class ContextAccess final {
     230             :  public:
     231             :   ContextAccess(size_t depth, size_t index, bool immutable);
     232             : 
     233     2175994 :   size_t depth() const { return depth_; }
     234     1597517 :   size_t index() const { return index_; }
     235             :   bool immutable() const { return immutable_; }
     236             : 
     237             :  private:
     238             :   // For space reasons, we keep this tightly packed, otherwise we could just use
     239             :   // a simple int/int/bool POD.
     240             :   const bool immutable_;
     241             :   const uint16_t depth_;
     242             :   const uint32_t index_;
     243             : };
     244             : 
     245             : bool operator==(ContextAccess const&, ContextAccess const&);
     246             : bool operator!=(ContextAccess const&, ContextAccess const&);
     247             : 
     248             : size_t hash_value(ContextAccess const&);
     249             : 
     250             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ContextAccess const&);
     251             : 
     252             : ContextAccess const& ContextAccessOf(Operator const*);
     253             : 
     254             : // Defines the name and ScopeInfo for a new catch context. This is used as a
     255             : // parameter by the JSCreateCatchContext operator.
     256             : class CreateCatchContextParameters final {
     257             :  public:
     258             :   CreateCatchContextParameters(Handle<String> catch_name,
     259             :                                Handle<ScopeInfo> scope_info);
     260             : 
     261             :   Handle<String> catch_name() const { return catch_name_; }
     262             :   Handle<ScopeInfo> scope_info() const { return scope_info_; }
     263             : 
     264             :  private:
     265             :   Handle<String> const catch_name_;
     266             :   Handle<ScopeInfo> const scope_info_;
     267             : };
     268             : 
     269             : bool operator==(CreateCatchContextParameters const& lhs,
     270             :                 CreateCatchContextParameters const& rhs);
     271             : bool operator!=(CreateCatchContextParameters const& lhs,
     272             :                 CreateCatchContextParameters const& rhs);
     273             : 
     274             : size_t hash_value(CreateCatchContextParameters const& parameters);
     275             : 
     276             : std::ostream& operator<<(std::ostream& os,
     277             :                          CreateCatchContextParameters const& parameters);
     278             : 
     279             : CreateCatchContextParameters const& CreateCatchContextParametersOf(
     280             :     Operator const*);
     281             : 
     282             : // Defines the slot count and ScopeType for a new function or eval context. This
     283             : // is used as a parameter by the JSCreateFunctionContext operator.
     284             : class CreateFunctionContextParameters final {
     285             :  public:
     286             :   CreateFunctionContextParameters(int slot_count, ScopeType scope_type);
     287             : 
     288             :   int slot_count() const { return slot_count_; }
     289             :   ScopeType scope_type() const { return scope_type_; }
     290             : 
     291             :  private:
     292             :   int const slot_count_;
     293             :   ScopeType const scope_type_;
     294             : };
     295             : 
     296             : bool operator==(CreateFunctionContextParameters const& lhs,
     297             :                 CreateFunctionContextParameters const& rhs);
     298             : bool operator!=(CreateFunctionContextParameters const& lhs,
     299             :                 CreateFunctionContextParameters const& rhs);
     300             : 
     301             : size_t hash_value(CreateFunctionContextParameters const& parameters);
     302             : 
     303             : std::ostream& operator<<(std::ostream& os,
     304             :                          CreateFunctionContextParameters const& parameters);
     305             : 
     306             : CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
     307             :     Operator const*);
     308             : 
     309             : // Defines parameters for JSStoreNamedOwn operator.
     310             : class StoreNamedOwnParameters final {
     311             :  public:
     312             :   StoreNamedOwnParameters(Handle<Name> name, VectorSlotPair const& feedback)
     313       34419 :       : name_(name), feedback_(feedback) {}
     314             : 
     315             :   Handle<Name> name() const { return name_; }
     316             :   VectorSlotPair const& feedback() const { return feedback_; }
     317             : 
     318             :  private:
     319             :   Handle<Name> const name_;
     320             :   VectorSlotPair const feedback_;
     321             : };
     322             : 
     323             : bool operator==(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
     324             : bool operator!=(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
     325             : 
     326             : size_t hash_value(StoreNamedOwnParameters const&);
     327             : 
     328             : std::ostream& operator<<(std::ostream&, StoreNamedOwnParameters const&);
     329             : 
     330             : const StoreNamedOwnParameters& StoreNamedOwnParametersOf(const Operator* op);
     331             : 
     332             : // Defines the feedback, i.e., vector and index, for storing a data property in
     333             : // an object literal. This is
     334             : // used as a parameter by the JSStoreDataPropertyInLiteral operator.
     335             : class FeedbackParameter final {
     336             :  public:
     337             :   explicit FeedbackParameter(VectorSlotPair const& feedback)
     338       44214 :       : feedback_(feedback) {}
     339             : 
     340             :   VectorSlotPair const& feedback() const { return feedback_; }
     341             : 
     342             :  private:
     343             :   VectorSlotPair const feedback_;
     344             : };
     345             : 
     346             : bool operator==(FeedbackParameter const&, FeedbackParameter const&);
     347             : bool operator!=(FeedbackParameter const&, FeedbackParameter const&);
     348             : 
     349             : size_t hash_value(FeedbackParameter const&);
     350             : 
     351             : std::ostream& operator<<(std::ostream&, FeedbackParameter const&);
     352             : 
     353             : const FeedbackParameter& FeedbackParameterOf(const Operator* op);
     354             : 
     355             : // Defines the property of an object for a named access. This is
     356             : // used as a parameter by the JSLoadNamed and JSStoreNamed operators.
     357             : class NamedAccess final {
     358             :  public:
     359             :   NamedAccess(LanguageMode language_mode, Handle<Name> name,
     360             :               VectorSlotPair const& feedback)
     361      525262 :       : name_(name), feedback_(feedback), language_mode_(language_mode) {}
     362             : 
     363             :   Handle<Name> name() const { return name_; }
     364             :   LanguageMode language_mode() const { return language_mode_; }
     365             :   VectorSlotPair const& feedback() const { return feedback_; }
     366             : 
     367             :  private:
     368             :   Handle<Name> const name_;
     369             :   VectorSlotPair const feedback_;
     370             :   LanguageMode const language_mode_;
     371             : };
     372             : 
     373             : bool operator==(NamedAccess const&, NamedAccess const&);
     374             : bool operator!=(NamedAccess const&, NamedAccess const&);
     375             : 
     376             : size_t hash_value(NamedAccess const&);
     377             : 
     378             : std::ostream& operator<<(std::ostream&, NamedAccess const&);
     379             : 
     380             : const NamedAccess& NamedAccessOf(const Operator* op);
     381             : 
     382             : 
     383             : // Defines the property being loaded from an object by a named load. This is
     384             : // used as a parameter by JSLoadGlobal operator.
     385             : class LoadGlobalParameters final {
     386             :  public:
     387             :   LoadGlobalParameters(const Handle<Name>& name, const VectorSlotPair& feedback,
     388             :                        TypeofMode typeof_mode)
     389      528324 :       : name_(name), feedback_(feedback), typeof_mode_(typeof_mode) {}
     390             : 
     391             :   const Handle<Name>& name() const { return name_; }
     392             :   TypeofMode typeof_mode() const { return typeof_mode_; }
     393             : 
     394             :   const VectorSlotPair& feedback() const { return feedback_; }
     395             : 
     396             :  private:
     397             :   const Handle<Name> name_;
     398             :   const VectorSlotPair feedback_;
     399             :   const TypeofMode typeof_mode_;
     400             : };
     401             : 
     402             : bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&);
     403             : bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&);
     404             : 
     405             : size_t hash_value(LoadGlobalParameters const&);
     406             : 
     407             : std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);
     408             : 
     409             : const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op);
     410             : 
     411             : 
     412             : // Defines the property being stored to an object by a named store. This is
     413             : // used as a parameter by JSStoreGlobal operator.
     414             : class StoreGlobalParameters final {
     415             :  public:
     416             :   StoreGlobalParameters(LanguageMode language_mode,
     417             :                         const VectorSlotPair& feedback,
     418             :                         const Handle<Name>& name)
     419       36946 :       : language_mode_(language_mode), name_(name), feedback_(feedback) {}
     420             : 
     421             :   LanguageMode language_mode() const { return language_mode_; }
     422             :   const VectorSlotPair& feedback() const { return feedback_; }
     423             :   const Handle<Name>& name() const { return name_; }
     424             : 
     425             :  private:
     426             :   const LanguageMode language_mode_;
     427             :   const Handle<Name> name_;
     428             :   const VectorSlotPair feedback_;
     429             : };
     430             : 
     431             : bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&);
     432             : bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&);
     433             : 
     434             : size_t hash_value(StoreGlobalParameters const&);
     435             : 
     436             : std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);
     437             : 
     438             : const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op);
     439             : 
     440             : 
     441             : // Defines the property of an object for a keyed access. This is used
     442             : // as a parameter by the JSLoadProperty and JSStoreProperty operators.
     443             : class PropertyAccess final {
     444             :  public:
     445             :   PropertyAccess(LanguageMode language_mode, VectorSlotPair const& feedback)
     446      120099 :       : feedback_(feedback), language_mode_(language_mode) {}
     447             : 
     448             :   LanguageMode language_mode() const { return language_mode_; }
     449             :   VectorSlotPair const& feedback() const { return feedback_; }
     450             : 
     451             :  private:
     452             :   VectorSlotPair const feedback_;
     453             :   LanguageMode const language_mode_;
     454             : };
     455             : 
     456             : bool operator==(PropertyAccess const&, PropertyAccess const&);
     457             : bool operator!=(PropertyAccess const&, PropertyAccess const&);
     458             : 
     459             : size_t hash_value(PropertyAccess const&);
     460             : 
     461             : std::ostream& operator<<(std::ostream&, PropertyAccess const&);
     462             : 
     463             : PropertyAccess const& PropertyAccessOf(const Operator* op);
     464             : 
     465             : 
     466             : // CreateArgumentsType is used as parameter to JSCreateArguments nodes.
     467             : CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op);
     468             : 
     469             : 
     470             : // Defines shared information for the array that should be created. This is
     471             : // used as parameter by JSCreateArray operators.
     472             : class CreateArrayParameters final {
     473             :  public:
     474             :   explicit CreateArrayParameters(size_t arity, Handle<AllocationSite> site)
     475             :       : arity_(arity), site_(site) {}
     476             : 
     477             :   size_t arity() const { return arity_; }
     478             :   Handle<AllocationSite> site() const { return site_; }
     479             : 
     480             :  private:
     481             :   size_t const arity_;
     482             :   Handle<AllocationSite> const site_;
     483             : };
     484             : 
     485             : bool operator==(CreateArrayParameters const&, CreateArrayParameters const&);
     486             : bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&);
     487             : 
     488             : size_t hash_value(CreateArrayParameters const&);
     489             : 
     490             : std::ostream& operator<<(std::ostream&, CreateArrayParameters const&);
     491             : 
     492             : const CreateArrayParameters& CreateArrayParametersOf(const Operator* op);
     493             : 
     494             : 
     495             : // Defines shared information for the closure that should be created. This is
     496             : // used as a parameter by JSCreateClosure operators.
     497             : class CreateClosureParameters final {
     498             :  public:
     499             :   CreateClosureParameters(Handle<SharedFunctionInfo> shared_info,
     500             :                           VectorSlotPair const& feedback,
     501             :                           PretenureFlag pretenure)
     502      184171 :       : shared_info_(shared_info), feedback_(feedback), pretenure_(pretenure) {}
     503             : 
     504             :   Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
     505             :   VectorSlotPair const& feedback() const { return feedback_; }
     506             :   PretenureFlag pretenure() const { return pretenure_; }
     507             : 
     508             :  private:
     509             :   const Handle<SharedFunctionInfo> shared_info_;
     510             :   VectorSlotPair const feedback_;
     511             :   const PretenureFlag pretenure_;
     512             : };
     513             : 
     514             : bool operator==(CreateClosureParameters const&, CreateClosureParameters const&);
     515             : bool operator!=(CreateClosureParameters const&, CreateClosureParameters const&);
     516             : 
     517             : size_t hash_value(CreateClosureParameters const&);
     518             : 
     519             : std::ostream& operator<<(std::ostream&, CreateClosureParameters const&);
     520             : 
     521             : const CreateClosureParameters& CreateClosureParametersOf(const Operator* op);
     522             : 
     523             : // Defines shared information for the literal that should be created. This is
     524             : // used as parameter by JSCreateLiteralArray, JSCreateLiteralObject and
     525             : // JSCreateLiteralRegExp operators.
     526             : class CreateLiteralParameters final {
     527             :  public:
     528             :   CreateLiteralParameters(Handle<HeapObject> constant, int length, int flags,
     529             :                           int index)
     530             :       : constant_(constant), length_(length), flags_(flags), index_(index) {}
     531             : 
     532             :   Handle<HeapObject> constant() const { return constant_; }
     533             :   int length() const { return length_; }
     534             :   int flags() const { return flags_; }
     535             :   int index() const { return index_; }
     536             : 
     537             :  private:
     538             :   Handle<HeapObject> const constant_;
     539             :   int const length_;
     540             :   int const flags_;
     541             :   int const index_;
     542             : };
     543             : 
     544             : bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&);
     545             : bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&);
     546             : 
     547             : size_t hash_value(CreateLiteralParameters const&);
     548             : 
     549             : std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&);
     550             : 
     551             : const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op);
     552             : 
     553             : class GeneratorStoreParameters final {
     554             :  public:
     555             :   GeneratorStoreParameters(int register_count, SuspendFlags flags)
     556             :       : register_count_(register_count), suspend_flags_(flags) {}
     557             : 
     558             :   int register_count() const { return register_count_; }
     559             :   SuspendFlags suspend_flags() const { return suspend_flags_; }
     560             :   SuspendFlags suspend_type() const {
     561             :     return suspend_flags_ & SuspendFlags::kSuspendTypeMask;
     562             :   }
     563             : 
     564             :  private:
     565             :   int register_count_;
     566             :   SuspendFlags suspend_flags_;
     567             : };
     568             : 
     569             : bool operator==(GeneratorStoreParameters const&,
     570             :                 GeneratorStoreParameters const&);
     571             : bool operator!=(GeneratorStoreParameters const&,
     572             :                 GeneratorStoreParameters const&);
     573             : 
     574             : size_t hash_value(GeneratorStoreParameters const&);
     575             : 
     576             : std::ostream& operator<<(std::ostream&, GeneratorStoreParameters const&);
     577             : 
     578             : const GeneratorStoreParameters& GeneratorStoreParametersOf(const Operator* op);
     579             : 
     580             : BinaryOperationHint BinaryOperationHintOf(const Operator* op);
     581             : 
     582             : CompareOperationHint CompareOperationHintOf(const Operator* op);
     583             : 
     584             : // Interface for building JavaScript-level operators, e.g. directly from the
     585             : // AST. Most operators have no parameters, thus can be globally shared for all
     586             : // graphs.
     587             : class V8_EXPORT_PRIVATE JSOperatorBuilder final
     588             :     : public NON_EXPORTED_BASE(ZoneObject) {
     589             :  public:
     590             :   explicit JSOperatorBuilder(Zone* zone);
     591             : 
     592             :   const Operator* Equal(CompareOperationHint hint);
     593             :   const Operator* StrictEqual(CompareOperationHint hint);
     594             :   const Operator* LessThan(CompareOperationHint hint);
     595             :   const Operator* GreaterThan(CompareOperationHint hint);
     596             :   const Operator* LessThanOrEqual(CompareOperationHint hint);
     597             :   const Operator* GreaterThanOrEqual(CompareOperationHint hint);
     598             : 
     599             :   const Operator* BitwiseOr();
     600             :   const Operator* BitwiseXor();
     601             :   const Operator* BitwiseAnd();
     602             :   const Operator* ShiftLeft();
     603             :   const Operator* ShiftRight();
     604             :   const Operator* ShiftRightLogical();
     605             :   const Operator* Add(BinaryOperationHint hint);
     606             :   const Operator* Subtract();
     607             :   const Operator* Multiply();
     608             :   const Operator* Divide();
     609             :   const Operator* Modulus();
     610             : 
     611             :   const Operator* ToBoolean(ToBooleanHints hints);
     612             :   const Operator* ToInteger();
     613             :   const Operator* ToLength();
     614             :   const Operator* ToName();
     615             :   const Operator* ToNumber();
     616             :   const Operator* ToObject();
     617             :   const Operator* ToString();
     618             : 
     619             :   const Operator* Create();
     620             :   const Operator* CreateArguments(CreateArgumentsType type);
     621             :   const Operator* CreateArray(size_t arity, Handle<AllocationSite> site);
     622             :   const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info,
     623             :                                 VectorSlotPair const& feedback,
     624             :                                 PretenureFlag pretenure);
     625             :   const Operator* CreateIterResultObject();
     626             :   const Operator* CreateKeyValueArray();
     627             :   const Operator* CreateLiteralArray(Handle<ConstantElementsPair> constant,
     628             :                                      int literal_flags, int literal_index,
     629             :                                      int number_of_elements);
     630             :   const Operator* CreateLiteralObject(Handle<BoilerplateDescription> constant,
     631             :                                       int literal_flags, int literal_index,
     632             :                                       int number_of_properties);
     633             :   const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
     634             :                                       int literal_flags, int literal_index);
     635             : 
     636             :   const Operator* CallForwardVarargs(uint32_t start_index,
     637             :                                      TailCallMode tail_call_mode);
     638             :   const Operator* Call(
     639             :       size_t arity, float frequency = 0.0f,
     640             :       VectorSlotPair const& feedback = VectorSlotPair(),
     641             :       ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
     642             :       TailCallMode tail_call_mode = TailCallMode::kDisallow);
     643             :   const Operator* CallWithSpread(uint32_t arity);
     644             :   const Operator* CallRuntime(Runtime::FunctionId id);
     645             :   const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
     646             :   const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
     647             :   const Operator* Construct(uint32_t arity, float frequency,
     648             :                             VectorSlotPair const& feedback);
     649             :   const Operator* ConstructWithSpread(uint32_t arity);
     650             : 
     651             :   const Operator* ConvertReceiver(ConvertReceiverMode convert_mode);
     652             : 
     653             :   const Operator* LoadProperty(VectorSlotPair const& feedback);
     654             :   const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback);
     655             : 
     656             :   const Operator* StoreProperty(LanguageMode language_mode,
     657             :                                 VectorSlotPair const& feedback);
     658             :   const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name,
     659             :                              VectorSlotPair const& feedback);
     660             : 
     661             :   const Operator* StoreNamedOwn(Handle<Name> name,
     662             :                                 VectorSlotPair const& feedback);
     663             :   const Operator* StoreDataPropertyInLiteral(const VectorSlotPair& feedback);
     664             : 
     665             :   const Operator* DeleteProperty();
     666             : 
     667             :   const Operator* HasProperty();
     668             : 
     669             :   const Operator* GetSuperConstructor();
     670             : 
     671             :   const Operator* LoadGlobal(const Handle<Name>& name,
     672             :                              const VectorSlotPair& feedback,
     673             :                              TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
     674             :   const Operator* StoreGlobal(LanguageMode language_mode,
     675             :                               const Handle<Name>& name,
     676             :                               const VectorSlotPair& feedback);
     677             : 
     678             :   const Operator* LoadContext(size_t depth, size_t index, bool immutable);
     679             :   const Operator* StoreContext(size_t depth, size_t index);
     680             : 
     681             :   const Operator* LoadModule(int32_t cell_index);
     682             :   const Operator* StoreModule(int32_t cell_index);
     683             : 
     684             :   const Operator* ClassOf();
     685             :   const Operator* TypeOf();
     686             :   const Operator* InstanceOf();
     687             :   const Operator* OrdinaryHasInstance();
     688             : 
     689             :   const Operator* ForInNext();
     690             :   const Operator* ForInPrepare();
     691             : 
     692             :   const Operator* LoadMessage();
     693             :   const Operator* StoreMessage();
     694             : 
     695             :   // Used to implement Ignition's SuspendGenerator bytecode.
     696             :   const Operator* GeneratorStore(int register_count,
     697             :                                  SuspendFlags suspend_flags);
     698             : 
     699             :   // Used to implement Ignition's ResumeGenerator bytecode.
     700             :   const Operator* GeneratorRestoreContinuation();
     701             :   const Operator* GeneratorRestoreRegister(int index);
     702             : 
     703             :   const Operator* StackCheck();
     704             :   const Operator* Debugger();
     705             : 
     706             :   const Operator* CreateFunctionContext(int slot_count, ScopeType scope_type);
     707             :   const Operator* CreateCatchContext(const Handle<String>& name,
     708             :                                      const Handle<ScopeInfo>& scope_info);
     709             :   const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info);
     710             :   const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info);
     711             :   const Operator* CreateModuleContext();
     712             :   const Operator* CreateScriptContext(const Handle<ScopeInfo>& scpope_info);
     713             : 
     714             :  private:
     715             :   Zone* zone() const { return zone_; }
     716             : 
     717             :   const JSOperatorGlobalCache& cache_;
     718             :   Zone* const zone_;
     719             : 
     720             :   DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
     721             : };
     722             : 
     723             : }  // namespace compiler
     724             : }  // namespace internal
     725             : }  // namespace v8
     726             : 
     727             : #endif  // V8_COMPILER_JS_OPERATOR_H_

Generated by: LCOV version 1.10