LCOV - code coverage report
Current view: top level - src/compiler - simplified-operator.h (source / functions) Hit Total Coverage
Test: app.info Lines: 15 17 88.2 %
Date: 2019-02-19 Functions: 0 1 0.0 %

          Line data    Source code
       1             : // Copyright 2014 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_SIMPLIFIED_OPERATOR_H_
       6             : #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_
       7             : 
       8             : #include <iosfwd>
       9             : 
      10             : #include "src/base/compiler-specific.h"
      11             : #include "src/compiler/operator.h"
      12             : #include "src/compiler/types.h"
      13             : #include "src/deoptimize-reason.h"
      14             : #include "src/globals.h"
      15             : #include "src/handles.h"
      16             : #include "src/machine-type.h"
      17             : #include "src/maybe-handles.h"
      18             : #include "src/objects.h"
      19             : #include "src/type-hints.h"
      20             : #include "src/vector-slot-pair.h"
      21             : #include "src/zone/zone-handle-set.h"
      22             : 
      23             : namespace v8 {
      24             : namespace internal {
      25             : 
      26             : // Forward declarations.
      27             : enum class AbortReason : uint8_t;
      28             : class Zone;
      29             : 
      30             : namespace compiler {
      31             : 
      32             : // Forward declarations.
      33             : class Operator;
      34             : struct SimplifiedOperatorGlobalCache;
      35             : 
      36             : enum BaseTaggedness : uint8_t { kUntaggedBase, kTaggedBase };
      37             : 
      38             : size_t hash_value(BaseTaggedness);
      39             : 
      40             : std::ostream& operator<<(std::ostream&, BaseTaggedness);
      41             : 
      42             : size_t hash_value(LoadSensitivity);
      43             : 
      44             : std::ostream& operator<<(std::ostream&, LoadSensitivity);
      45             : 
      46             : // An access descriptor for loads/stores of fixed structures like field
      47             : // accesses of heap objects. Accesses from either tagged or untagged base
      48             : // pointers are supported; untagging is done automatically during lowering.
      49             : struct FieldAccess {
      50             :   BaseTaggedness base_is_tagged;  // specifies if the base pointer is tagged.
      51             :   int offset;                     // offset of the field, without tag.
      52             :   MaybeHandle<Name> name;         // debugging only.
      53             :   MaybeHandle<Map> map;           // map of the field value (if known).
      54             :   Type type;                      // type of the field.
      55             :   MachineType machine_type;       // machine type of the field.
      56             :   WriteBarrierKind write_barrier_kind;  // write barrier hint.
      57             :   LoadSensitivity load_sensitivity;     // load safety for poisoning.
      58             : 
      59             :   FieldAccess()
      60             :       : base_is_tagged(kTaggedBase),
      61             :         offset(0),
      62             :         type(Type::None()),
      63             :         machine_type(MachineType::None()),
      64             :         write_barrier_kind(kFullWriteBarrier),
      65        7095 :         load_sensitivity(LoadSensitivity::kUnsafe) {}
      66             : 
      67             :   FieldAccess(BaseTaggedness base_is_tagged, int offset, MaybeHandle<Name> name,
      68             :               MaybeHandle<Map> map, Type type, MachineType machine_type,
      69             :               WriteBarrierKind write_barrier_kind,
      70             :               LoadSensitivity load_sensitivity = LoadSensitivity::kUnsafe)
      71             :       : base_is_tagged(base_is_tagged),
      72             :         offset(offset),
      73             :         name(name),
      74             :         map(map),
      75             :         type(type),
      76             :         machine_type(machine_type),
      77             :         write_barrier_kind(write_barrier_kind),
      78     4748574 :         load_sensitivity(load_sensitivity) {}
      79             : 
      80    14249032 :   int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
      81             : };
      82             : 
      83             : V8_EXPORT_PRIVATE bool operator==(FieldAccess const&, FieldAccess const&);
      84             : 
      85             : size_t hash_value(FieldAccess const&);
      86             : 
      87             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, FieldAccess const&);
      88             : 
      89             : V8_EXPORT_PRIVATE FieldAccess const& FieldAccessOf(const Operator* op)
      90             :     V8_WARN_UNUSED_RESULT;
      91             : 
      92             : template <>
      93             : void Operator1<FieldAccess>::PrintParameter(std::ostream& os,
      94             :                                             PrintVerbosity verbose) const;
      95             : 
      96             : // An access descriptor for loads/stores of indexed structures like characters
      97             : // in strings or off-heap backing stores. Accesses from either tagged or
      98             : // untagged base pointers are supported; untagging is done automatically during
      99             : // lowering.
     100             : struct ElementAccess {
     101             :   BaseTaggedness base_is_tagged;  // specifies if the base pointer is tagged.
     102             :   int header_size;                // size of the header, without tag.
     103             :   Type type;                      // type of the element.
     104             :   MachineType machine_type;       // machine type of the element.
     105             :   WriteBarrierKind write_barrier_kind;  // write barrier hint.
     106             :   LoadSensitivity load_sensitivity;     // load safety for poisoning.
     107             : 
     108             :   ElementAccess()
     109             :       : base_is_tagged(kTaggedBase),
     110             :         header_size(0),
     111             :         type(Type::None()),
     112             :         machine_type(MachineType::None()),
     113             :         write_barrier_kind(kFullWriteBarrier),
     114        3108 :         load_sensitivity(LoadSensitivity::kUnsafe) {}
     115             : 
     116             :   ElementAccess(BaseTaggedness base_is_tagged, int header_size, Type type,
     117             :                 MachineType machine_type, WriteBarrierKind write_barrier_kind,
     118             :                 LoadSensitivity load_sensitivity = LoadSensitivity::kUnsafe)
     119             :       : base_is_tagged(base_is_tagged),
     120             :         header_size(header_size),
     121             :         type(type),
     122             :         machine_type(machine_type),
     123             :         write_barrier_kind(write_barrier_kind),
     124       49977 :         load_sensitivity(load_sensitivity) {}
     125             : 
     126      251720 :   int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
     127             : };
     128             : 
     129             : V8_EXPORT_PRIVATE bool operator==(ElementAccess const&, ElementAccess const&);
     130             : 
     131             : size_t hash_value(ElementAccess const&);
     132             : 
     133             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ElementAccess const&);
     134             : 
     135             : V8_EXPORT_PRIVATE ElementAccess const& ElementAccessOf(const Operator* op)
     136             :     V8_WARN_UNUSED_RESULT;
     137             : 
     138             : ExternalArrayType ExternalArrayTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     139             : 
     140             : // The ConvertReceiverMode is used as parameter by ConvertReceiver operators.
     141             : ConvertReceiverMode ConvertReceiverModeOf(Operator const* op)
     142             :     V8_WARN_UNUSED_RESULT;
     143             : 
     144             : // A the parameters for several Check nodes. The {feedback} parameter is
     145             : // optional. If {feedback} references a valid CallIC slot and this MapCheck
     146             : // fails, then speculation on that CallIC slot will be disabled.
     147             : class CheckParameters final {
     148             :  public:
     149             :   explicit CheckParameters(const VectorSlotPair& feedback)
     150      494991 :       : feedback_(feedback) {}
     151             : 
     152             :   VectorSlotPair const& feedback() const { return feedback_; }
     153             : 
     154             :  private:
     155             :   VectorSlotPair feedback_;
     156             : };
     157             : 
     158             : bool operator==(CheckParameters const&, CheckParameters const&);
     159             : 
     160             : size_t hash_value(CheckParameters const&);
     161             : 
     162             : std::ostream& operator<<(std::ostream&, CheckParameters const&);
     163             : 
     164             : CheckParameters const& CheckParametersOf(Operator const*) V8_WARN_UNUSED_RESULT;
     165             : 
     166             : class CheckBoundsParameters final {
     167             :  public:
     168             :   enum Mode { kAbortOnOutOfBounds, kDeoptOnOutOfBounds };
     169             : 
     170             :   CheckBoundsParameters(const VectorSlotPair& feedback, Mode mode)
     171             :       : check_parameters_(feedback), mode_(mode) {}
     172             : 
     173             :   Mode mode() const { return mode_; }
     174             :   const CheckParameters& check_parameters() const { return check_parameters_; }
     175             : 
     176             :  private:
     177             :   CheckParameters check_parameters_;
     178             :   Mode mode_;
     179             : };
     180             : 
     181             : bool operator==(CheckBoundsParameters const&, CheckBoundsParameters const&);
     182             : 
     183             : size_t hash_value(CheckBoundsParameters const&);
     184             : 
     185             : std::ostream& operator<<(std::ostream&, CheckBoundsParameters const&);
     186             : 
     187             : CheckBoundsParameters const& CheckBoundsParametersOf(Operator const*)
     188             :     V8_WARN_UNUSED_RESULT;
     189             : 
     190             : class CheckIfParameters final {
     191             :  public:
     192             :   explicit CheckIfParameters(DeoptimizeReason reason,
     193             :                              const VectorSlotPair& feedback)
     194     1117301 :       : reason_(reason), feedback_(feedback) {}
     195             : 
     196             :   VectorSlotPair const& feedback() const { return feedback_; }
     197             :   DeoptimizeReason reason() const { return reason_; }
     198             : 
     199             :  private:
     200             :   DeoptimizeReason reason_;
     201             :   VectorSlotPair feedback_;
     202             : };
     203             : 
     204             : bool operator==(CheckIfParameters const&, CheckIfParameters const&);
     205             : 
     206             : size_t hash_value(CheckIfParameters const&);
     207             : 
     208             : std::ostream& operator<<(std::ostream&, CheckIfParameters const&);
     209             : 
     210             : CheckIfParameters const& CheckIfParametersOf(Operator const*)
     211             :     V8_WARN_UNUSED_RESULT;
     212             : 
     213             : enum class CheckFloat64HoleMode : uint8_t {
     214             :   kNeverReturnHole,  // Never return the hole (deoptimize instead).
     215             :   kAllowReturnHole   // Allow to return the hole (signaling NaN).
     216             : };
     217             : 
     218             : size_t hash_value(CheckFloat64HoleMode);
     219             : 
     220             : std::ostream& operator<<(std::ostream&, CheckFloat64HoleMode);
     221             : 
     222             : class CheckFloat64HoleParameters {
     223             :  public:
     224             :   CheckFloat64HoleParameters(CheckFloat64HoleMode mode,
     225             :                              VectorSlotPair const& feedback)
     226       55851 :       : mode_(mode), feedback_(feedback) {}
     227             : 
     228             :   CheckFloat64HoleMode mode() const { return mode_; }
     229             :   VectorSlotPair const& feedback() const { return feedback_; }
     230             : 
     231             :  private:
     232             :   CheckFloat64HoleMode mode_;
     233             :   VectorSlotPair feedback_;
     234             : };
     235             : 
     236             : CheckFloat64HoleParameters const& CheckFloat64HoleParametersOf(Operator const*)
     237             :     V8_WARN_UNUSED_RESULT;
     238             : 
     239             : std::ostream& operator<<(std::ostream&, CheckFloat64HoleParameters const&);
     240             : 
     241             : size_t hash_value(CheckFloat64HoleParameters const&);
     242             : 
     243             : bool operator==(CheckFloat64HoleParameters const&,
     244             :                 CheckFloat64HoleParameters const&);
     245             : bool operator!=(CheckFloat64HoleParameters const&,
     246             :                 CheckFloat64HoleParameters const&);
     247             : 
     248             : enum class CheckTaggedInputMode : uint8_t {
     249             :   kNumber,
     250             :   kNumberOrOddball,
     251             : };
     252             : 
     253             : size_t hash_value(CheckTaggedInputMode);
     254             : 
     255             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, CheckTaggedInputMode);
     256             : 
     257             : class CheckTaggedInputParameters {
     258             :  public:
     259             :   CheckTaggedInputParameters(CheckTaggedInputMode mode,
     260             :                              const VectorSlotPair& feedback)
     261      142442 :       : mode_(mode), feedback_(feedback) {}
     262             : 
     263             :   CheckTaggedInputMode mode() const { return mode_; }
     264             :   const VectorSlotPair& feedback() const { return feedback_; }
     265             : 
     266             :  private:
     267             :   CheckTaggedInputMode mode_;
     268             :   VectorSlotPair feedback_;
     269             : };
     270             : 
     271             : const CheckTaggedInputParameters& CheckTaggedInputParametersOf(const Operator*)
     272             :     V8_WARN_UNUSED_RESULT;
     273             : 
     274             : std::ostream& operator<<(std::ostream&,
     275             :                          const CheckTaggedInputParameters& params);
     276             : 
     277             : size_t hash_value(const CheckTaggedInputParameters& params);
     278             : 
     279             : bool operator==(CheckTaggedInputParameters const&,
     280             :                 CheckTaggedInputParameters const&);
     281             : 
     282             : enum class CheckForMinusZeroMode : uint8_t {
     283             :   kCheckForMinusZero,
     284             :   kDontCheckForMinusZero,
     285             : };
     286             : 
     287             : size_t hash_value(CheckForMinusZeroMode);
     288             : 
     289             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
     290             :                                            CheckForMinusZeroMode);
     291             : 
     292             : CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator*)
     293             :     V8_WARN_UNUSED_RESULT;
     294             : 
     295             : class CheckMinusZeroParameters {
     296             :  public:
     297             :   CheckMinusZeroParameters(CheckForMinusZeroMode mode,
     298             :                            const VectorSlotPair& feedback)
     299      223875 :       : mode_(mode), feedback_(feedback) {}
     300             : 
     301             :   CheckForMinusZeroMode mode() const { return mode_; }
     302             :   const VectorSlotPair& feedback() const { return feedback_; }
     303             : 
     304             :  private:
     305             :   CheckForMinusZeroMode mode_;
     306             :   VectorSlotPair feedback_;
     307             : };
     308             : 
     309             : const CheckMinusZeroParameters& CheckMinusZeroParametersOf(const Operator* op)
     310             :     V8_WARN_UNUSED_RESULT;
     311             : 
     312             : std::ostream& operator<<(std::ostream&, const CheckMinusZeroParameters& params);
     313             : 
     314             : size_t hash_value(const CheckMinusZeroParameters& params);
     315             : 
     316             : bool operator==(CheckMinusZeroParameters const&,
     317             :                 CheckMinusZeroParameters const&);
     318             : 
     319             : // Flags for map checks.
     320             : enum class CheckMapsFlag : uint8_t {
     321             :   kNone = 0u,
     322             :   kTryMigrateInstance = 1u << 0,  // Try instance migration.
     323             : };
     324             : typedef base::Flags<CheckMapsFlag> CheckMapsFlags;
     325             : 
     326             : DEFINE_OPERATORS_FOR_FLAGS(CheckMapsFlags)
     327             : 
     328             : std::ostream& operator<<(std::ostream&, CheckMapsFlags);
     329             : 
     330             : class MapsParameterInfo {
     331             :  public:
     332             :   explicit MapsParameterInfo(ZoneHandleSet<Map> const& maps);
     333             : 
     334             :   Maybe<InstanceType> instance_type() const { return instance_type_; }
     335             :   ZoneHandleSet<Map> const& maps() const { return maps_; }
     336             : 
     337             :  private:
     338             :   ZoneHandleSet<Map> const maps_;
     339             :   Maybe<InstanceType> instance_type_;
     340             : };
     341             : 
     342             : std::ostream& operator<<(std::ostream&, MapsParameterInfo const&);
     343             : 
     344             : bool operator==(MapsParameterInfo const&, MapsParameterInfo const&);
     345             : bool operator!=(MapsParameterInfo const&, MapsParameterInfo const&);
     346             : 
     347             : size_t hash_value(MapsParameterInfo const&);
     348             : 
     349             : // A descriptor for map checks. The {feedback} parameter is optional.
     350             : // If {feedback} references a valid CallIC slot and this MapCheck fails,
     351             : // then speculation on that CallIC slot will be disabled.
     352             : class CheckMapsParameters final {
     353             :  public:
     354             :   CheckMapsParameters(CheckMapsFlags flags, ZoneHandleSet<Map> const& maps,
     355             :                       const VectorSlotPair& feedback)
     356       95121 :       : flags_(flags), maps_info_(maps), feedback_(feedback) {}
     357             : 
     358             :   CheckMapsFlags flags() const { return flags_; }
     359             :   ZoneHandleSet<Map> const& maps() const { return maps_info_.maps(); }
     360             :   MapsParameterInfo const& maps_info() const { return maps_info_; }
     361             :   VectorSlotPair const& feedback() const { return feedback_; }
     362             : 
     363             :  private:
     364             :   CheckMapsFlags const flags_;
     365             :   MapsParameterInfo const maps_info_;
     366             :   VectorSlotPair const feedback_;
     367             : };
     368             : 
     369             : bool operator==(CheckMapsParameters const&, CheckMapsParameters const&);
     370             : 
     371             : size_t hash_value(CheckMapsParameters const&);
     372             : 
     373             : std::ostream& operator<<(std::ostream&, CheckMapsParameters const&);
     374             : 
     375             : CheckMapsParameters const& CheckMapsParametersOf(Operator const*)
     376             :     V8_WARN_UNUSED_RESULT;
     377             : 
     378             : MapsParameterInfo const& MapGuardMapsOf(Operator const*) V8_WARN_UNUSED_RESULT;
     379             : 
     380             : // Parameters for CompareMaps operator.
     381             : MapsParameterInfo const& CompareMapsParametersOf(Operator const*)
     382             :     V8_WARN_UNUSED_RESULT;
     383             : 
     384             : // A descriptor for growing elements backing stores.
     385             : enum class GrowFastElementsMode : uint8_t {
     386             :   kDoubleElements,
     387             :   kSmiOrObjectElements
     388             : };
     389             : 
     390           0 : inline size_t hash_value(GrowFastElementsMode mode) {
     391           0 :   return static_cast<uint8_t>(mode);
     392             : }
     393             : 
     394             : std::ostream& operator<<(std::ostream&, GrowFastElementsMode);
     395             : 
     396             : class GrowFastElementsParameters {
     397             :  public:
     398             :   GrowFastElementsParameters(GrowFastElementsMode mode,
     399             :                              const VectorSlotPair& feedback)
     400       57626 :       : mode_(mode), feedback_(feedback) {}
     401             : 
     402             :   GrowFastElementsMode mode() const { return mode_; }
     403             :   const VectorSlotPair& feedback() const { return feedback_; }
     404             : 
     405             :  private:
     406             :   GrowFastElementsMode mode_;
     407             :   VectorSlotPair feedback_;
     408             : };
     409             : 
     410             : bool operator==(const GrowFastElementsParameters&,
     411             :                 const GrowFastElementsParameters&);
     412             : 
     413             : inline size_t hash_value(const GrowFastElementsParameters&);
     414             : 
     415             : std::ostream& operator<<(std::ostream&, const GrowFastElementsParameters&);
     416             : 
     417             : const GrowFastElementsParameters& GrowFastElementsParametersOf(const Operator*)
     418             :     V8_WARN_UNUSED_RESULT;
     419             : 
     420             : // A descriptor for elements kind transitions.
     421             : class ElementsTransition final {
     422             :  public:
     423             :   enum Mode : uint8_t {
     424             :     kFastTransition,  // simple transition, just updating the map.
     425             :     kSlowTransition   // full transition, round-trip to the runtime.
     426             :   };
     427             : 
     428             :   ElementsTransition(Mode mode, Handle<Map> source, Handle<Map> target)
     429         545 :       : mode_(mode), source_(source), target_(target) {}
     430             : 
     431             :   Mode mode() const { return mode_; }
     432             :   Handle<Map> source() const { return source_; }
     433             :   Handle<Map> target() const { return target_; }
     434             : 
     435             :  private:
     436             :   Mode const mode_;
     437             :   Handle<Map> const source_;
     438             :   Handle<Map> const target_;
     439             : };
     440             : 
     441             : bool operator==(ElementsTransition const&, ElementsTransition const&);
     442             : 
     443             : size_t hash_value(ElementsTransition);
     444             : 
     445             : std::ostream& operator<<(std::ostream&, ElementsTransition);
     446             : 
     447             : ElementsTransition const& ElementsTransitionOf(const Operator* op)
     448             :     V8_WARN_UNUSED_RESULT;
     449             : 
     450             : // Parameters for TransitionAndStoreElement, or
     451             : // TransitionAndStoreNonNumberElement, or
     452             : // TransitionAndStoreNumberElement.
     453             : Handle<Map> DoubleMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     454             : Handle<Map> FastMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     455             : 
     456             : // Parameters for TransitionAndStoreNonNumberElement.
     457             : Type ValueTypeParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     458             : 
     459             : // A hint for speculative number operations.
     460             : enum class NumberOperationHint : uint8_t {
     461             :   kSignedSmall,        // Inputs were Smi, output was in Smi.
     462             :   kSignedSmallInputs,  // Inputs were Smi, output was Number.
     463             :   kSigned32,           // Inputs were Signed32, output was Number.
     464             :   kNumber,             // Inputs were Number, output was Number.
     465             :   kNumberOrOddball,    // Inputs were Number or Oddball, output was Number.
     466             : };
     467             : 
     468             : size_t hash_value(NumberOperationHint);
     469             : 
     470             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, NumberOperationHint);
     471             : 
     472             : V8_EXPORT_PRIVATE NumberOperationHint NumberOperationHintOf(const Operator* op)
     473             :     V8_WARN_UNUSED_RESULT;
     474             : 
     475             : class NumberOperationParameters {
     476             :  public:
     477             :   NumberOperationParameters(NumberOperationHint hint,
     478             :                             const VectorSlotPair& feedback)
     479      167920 :       : hint_(hint), feedback_(feedback) {}
     480             : 
     481             :   NumberOperationHint hint() const { return hint_; }
     482             :   const VectorSlotPair& feedback() const { return feedback_; }
     483             : 
     484             :  private:
     485             :   NumberOperationHint hint_;
     486             :   VectorSlotPair feedback_;
     487             : };
     488             : 
     489             : size_t hash_value(NumberOperationParameters const&);
     490             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
     491             :                                            const NumberOperationParameters&);
     492             : bool operator==(NumberOperationParameters const&,
     493             :                 NumberOperationParameters const&);
     494             : const NumberOperationParameters& NumberOperationParametersOf(const Operator* op)
     495             :     V8_WARN_UNUSED_RESULT;
     496             : 
     497             : int FormalParameterCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     498             : bool IsRestLengthOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     499             : 
     500             : class AllocateParameters {
     501             :  public:
     502             :   AllocateParameters(Type type, PretenureFlag pretenure)
     503             :       : type_(type), pretenure_(pretenure) {}
     504             : 
     505             :   Type type() const { return type_; }
     506             :   PretenureFlag pretenure() const { return pretenure_; }
     507             : 
     508             :  private:
     509             :   Type type_;
     510             :   PretenureFlag pretenure_;
     511             : };
     512             : 
     513             : bool IsCheckedWithFeedback(const Operator* op);
     514             : 
     515             : size_t hash_value(AllocateParameters);
     516             : 
     517             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, AllocateParameters);
     518             : 
     519             : bool operator==(AllocateParameters const&, AllocateParameters const&);
     520             : 
     521             : PretenureFlag PretenureFlagOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     522             : 
     523             : Type AllocateTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     524             : 
     525             : UnicodeEncoding UnicodeEncodingOf(const Operator*) V8_WARN_UNUSED_RESULT;
     526             : 
     527             : AbortReason AbortReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     528             : 
     529             : DeoptimizeReason DeoptimizeReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     530             : 
     531             : int NewArgumentsElementsMappedCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     532             : 
     533             : // Interface for building simplified operators, which represent the
     534             : // medium-level operations of V8, including adding numbers, allocating objects,
     535             : // indexing into objects and arrays, etc.
     536             : // All operators are typed but many are representation independent.
     537             : 
     538             : // Number values from JS can be in one of these representations:
     539             : //   - Tagged: word-sized integer that is either
     540             : //     - a signed small integer (31 or 32 bits plus a tag)
     541             : //     - a tagged pointer to a HeapNumber object that has a float64 field
     542             : //   - Int32: an untagged signed 32-bit integer
     543             : //   - Uint32: an untagged unsigned 32-bit integer
     544             : //   - Float64: an untagged float64
     545             : 
     546             : // Additional representations for intermediate code or non-JS code:
     547             : //   - Int64: an untagged signed 64-bit integer
     548             : //   - Uint64: an untagged unsigned 64-bit integer
     549             : //   - Float32: an untagged float32
     550             : 
     551             : // Boolean values can be:
     552             : //   - Bool: a tagged pointer to either the canonical JS #false or
     553             : //           the canonical JS #true object
     554             : //   - Bit: an untagged integer 0 or 1, but word-sized
     555             : class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
     556             :     : public NON_EXPORTED_BASE(ZoneObject) {
     557             :  public:
     558             :   explicit SimplifiedOperatorBuilder(Zone* zone);
     559             : 
     560             :   const Operator* BooleanNot();
     561             : 
     562             :   const Operator* NumberEqual();
     563             :   const Operator* NumberLessThan();
     564             :   const Operator* NumberLessThanOrEqual();
     565             :   const Operator* NumberAdd();
     566             :   const Operator* NumberSubtract();
     567             :   const Operator* NumberMultiply();
     568             :   const Operator* NumberDivide();
     569             :   const Operator* NumberModulus();
     570             :   const Operator* NumberBitwiseOr();
     571             :   const Operator* NumberBitwiseXor();
     572             :   const Operator* NumberBitwiseAnd();
     573             :   const Operator* NumberShiftLeft();
     574             :   const Operator* NumberShiftRight();
     575             :   const Operator* NumberShiftRightLogical();
     576             :   const Operator* NumberImul();
     577             :   const Operator* NumberAbs();
     578             :   const Operator* NumberClz32();
     579             :   const Operator* NumberCeil();
     580             :   const Operator* NumberFloor();
     581             :   const Operator* NumberFround();
     582             :   const Operator* NumberAcos();
     583             :   const Operator* NumberAcosh();
     584             :   const Operator* NumberAsin();
     585             :   const Operator* NumberAsinh();
     586             :   const Operator* NumberAtan();
     587             :   const Operator* NumberAtan2();
     588             :   const Operator* NumberAtanh();
     589             :   const Operator* NumberCbrt();
     590             :   const Operator* NumberCos();
     591             :   const Operator* NumberCosh();
     592             :   const Operator* NumberExp();
     593             :   const Operator* NumberExpm1();
     594             :   const Operator* NumberLog();
     595             :   const Operator* NumberLog1p();
     596             :   const Operator* NumberLog10();
     597             :   const Operator* NumberLog2();
     598             :   const Operator* NumberMax();
     599             :   const Operator* NumberMin();
     600             :   const Operator* NumberPow();
     601             :   const Operator* NumberRound();
     602             :   const Operator* NumberSign();
     603             :   const Operator* NumberSin();
     604             :   const Operator* NumberSinh();
     605             :   const Operator* NumberSqrt();
     606             :   const Operator* NumberTan();
     607             :   const Operator* NumberTanh();
     608             :   const Operator* NumberTrunc();
     609             :   const Operator* NumberToBoolean();
     610             :   const Operator* NumberToInt32();
     611             :   const Operator* NumberToString();
     612             :   const Operator* NumberToUint32();
     613             :   const Operator* NumberToUint8Clamped();
     614             : 
     615             :   const Operator* NumberSilenceNaN();
     616             : 
     617             :   const Operator* SpeculativeSafeIntegerAdd(NumberOperationHint hint);
     618             :   const Operator* SpeculativeSafeIntegerSubtract(NumberOperationHint hint);
     619             : 
     620             :   const Operator* SpeculativeNumberAdd(NumberOperationHint hint);
     621             :   const Operator* SpeculativeNumberSubtract(NumberOperationHint hint);
     622             :   const Operator* SpeculativeNumberMultiply(NumberOperationHint hint);
     623             :   const Operator* SpeculativeNumberDivide(NumberOperationHint hint);
     624             :   const Operator* SpeculativeNumberModulus(NumberOperationHint hint);
     625             :   const Operator* SpeculativeNumberShiftLeft(NumberOperationHint hint);
     626             :   const Operator* SpeculativeNumberShiftRight(NumberOperationHint hint);
     627             :   const Operator* SpeculativeNumberShiftRightLogical(NumberOperationHint hint);
     628             :   const Operator* SpeculativeNumberBitwiseAnd(NumberOperationHint hint);
     629             :   const Operator* SpeculativeNumberBitwiseOr(NumberOperationHint hint);
     630             :   const Operator* SpeculativeNumberBitwiseXor(NumberOperationHint hint);
     631             : 
     632             :   const Operator* SpeculativeNumberLessThan(NumberOperationHint hint);
     633             :   const Operator* SpeculativeNumberLessThanOrEqual(NumberOperationHint hint);
     634             :   const Operator* SpeculativeNumberEqual(NumberOperationHint hint);
     635             : 
     636             :   const Operator* ReferenceEqual();
     637             :   const Operator* SameValue();
     638             : 
     639             :   const Operator* TypeOf();
     640             : 
     641             :   const Operator* ToBoolean();
     642             : 
     643             :   const Operator* StringConcat();
     644             :   const Operator* StringEqual();
     645             :   const Operator* StringLessThan();
     646             :   const Operator* StringLessThanOrEqual();
     647             :   const Operator* StringCharCodeAt();
     648             :   const Operator* StringCodePointAt(UnicodeEncoding encoding);
     649             :   const Operator* StringFromSingleCharCode();
     650             :   const Operator* StringFromSingleCodePoint(UnicodeEncoding encoding);
     651             :   const Operator* StringIndexOf();
     652             :   const Operator* StringLength();
     653             :   const Operator* StringToLowerCaseIntl();
     654             :   const Operator* StringToUpperCaseIntl();
     655             :   const Operator* StringSubstring();
     656             : 
     657             :   const Operator* FindOrderedHashMapEntry();
     658             :   const Operator* FindOrderedHashMapEntryForInt32Key();
     659             : 
     660             :   const Operator* SpeculativeToNumber(NumberOperationHint hint,
     661             :                                       const VectorSlotPair& feedback);
     662             : 
     663             :   const Operator* StringToNumber();
     664             :   const Operator* PlainPrimitiveToNumber();
     665             :   const Operator* PlainPrimitiveToWord32();
     666             :   const Operator* PlainPrimitiveToFloat64();
     667             : 
     668             :   const Operator* ChangeTaggedSignedToInt32();
     669             :   const Operator* ChangeTaggedSignedToInt64();
     670             :   const Operator* ChangeTaggedToInt32();
     671             :   const Operator* ChangeTaggedToInt64();
     672             :   const Operator* ChangeTaggedToUint32();
     673             :   const Operator* ChangeTaggedToFloat64();
     674             :   const Operator* ChangeTaggedToTaggedSigned();
     675             :   const Operator* ChangeInt31ToTaggedSigned();
     676             :   const Operator* ChangeInt32ToTagged();
     677             :   const Operator* ChangeInt64ToTagged();
     678             :   const Operator* ChangeUint32ToTagged();
     679             :   const Operator* ChangeUint64ToTagged();
     680             :   const Operator* ChangeFloat64ToTagged(CheckForMinusZeroMode);
     681             :   const Operator* ChangeFloat64ToTaggedPointer();
     682             :   const Operator* ChangeTaggedToBit();
     683             :   const Operator* ChangeBitToTagged();
     684             :   const Operator* TruncateTaggedToWord32();
     685             :   const Operator* TruncateTaggedToFloat64();
     686             :   const Operator* TruncateTaggedToBit();
     687             :   const Operator* TruncateTaggedPointerToBit();
     688             : 
     689             :   const Operator* PoisonIndex();
     690             :   const Operator* CompareMaps(ZoneHandleSet<Map>);
     691             :   const Operator* MapGuard(ZoneHandleSet<Map> maps);
     692             : 
     693             :   const Operator* CheckBounds(const VectorSlotPair& feedback);
     694             :   const Operator* CheckEqualsInternalizedString();
     695             :   const Operator* CheckEqualsSymbol();
     696             :   const Operator* CheckFloat64Hole(CheckFloat64HoleMode, VectorSlotPair const&);
     697             :   const Operator* CheckHeapObject();
     698             :   const Operator* CheckIf(DeoptimizeReason deoptimize_reason,
     699             :                           const VectorSlotPair& feedback = VectorSlotPair());
     700             :   const Operator* CheckInternalizedString();
     701             :   const Operator* CheckMaps(CheckMapsFlags, ZoneHandleSet<Map>,
     702             :                             const VectorSlotPair& = VectorSlotPair());
     703             :   const Operator* CheckNotTaggedHole();
     704             :   const Operator* CheckNumber(const VectorSlotPair& feedback);
     705             :   const Operator* CheckReceiver();
     706             :   const Operator* CheckReceiverOrNullOrUndefined();
     707             :   const Operator* CheckSmi(const VectorSlotPair& feedback);
     708             :   const Operator* CheckString(const VectorSlotPair& feedback);
     709             :   const Operator* CheckSymbol();
     710             : 
     711             :   const Operator* CheckedFloat64ToInt32(CheckForMinusZeroMode,
     712             :                                         const VectorSlotPair& feedback);
     713             :   const Operator* CheckedFloat64ToInt64(CheckForMinusZeroMode,
     714             :                                         const VectorSlotPair& feedback);
     715             :   const Operator* CheckedInt32Add();
     716             :   const Operator* CheckedInt32Div();
     717             :   const Operator* CheckedInt32Mod();
     718             :   const Operator* CheckedInt32Mul(CheckForMinusZeroMode);
     719             :   const Operator* CheckedInt32Sub();
     720             :   const Operator* CheckedInt32ToTaggedSigned(const VectorSlotPair& feedback);
     721             :   const Operator* CheckedInt64ToInt32(const VectorSlotPair& feedback);
     722             :   const Operator* CheckedInt64ToTaggedSigned(const VectorSlotPair& feedback);
     723             :   const Operator* CheckedTaggedSignedToInt32(const VectorSlotPair& feedback);
     724             :   const Operator* CheckedTaggedToFloat64(CheckTaggedInputMode,
     725             :                                          const VectorSlotPair& feedback);
     726             :   const Operator* CheckedTaggedToInt32(CheckForMinusZeroMode,
     727             :                                        const VectorSlotPair& feedback);
     728             :   const Operator* CheckedTaggedToInt64(CheckForMinusZeroMode,
     729             :                                        const VectorSlotPair& feedback);
     730             :   const Operator* CheckedTaggedToTaggedPointer(const VectorSlotPair& feedback);
     731             :   const Operator* CheckedTaggedToTaggedSigned(const VectorSlotPair& feedback);
     732             :   const Operator* CheckedTruncateTaggedToWord32(CheckTaggedInputMode,
     733             :                                                 const VectorSlotPair& feedback);
     734             :   const Operator* CheckedUint32Div();
     735             :   const Operator* CheckedUint32Mod();
     736             :   const Operator* CheckedUint32Bounds(const VectorSlotPair& feedback,
     737             :                                       CheckBoundsParameters::Mode mode);
     738             :   const Operator* CheckedUint32ToInt32(const VectorSlotPair& feedback);
     739             :   const Operator* CheckedUint32ToTaggedSigned(const VectorSlotPair& feedback);
     740             :   const Operator* CheckedUint64Bounds(const VectorSlotPair& feedback);
     741             :   const Operator* CheckedUint64ToInt32(const VectorSlotPair& feedback);
     742             :   const Operator* CheckedUint64ToTaggedSigned(const VectorSlotPair& feedback);
     743             : 
     744             :   const Operator* ConvertReceiver(ConvertReceiverMode);
     745             : 
     746             :   const Operator* ConvertTaggedHoleToUndefined();
     747             : 
     748             :   const Operator* ObjectIsArrayBufferView();
     749             :   const Operator* ObjectIsBigInt();
     750             :   const Operator* ObjectIsCallable();
     751             :   const Operator* ObjectIsConstructor();
     752             :   const Operator* ObjectIsDetectableCallable();
     753             :   const Operator* ObjectIsMinusZero();
     754             :   const Operator* NumberIsMinusZero();
     755             :   const Operator* ObjectIsNaN();
     756             :   const Operator* NumberIsNaN();
     757             :   const Operator* ObjectIsNonCallable();
     758             :   const Operator* ObjectIsNumber();
     759             :   const Operator* ObjectIsReceiver();
     760             :   const Operator* ObjectIsSmi();
     761             :   const Operator* ObjectIsString();
     762             :   const Operator* ObjectIsSymbol();
     763             :   const Operator* ObjectIsUndetectable();
     764             : 
     765             :   const Operator* NumberIsFloat64Hole();
     766             :   const Operator* NumberIsFinite();
     767             :   const Operator* ObjectIsFiniteNumber();
     768             :   const Operator* NumberIsInteger();
     769             :   const Operator* ObjectIsSafeInteger();
     770             :   const Operator* NumberIsSafeInteger();
     771             :   const Operator* ObjectIsInteger();
     772             : 
     773             :   const Operator* ArgumentsFrame();
     774             :   const Operator* ArgumentsLength(int formal_parameter_count,
     775             :                                   bool is_rest_length);
     776             : 
     777             :   const Operator* NewDoubleElements(PretenureFlag);
     778             :   const Operator* NewSmiOrObjectElements(PretenureFlag);
     779             : 
     780             :   // new-arguments-elements arguments-frame, arguments-length
     781             :   const Operator* NewArgumentsElements(int mapped_count);
     782             : 
     783             :   // new-cons-string length, first, second
     784             :   const Operator* NewConsString();
     785             : 
     786             :   // ensure-writable-fast-elements object, elements
     787             :   const Operator* EnsureWritableFastElements();
     788             : 
     789             :   // maybe-grow-fast-elements object, elements, index, length
     790             :   const Operator* MaybeGrowFastElements(GrowFastElementsMode mode,
     791             :                                         const VectorSlotPair& feedback);
     792             : 
     793             :   // transition-elements-kind object, from-map, to-map
     794             :   const Operator* TransitionElementsKind(ElementsTransition transition);
     795             : 
     796             :   const Operator* Allocate(Type type, PretenureFlag pretenure = NOT_TENURED);
     797             :   const Operator* AllocateRaw(Type type, PretenureFlag pretenure = NOT_TENURED);
     798             : 
     799             :   const Operator* LoadFieldByIndex();
     800             :   const Operator* LoadField(FieldAccess const&);
     801             :   const Operator* StoreField(FieldAccess const&);
     802             : 
     803             :   const Operator* LoadMessage();
     804             :   const Operator* StoreMessage();
     805             : 
     806             :   // load-element [base + index]
     807             :   const Operator* LoadElement(ElementAccess const&);
     808             : 
     809             :   // store-element [base + index], value
     810             :   const Operator* StoreElement(ElementAccess const&);
     811             : 
     812             :   // store-element [base + index], value, only with fast arrays.
     813             :   const Operator* TransitionAndStoreElement(Handle<Map> double_map,
     814             :                                             Handle<Map> fast_map);
     815             :   // store-element [base + index], smi value, only with fast arrays.
     816             :   const Operator* StoreSignedSmallElement();
     817             : 
     818             :   // store-element [base + index], double value, only with fast arrays.
     819             :   const Operator* TransitionAndStoreNumberElement(Handle<Map> double_map);
     820             : 
     821             :   // store-element [base + index], object value, only with fast arrays.
     822             :   const Operator* TransitionAndStoreNonNumberElement(Handle<Map> fast_map,
     823             :                                                      Type value_type);
     824             : 
     825             :   // load-typed-element buffer, [base + external + index]
     826             :   const Operator* LoadTypedElement(ExternalArrayType const&);
     827             : 
     828             :   // load-data-view-element buffer, [base + byte_offset + index]
     829             :   const Operator* LoadDataViewElement(ExternalArrayType const&);
     830             : 
     831             :   // store-typed-element buffer, [base + external + index], value
     832             :   const Operator* StoreTypedElement(ExternalArrayType const&);
     833             : 
     834             :   // store-data-view-element buffer, [base + byte_offset + index], value
     835             :   const Operator* StoreDataViewElement(ExternalArrayType const&);
     836             : 
     837             :   // Abort (for terminating execution on internal error).
     838             :   const Operator* RuntimeAbort(AbortReason reason);
     839             : 
     840             :   const Operator* DateNow();
     841             : 
     842             :  private:
     843             :   Zone* zone() const { return zone_; }
     844             : 
     845             :   const SimplifiedOperatorGlobalCache& cache_;
     846             :   Zone* const zone_;
     847             : 
     848             :   DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder);
     849             : };
     850             : 
     851             : }  // namespace compiler
     852             : }  // namespace internal
     853             : }  // namespace v8
     854             : 
     855             : #endif  // V8_COMPILER_SIMPLIFIED_OPERATOR_H_

Generated by: LCOV version 1.10