LCOV - code coverage report
Current view: top level - src/compiler - simplified-operator.h (source / functions) Hit Total Coverage
Test: app.info Lines: 22 25 88.0 %
Date: 2019-04-17 Functions: 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       14208 :         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     4724090 :         load_sensitivity(load_sensitivity) {}
      79             : 
      80    14298765 :   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             :         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       51583 :         load_sensitivity(load_sensitivity) {}
     125             : 
     126      253943 :   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      628542 :       : feedback_(feedback) {}
     151             : 
     152      187498 :   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           0 :   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     1186019 :       : reason_(reason), feedback_(feedback) {}
     195             : 
     196       16409 :   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       57841 :       : mode_(mode), feedback_(feedback) {}
     227             : 
     228             :   CheckFloat64HoleMode mode() const { return mode_; }
     229         470 :   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      147568 :       : mode_(mode), feedback_(feedback) {}
     262             : 
     263             :   CheckTaggedInputMode mode() const { return mode_; }
     264       52257 :   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      231832 :       : mode_(mode), feedback_(feedback) {}
     300             : 
     301             :   CheckForMinusZeroMode mode() const { return mode_; }
     302        4692 :   const VectorSlotPair& feedback() const { return feedback_; }
     303             : 
     304             :  private:
     305             :   CheckForMinusZeroMode mode_;
     306             :   VectorSlotPair feedback_;
     307             : };
     308             : 
     309             : V8_EXPORT_PRIVATE const CheckMinusZeroParameters& CheckMinusZeroParametersOf(
     310             :     const Operator* op) V8_WARN_UNUSED_RESULT;
     311             : 
     312             : V8_EXPORT_PRIVATE std::ostream& operator<<(
     313             :     std::ostream&, const CheckMinusZeroParameters& params);
     314             : 
     315             : size_t hash_value(const CheckMinusZeroParameters& params);
     316             : 
     317             : bool operator==(CheckMinusZeroParameters const&,
     318             :                 CheckMinusZeroParameters const&);
     319             : 
     320             : // Flags for map checks.
     321             : enum class CheckMapsFlag : uint8_t {
     322             :   kNone = 0u,
     323             :   kTryMigrateInstance = 1u << 0,  // Try instance migration.
     324             : };
     325             : using CheckMapsFlags = base::Flags<CheckMapsFlag>;
     326             : 
     327             : DEFINE_OPERATORS_FOR_FLAGS(CheckMapsFlags)
     328             : 
     329             : std::ostream& operator<<(std::ostream&, CheckMapsFlags);
     330             : 
     331             : // A descriptor for map checks. The {feedback} parameter is optional.
     332             : // If {feedback} references a valid CallIC slot and this MapCheck fails,
     333             : // then speculation on that CallIC slot will be disabled.
     334             : class CheckMapsParameters final {
     335             :  public:
     336             :   CheckMapsParameters(CheckMapsFlags flags, ZoneHandleSet<Map> const& maps,
     337             :                       const VectorSlotPair& feedback)
     338       91070 :       : flags_(flags), maps_(maps), feedback_(feedback) {}
     339             : 
     340             :   CheckMapsFlags flags() const { return flags_; }
     341      287038 :   ZoneHandleSet<Map> const& maps() const { return maps_; }
     342       51503 :   VectorSlotPair const& feedback() const { return feedback_; }
     343             : 
     344             :  private:
     345             :   CheckMapsFlags const flags_;
     346             :   ZoneHandleSet<Map> const maps_;
     347             :   VectorSlotPair const feedback_;
     348             : };
     349             : 
     350             : bool operator==(CheckMapsParameters const&, CheckMapsParameters const&);
     351             : 
     352             : size_t hash_value(CheckMapsParameters const&);
     353             : 
     354             : std::ostream& operator<<(std::ostream&, CheckMapsParameters const&);
     355             : 
     356             : CheckMapsParameters const& CheckMapsParametersOf(Operator const*)
     357             :     V8_WARN_UNUSED_RESULT;
     358             : 
     359             : ZoneHandleSet<Map> const& MapGuardMapsOf(Operator const*) V8_WARN_UNUSED_RESULT;
     360             : 
     361             : // Parameters for CompareMaps operator.
     362             : ZoneHandleSet<Map> const& CompareMapsParametersOf(Operator const*)
     363             :     V8_WARN_UNUSED_RESULT;
     364             : 
     365             : // A descriptor for growing elements backing stores.
     366             : enum class GrowFastElementsMode : uint8_t {
     367             :   kDoubleElements,
     368             :   kSmiOrObjectElements
     369             : };
     370             : 
     371             : inline size_t hash_value(GrowFastElementsMode mode) {
     372           0 :   return static_cast<uint8_t>(mode);
     373             : }
     374             : 
     375             : std::ostream& operator<<(std::ostream&, GrowFastElementsMode);
     376             : 
     377             : class GrowFastElementsParameters {
     378             :  public:
     379             :   GrowFastElementsParameters(GrowFastElementsMode mode,
     380             :                              const VectorSlotPair& feedback)
     381       59606 :       : mode_(mode), feedback_(feedback) {}
     382             : 
     383             :   GrowFastElementsMode mode() const { return mode_; }
     384           0 :   const VectorSlotPair& feedback() const { return feedback_; }
     385             : 
     386             :  private:
     387             :   GrowFastElementsMode mode_;
     388             :   VectorSlotPair feedback_;
     389             : };
     390             : 
     391             : bool operator==(const GrowFastElementsParameters&,
     392             :                 const GrowFastElementsParameters&);
     393             : 
     394             : inline size_t hash_value(const GrowFastElementsParameters&);
     395             : 
     396             : std::ostream& operator<<(std::ostream&, const GrowFastElementsParameters&);
     397             : 
     398             : const GrowFastElementsParameters& GrowFastElementsParametersOf(const Operator*)
     399             :     V8_WARN_UNUSED_RESULT;
     400             : 
     401             : // A descriptor for elements kind transitions.
     402             : class ElementsTransition final {
     403             :  public:
     404             :   enum Mode : uint8_t {
     405             :     kFastTransition,  // simple transition, just updating the map.
     406             :     kSlowTransition   // full transition, round-trip to the runtime.
     407             :   };
     408             : 
     409             :   ElementsTransition(Mode mode, Handle<Map> source, Handle<Map> target)
     410         550 :       : mode_(mode), source_(source), target_(target) {}
     411             : 
     412             :   Mode mode() const { return mode_; }
     413             :   Handle<Map> source() const { return source_; }
     414             :   Handle<Map> target() const { return target_; }
     415             : 
     416             :  private:
     417             :   Mode const mode_;
     418             :   Handle<Map> const source_;
     419             :   Handle<Map> const target_;
     420             : };
     421             : 
     422             : bool operator==(ElementsTransition const&, ElementsTransition const&);
     423             : 
     424             : size_t hash_value(ElementsTransition);
     425             : 
     426             : std::ostream& operator<<(std::ostream&, ElementsTransition);
     427             : 
     428             : ElementsTransition const& ElementsTransitionOf(const Operator* op)
     429             :     V8_WARN_UNUSED_RESULT;
     430             : 
     431             : // Parameters for TransitionAndStoreElement, or
     432             : // TransitionAndStoreNonNumberElement, or
     433             : // TransitionAndStoreNumberElement.
     434             : Handle<Map> DoubleMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     435             : Handle<Map> FastMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     436             : 
     437             : // Parameters for TransitionAndStoreNonNumberElement.
     438             : Type ValueTypeParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     439             : 
     440             : // A hint for speculative number operations.
     441             : enum class NumberOperationHint : uint8_t {
     442             :   kSignedSmall,        // Inputs were Smi, output was in Smi.
     443             :   kSignedSmallInputs,  // Inputs were Smi, output was Number.
     444             :   kSigned32,           // Inputs were Signed32, output was Number.
     445             :   kNumber,             // Inputs were Number, output was Number.
     446             :   kNumberOrOddball,    // Inputs were Number or Oddball, output was Number.
     447             : };
     448             : 
     449             : size_t hash_value(NumberOperationHint);
     450             : 
     451             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, NumberOperationHint);
     452             : 
     453             : V8_EXPORT_PRIVATE NumberOperationHint NumberOperationHintOf(const Operator* op)
     454             :     V8_WARN_UNUSED_RESULT;
     455             : 
     456             : class NumberOperationParameters {
     457             :  public:
     458             :   NumberOperationParameters(NumberOperationHint hint,
     459             :                             const VectorSlotPair& feedback)
     460      173343 :       : hint_(hint), feedback_(feedback) {}
     461             : 
     462             :   NumberOperationHint hint() const { return hint_; }
     463      133199 :   const VectorSlotPair& feedback() const { return feedback_; }
     464             : 
     465             :  private:
     466             :   NumberOperationHint hint_;
     467             :   VectorSlotPair feedback_;
     468             : };
     469             : 
     470             : size_t hash_value(NumberOperationParameters const&);
     471             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
     472             :                                            const NumberOperationParameters&);
     473             : bool operator==(NumberOperationParameters const&,
     474             :                 NumberOperationParameters const&);
     475             : const NumberOperationParameters& NumberOperationParametersOf(const Operator* op)
     476             :     V8_WARN_UNUSED_RESULT;
     477             : 
     478             : int FormalParameterCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     479             : bool IsRestLengthOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     480             : 
     481             : class AllocateParameters {
     482             :  public:
     483             :   AllocateParameters(Type type, AllocationType allocation_type)
     484             :       : type_(type), allocation_type_(allocation_type) {}
     485             : 
     486             :   Type type() const { return type_; }
     487             :   AllocationType allocation_type() const { return allocation_type_; }
     488             : 
     489             :  private:
     490             :   Type type_;
     491             :   AllocationType allocation_type_;
     492             : };
     493             : 
     494             : bool IsCheckedWithFeedback(const Operator* op);
     495             : 
     496             : size_t hash_value(AllocateParameters);
     497             : 
     498             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, AllocateParameters);
     499             : 
     500             : bool operator==(AllocateParameters const&, AllocateParameters const&);
     501             : 
     502             : AllocationType AllocationTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     503             : 
     504             : Type AllocateTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     505             : 
     506             : UnicodeEncoding UnicodeEncodingOf(const Operator*) V8_WARN_UNUSED_RESULT;
     507             : 
     508             : AbortReason AbortReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     509             : 
     510             : DeoptimizeReason DeoptimizeReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     511             : 
     512             : int NewArgumentsElementsMappedCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
     513             : 
     514             : // Interface for building simplified operators, which represent the
     515             : // medium-level operations of V8, including adding numbers, allocating objects,
     516             : // indexing into objects and arrays, etc.
     517             : // All operators are typed but many are representation independent.
     518             : 
     519             : // Number values from JS can be in one of these representations:
     520             : //   - Tagged: word-sized integer that is either
     521             : //     - a signed small integer (31 or 32 bits plus a tag)
     522             : //     - a tagged pointer to a HeapNumber object that has a float64 field
     523             : //   - Int32: an untagged signed 32-bit integer
     524             : //   - Uint32: an untagged unsigned 32-bit integer
     525             : //   - Float64: an untagged float64
     526             : 
     527             : // Additional representations for intermediate code or non-JS code:
     528             : //   - Int64: an untagged signed 64-bit integer
     529             : //   - Uint64: an untagged unsigned 64-bit integer
     530             : //   - Float32: an untagged float32
     531             : 
     532             : // Boolean values can be:
     533             : //   - Bool: a tagged pointer to either the canonical JS #false or
     534             : //           the canonical JS #true object
     535             : //   - Bit: an untagged integer 0 or 1, but word-sized
     536             : class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
     537             :     : public NON_EXPORTED_BASE(ZoneObject) {
     538             :  public:
     539             :   explicit SimplifiedOperatorBuilder(Zone* zone);
     540             : 
     541             :   const Operator* BooleanNot();
     542             : 
     543             :   const Operator* NumberEqual();
     544             :   const Operator* NumberSameValue();
     545             :   const Operator* NumberLessThan();
     546             :   const Operator* NumberLessThanOrEqual();
     547             :   const Operator* NumberAdd();
     548             :   const Operator* NumberSubtract();
     549             :   const Operator* NumberMultiply();
     550             :   const Operator* NumberDivide();
     551             :   const Operator* NumberModulus();
     552             :   const Operator* NumberBitwiseOr();
     553             :   const Operator* NumberBitwiseXor();
     554             :   const Operator* NumberBitwiseAnd();
     555             :   const Operator* NumberShiftLeft();
     556             :   const Operator* NumberShiftRight();
     557             :   const Operator* NumberShiftRightLogical();
     558             :   const Operator* NumberImul();
     559             :   const Operator* NumberAbs();
     560             :   const Operator* NumberClz32();
     561             :   const Operator* NumberCeil();
     562             :   const Operator* NumberFloor();
     563             :   const Operator* NumberFround();
     564             :   const Operator* NumberAcos();
     565             :   const Operator* NumberAcosh();
     566             :   const Operator* NumberAsin();
     567             :   const Operator* NumberAsinh();
     568             :   const Operator* NumberAtan();
     569             :   const Operator* NumberAtan2();
     570             :   const Operator* NumberAtanh();
     571             :   const Operator* NumberCbrt();
     572             :   const Operator* NumberCos();
     573             :   const Operator* NumberCosh();
     574             :   const Operator* NumberExp();
     575             :   const Operator* NumberExpm1();
     576             :   const Operator* NumberLog();
     577             :   const Operator* NumberLog1p();
     578             :   const Operator* NumberLog10();
     579             :   const Operator* NumberLog2();
     580             :   const Operator* NumberMax();
     581             :   const Operator* NumberMin();
     582             :   const Operator* NumberPow();
     583             :   const Operator* NumberRound();
     584             :   const Operator* NumberSign();
     585             :   const Operator* NumberSin();
     586             :   const Operator* NumberSinh();
     587             :   const Operator* NumberSqrt();
     588             :   const Operator* NumberTan();
     589             :   const Operator* NumberTanh();
     590             :   const Operator* NumberTrunc();
     591             :   const Operator* NumberToBoolean();
     592             :   const Operator* NumberToInt32();
     593             :   const Operator* NumberToString();
     594             :   const Operator* NumberToUint32();
     595             :   const Operator* NumberToUint8Clamped();
     596             : 
     597             :   const Operator* NumberSilenceNaN();
     598             : 
     599             :   const Operator* SpeculativeSafeIntegerAdd(NumberOperationHint hint);
     600             :   const Operator* SpeculativeSafeIntegerSubtract(NumberOperationHint hint);
     601             : 
     602             :   const Operator* SpeculativeNumberAdd(NumberOperationHint hint);
     603             :   const Operator* SpeculativeNumberSubtract(NumberOperationHint hint);
     604             :   const Operator* SpeculativeNumberMultiply(NumberOperationHint hint);
     605             :   const Operator* SpeculativeNumberDivide(NumberOperationHint hint);
     606             :   const Operator* SpeculativeNumberModulus(NumberOperationHint hint);
     607             :   const Operator* SpeculativeNumberShiftLeft(NumberOperationHint hint);
     608             :   const Operator* SpeculativeNumberShiftRight(NumberOperationHint hint);
     609             :   const Operator* SpeculativeNumberShiftRightLogical(NumberOperationHint hint);
     610             :   const Operator* SpeculativeNumberBitwiseAnd(NumberOperationHint hint);
     611             :   const Operator* SpeculativeNumberBitwiseOr(NumberOperationHint hint);
     612             :   const Operator* SpeculativeNumberBitwiseXor(NumberOperationHint hint);
     613             : 
     614             :   const Operator* SpeculativeNumberLessThan(NumberOperationHint hint);
     615             :   const Operator* SpeculativeNumberLessThanOrEqual(NumberOperationHint hint);
     616             :   const Operator* SpeculativeNumberEqual(NumberOperationHint hint);
     617             : 
     618             :   const Operator* ReferenceEqual();
     619             :   const Operator* SameValue();
     620             : 
     621             :   const Operator* TypeOf();
     622             : 
     623             :   const Operator* ToBoolean();
     624             : 
     625             :   const Operator* StringConcat();
     626             :   const Operator* StringEqual();
     627             :   const Operator* StringLessThan();
     628             :   const Operator* StringLessThanOrEqual();
     629             :   const Operator* StringCharCodeAt();
     630             :   const Operator* StringCodePointAt(UnicodeEncoding encoding);
     631             :   const Operator* StringFromSingleCharCode();
     632             :   const Operator* StringFromSingleCodePoint(UnicodeEncoding encoding);
     633             :   const Operator* StringIndexOf();
     634             :   const Operator* StringLength();
     635             :   const Operator* StringToLowerCaseIntl();
     636             :   const Operator* StringToUpperCaseIntl();
     637             :   const Operator* StringSubstring();
     638             : 
     639             :   const Operator* FindOrderedHashMapEntry();
     640             :   const Operator* FindOrderedHashMapEntryForInt32Key();
     641             : 
     642             :   const Operator* SpeculativeToNumber(NumberOperationHint hint,
     643             :                                       const VectorSlotPair& feedback);
     644             : 
     645             :   const Operator* StringToNumber();
     646             :   const Operator* PlainPrimitiveToNumber();
     647             :   const Operator* PlainPrimitiveToWord32();
     648             :   const Operator* PlainPrimitiveToFloat64();
     649             : 
     650             :   const Operator* ChangeTaggedSignedToInt32();
     651             :   const Operator* ChangeTaggedSignedToInt64();
     652             :   const Operator* ChangeTaggedToInt32();
     653             :   const Operator* ChangeTaggedToInt64();
     654             :   const Operator* ChangeTaggedToUint32();
     655             :   const Operator* ChangeTaggedToFloat64();
     656             :   const Operator* ChangeTaggedToTaggedSigned();
     657             :   const Operator* ChangeCompressedToTaggedSigned();
     658             :   const Operator* ChangeTaggedToCompressedSigned();
     659             :   const Operator* ChangeInt31ToTaggedSigned();
     660             :   const Operator* ChangeInt32ToTagged();
     661             :   const Operator* ChangeInt64ToTagged();
     662             :   const Operator* ChangeUint32ToTagged();
     663             :   const Operator* ChangeUint64ToTagged();
     664             :   const Operator* ChangeFloat64ToTagged(CheckForMinusZeroMode);
     665             :   const Operator* ChangeFloat64ToTaggedPointer();
     666             :   const Operator* ChangeTaggedToBit();
     667             :   const Operator* ChangeBitToTagged();
     668             :   const Operator* TruncateTaggedToWord32();
     669             :   const Operator* TruncateTaggedToFloat64();
     670             :   const Operator* TruncateTaggedToBit();
     671             :   const Operator* TruncateTaggedPointerToBit();
     672             : 
     673             :   const Operator* PoisonIndex();
     674             :   const Operator* CompareMaps(ZoneHandleSet<Map>);
     675             :   const Operator* MapGuard(ZoneHandleSet<Map> maps);
     676             : 
     677             :   const Operator* CheckBounds(const VectorSlotPair& feedback);
     678             :   const Operator* CheckEqualsInternalizedString();
     679             :   const Operator* CheckEqualsSymbol();
     680             :   const Operator* CheckFloat64Hole(CheckFloat64HoleMode, VectorSlotPair const&);
     681             :   const Operator* CheckHeapObject();
     682             :   const Operator* CheckIf(DeoptimizeReason deoptimize_reason,
     683             :                           const VectorSlotPair& feedback = VectorSlotPair());
     684             :   const Operator* CheckMaps(CheckMapsFlags, ZoneHandleSet<Map>,
     685             :                             const VectorSlotPair& = VectorSlotPair());
     686             :   const Operator* CheckNotTaggedHole();
     687             :   const Operator* CheckNumber(const VectorSlotPair& feedback);
     688             :   const Operator* CheckReceiver();
     689             :   const Operator* CheckReceiverOrNullOrUndefined();
     690             :   const Operator* CheckSmi(const VectorSlotPair& feedback);
     691             :   const Operator* CheckInternalizedString();
     692             :   const Operator* CheckNonEmptyString();
     693             :   const Operator* CheckNonEmptyOneByteString();
     694             :   const Operator* CheckNonEmptyTwoByteString();
     695             :   const Operator* CheckString(const VectorSlotPair& feedback);
     696             :   const Operator* CheckSymbol();
     697             : 
     698             :   const Operator* CheckedFloat64ToInt32(CheckForMinusZeroMode,
     699             :                                         const VectorSlotPair& feedback);
     700             :   const Operator* CheckedFloat64ToInt64(CheckForMinusZeroMode,
     701             :                                         const VectorSlotPair& feedback);
     702             :   const Operator* CheckedInt32Add();
     703             :   const Operator* CheckedInt32Div();
     704             :   const Operator* CheckedInt32Mod();
     705             :   const Operator* CheckedInt32Mul(CheckForMinusZeroMode);
     706             :   const Operator* CheckedInt32Sub();
     707             :   const Operator* CheckedInt32ToTaggedSigned(const VectorSlotPair& feedback);
     708             :   const Operator* CheckedInt64ToInt32(const VectorSlotPair& feedback);
     709             :   const Operator* CheckedInt64ToTaggedSigned(const VectorSlotPair& feedback);
     710             :   const Operator* CheckedTaggedSignedToInt32(const VectorSlotPair& feedback);
     711             :   const Operator* CheckedTaggedToFloat64(CheckTaggedInputMode,
     712             :                                          const VectorSlotPair& feedback);
     713             :   const Operator* CheckedTaggedToInt32(CheckForMinusZeroMode,
     714             :                                        const VectorSlotPair& feedback);
     715             :   const Operator* CheckedTaggedToInt64(CheckForMinusZeroMode,
     716             :                                        const VectorSlotPair& feedback);
     717             :   const Operator* CheckedTaggedToTaggedPointer(const VectorSlotPair& feedback);
     718             :   const Operator* CheckedTaggedToTaggedSigned(const VectorSlotPair& feedback);
     719             :   const Operator* CheckedCompressedToTaggedPointer(
     720             :       const VectorSlotPair& feedback);
     721             :   const Operator* CheckedCompressedToTaggedSigned(
     722             :       const VectorSlotPair& feedback);
     723             :   const Operator* CheckedTaggedToCompressedPointer(
     724             :       const VectorSlotPair& feedback);
     725             :   const Operator* CheckedTaggedToCompressedSigned(
     726             :       const VectorSlotPair& feedback);
     727             :   const Operator* CheckedTruncateTaggedToWord32(CheckTaggedInputMode,
     728             :                                                 const VectorSlotPair& feedback);
     729             :   const Operator* CheckedUint32Div();
     730             :   const Operator* CheckedUint32Mod();
     731             :   const Operator* CheckedUint32Bounds(const VectorSlotPair& feedback,
     732             :                                       CheckBoundsParameters::Mode mode);
     733             :   const Operator* CheckedUint32ToInt32(const VectorSlotPair& feedback);
     734             :   const Operator* CheckedUint32ToTaggedSigned(const VectorSlotPair& feedback);
     735             :   const Operator* CheckedUint64Bounds(const VectorSlotPair& feedback);
     736             :   const Operator* CheckedUint64ToInt32(const VectorSlotPair& feedback);
     737             :   const Operator* CheckedUint64ToTaggedSigned(const VectorSlotPair& feedback);
     738             : 
     739             :   const Operator* ConvertReceiver(ConvertReceiverMode);
     740             : 
     741             :   const Operator* ConvertTaggedHoleToUndefined();
     742             : 
     743             :   const Operator* ObjectIsArrayBufferView();
     744             :   const Operator* ObjectIsBigInt();
     745             :   const Operator* ObjectIsCallable();
     746             :   const Operator* ObjectIsConstructor();
     747             :   const Operator* ObjectIsDetectableCallable();
     748             :   const Operator* ObjectIsMinusZero();
     749             :   const Operator* NumberIsMinusZero();
     750             :   const Operator* ObjectIsNaN();
     751             :   const Operator* NumberIsNaN();
     752             :   const Operator* ObjectIsNonCallable();
     753             :   const Operator* ObjectIsNumber();
     754             :   const Operator* ObjectIsReceiver();
     755             :   const Operator* ObjectIsSmi();
     756             :   const Operator* ObjectIsString();
     757             :   const Operator* ObjectIsSymbol();
     758             :   const Operator* ObjectIsUndetectable();
     759             : 
     760             :   const Operator* NumberIsFloat64Hole();
     761             :   const Operator* NumberIsFinite();
     762             :   const Operator* ObjectIsFiniteNumber();
     763             :   const Operator* NumberIsInteger();
     764             :   const Operator* ObjectIsSafeInteger();
     765             :   const Operator* NumberIsSafeInteger();
     766             :   const Operator* ObjectIsInteger();
     767             : 
     768             :   const Operator* ArgumentsFrame();
     769             :   const Operator* ArgumentsLength(int formal_parameter_count,
     770             :                                   bool is_rest_length);
     771             : 
     772             :   const Operator* NewDoubleElements(AllocationType);
     773             :   const Operator* NewSmiOrObjectElements(AllocationType);
     774             : 
     775             :   // new-arguments-elements arguments-frame, arguments-length
     776             :   const Operator* NewArgumentsElements(int mapped_count);
     777             : 
     778             :   // new-cons-string length, first, second
     779             :   const Operator* NewConsOneByteString();
     780             :   const Operator* NewConsTwoByteString();
     781             :   const Operator* NewConsString();
     782             : 
     783             :   // ensure-writable-fast-elements object, elements
     784             :   const Operator* EnsureWritableFastElements();
     785             : 
     786             :   // maybe-grow-fast-elements object, elements, index, length
     787             :   const Operator* MaybeGrowFastElements(GrowFastElementsMode mode,
     788             :                                         const VectorSlotPair& feedback);
     789             : 
     790             :   // transition-elements-kind object, from-map, to-map
     791             :   const Operator* TransitionElementsKind(ElementsTransition transition);
     792             : 
     793             :   const Operator* Allocate(Type type,
     794             :                            AllocationType allocation = AllocationType::kYoung);
     795             :   const Operator* AllocateRaw(
     796             :       Type type, AllocationType allocation = AllocationType::kYoung);
     797             : 
     798             :   const Operator* LoadFieldByIndex();
     799             :   const Operator* LoadField(FieldAccess const&);
     800             :   const Operator* StoreField(FieldAccess const&);
     801             : 
     802             :   const Operator* LoadMessage();
     803             :   const Operator* StoreMessage();
     804             : 
     805             :   // load-element [base + index]
     806             :   const Operator* LoadElement(ElementAccess const&);
     807             : 
     808             :   // load-stack-argument [base + index]
     809             :   const Operator* LoadStackArgument();
     810             : 
     811             :   // store-element [base + index], value
     812             :   const Operator* StoreElement(ElementAccess const&);
     813             : 
     814             :   // store-element [base + index], value, only with fast arrays.
     815             :   const Operator* TransitionAndStoreElement(Handle<Map> double_map,
     816             :                                             Handle<Map> fast_map);
     817             :   // store-element [base + index], smi value, only with fast arrays.
     818             :   const Operator* StoreSignedSmallElement();
     819             : 
     820             :   // store-element [base + index], double value, only with fast arrays.
     821             :   const Operator* TransitionAndStoreNumberElement(Handle<Map> double_map);
     822             : 
     823             :   // store-element [base + index], object value, only with fast arrays.
     824             :   const Operator* TransitionAndStoreNonNumberElement(Handle<Map> fast_map,
     825             :                                                      Type value_type);
     826             : 
     827             :   // load-typed-element buffer, [base + external + index]
     828             :   const Operator* LoadTypedElement(ExternalArrayType const&);
     829             : 
     830             :   // load-data-view-element buffer, [base + byte_offset + index]
     831             :   const Operator* LoadDataViewElement(ExternalArrayType const&);
     832             : 
     833             :   // store-typed-element buffer, [base + external + index], value
     834             :   const Operator* StoreTypedElement(ExternalArrayType const&);
     835             : 
     836             :   // store-data-view-element buffer, [base + byte_offset + index], value
     837             :   const Operator* StoreDataViewElement(ExternalArrayType const&);
     838             : 
     839             :   // Abort (for terminating execution on internal error).
     840             :   const Operator* RuntimeAbort(AbortReason reason);
     841             : 
     842             :   const Operator* DateNow();
     843             : 
     844             :  private:
     845             :   Zone* zone() const { return zone_; }
     846             : 
     847             :   const SimplifiedOperatorGlobalCache& cache_;
     848             :   Zone* const zone_;
     849             : 
     850             :   DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder);
     851             : };
     852             : 
     853             : }  // namespace compiler
     854             : }  // namespace internal
     855             : }  // namespace v8
     856             : 
     857             : #endif  // V8_COMPILER_SIMPLIFIED_OPERATOR_H_

Generated by: LCOV version 1.10