| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
| 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/base/compiler-specific.h" |
| 10 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
| 11 #include "src/compiler/types.h" | 12 #include "src/compiler/types.h" |
| 13 #include "src/globals.h" |
| 12 #include "src/handles.h" | 14 #include "src/handles.h" |
| 13 #include "src/machine-type.h" | 15 #include "src/machine-type.h" |
| 14 #include "src/objects.h" | 16 #include "src/objects.h" |
| 15 | 17 |
| 16 namespace v8 { | 18 namespace v8 { |
| 17 namespace internal { | 19 namespace internal { |
| 18 | 20 |
| 19 // Forward declarations. | 21 // Forward declarations. |
| 20 class Zone; | 22 class Zone; |
| 21 | 23 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 explicit BufferAccess(ExternalArrayType external_array_type) | 40 explicit BufferAccess(ExternalArrayType external_array_type) |
| 39 : external_array_type_(external_array_type) {} | 41 : external_array_type_(external_array_type) {} |
| 40 | 42 |
| 41 ExternalArrayType external_array_type() const { return external_array_type_; } | 43 ExternalArrayType external_array_type() const { return external_array_type_; } |
| 42 MachineType machine_type() const; | 44 MachineType machine_type() const; |
| 43 | 45 |
| 44 private: | 46 private: |
| 45 ExternalArrayType const external_array_type_; | 47 ExternalArrayType const external_array_type_; |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 bool operator==(BufferAccess, BufferAccess); | 50 V8_EXPORT_PRIVATE bool operator==(BufferAccess, BufferAccess); |
| 49 bool operator!=(BufferAccess, BufferAccess); | 51 bool operator!=(BufferAccess, BufferAccess); |
| 50 | 52 |
| 51 size_t hash_value(BufferAccess); | 53 size_t hash_value(BufferAccess); |
| 52 | 54 |
| 53 std::ostream& operator<<(std::ostream&, BufferAccess); | 55 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, BufferAccess); |
| 54 | 56 |
| 55 BufferAccess const BufferAccessOf(const Operator* op) WARN_UNUSED_RESULT; | 57 V8_EXPORT_PRIVATE BufferAccess const BufferAccessOf(const Operator* op) |
| 56 | 58 WARN_UNUSED_RESULT; |
| 57 | 59 |
| 58 // An access descriptor for loads/stores of fixed structures like field | 60 // An access descriptor for loads/stores of fixed structures like field |
| 59 // accesses of heap objects. Accesses from either tagged or untagged base | 61 // accesses of heap objects. Accesses from either tagged or untagged base |
| 60 // pointers are supported; untagging is done automatically during lowering. | 62 // pointers are supported; untagging is done automatically during lowering. |
| 61 struct FieldAccess { | 63 struct FieldAccess { |
| 62 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. | 64 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. |
| 63 int offset; // offset of the field, without tag. | 65 int offset; // offset of the field, without tag. |
| 64 MaybeHandle<Name> name; // debugging only. | 66 MaybeHandle<Name> name; // debugging only. |
| 65 Type* type; // type of the field. | 67 Type* type; // type of the field. |
| 66 MachineType machine_type; // machine type of the field. | 68 MachineType machine_type; // machine type of the field. |
| 67 WriteBarrierKind write_barrier_kind; // write barrier hint. | 69 WriteBarrierKind write_barrier_kind; // write barrier hint. |
| 68 | 70 |
| 69 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } | 71 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 bool operator==(FieldAccess const&, FieldAccess const&); | 74 V8_EXPORT_PRIVATE bool operator==(FieldAccess const&, FieldAccess const&); |
| 73 bool operator!=(FieldAccess const&, FieldAccess const&); | 75 bool operator!=(FieldAccess const&, FieldAccess const&); |
| 74 | 76 |
| 75 size_t hash_value(FieldAccess const&); | 77 size_t hash_value(FieldAccess const&); |
| 76 | 78 |
| 77 std::ostream& operator<<(std::ostream&, FieldAccess const&); | 79 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, FieldAccess const&); |
| 78 | 80 |
| 79 FieldAccess const& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT; | 81 FieldAccess const& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT; |
| 80 | 82 |
| 81 template <> | 83 template <> |
| 82 void Operator1<FieldAccess>::PrintParameter(std::ostream& os, | 84 void Operator1<FieldAccess>::PrintParameter(std::ostream& os, |
| 83 PrintVerbosity verbose) const; | 85 PrintVerbosity verbose) const; |
| 84 | 86 |
| 85 // An access descriptor for loads/stores of indexed structures like characters | 87 // An access descriptor for loads/stores of indexed structures like characters |
| 86 // in strings or off-heap backing stores. Accesses from either tagged or | 88 // in strings or off-heap backing stores. Accesses from either tagged or |
| 87 // untagged base pointers are supported; untagging is done automatically during | 89 // untagged base pointers are supported; untagging is done automatically during |
| 88 // lowering. | 90 // lowering. |
| 89 struct ElementAccess { | 91 struct ElementAccess { |
| 90 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. | 92 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. |
| 91 int header_size; // size of the header, without tag. | 93 int header_size; // size of the header, without tag. |
| 92 Type* type; // type of the element. | 94 Type* type; // type of the element. |
| 93 MachineType machine_type; // machine type of the element. | 95 MachineType machine_type; // machine type of the element. |
| 94 WriteBarrierKind write_barrier_kind; // write barrier hint. | 96 WriteBarrierKind write_barrier_kind; // write barrier hint. |
| 95 | 97 |
| 96 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } | 98 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 bool operator==(ElementAccess const&, ElementAccess const&); | 101 V8_EXPORT_PRIVATE bool operator==(ElementAccess const&, ElementAccess const&); |
| 100 bool operator!=(ElementAccess const&, ElementAccess const&); | 102 bool operator!=(ElementAccess const&, ElementAccess const&); |
| 101 | 103 |
| 102 size_t hash_value(ElementAccess const&); | 104 size_t hash_value(ElementAccess const&); |
| 103 | 105 |
| 104 std::ostream& operator<<(std::ostream&, ElementAccess const&); | 106 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ElementAccess const&); |
| 105 | 107 |
| 106 ElementAccess const& ElementAccessOf(const Operator* op) WARN_UNUSED_RESULT; | 108 V8_EXPORT_PRIVATE ElementAccess const& ElementAccessOf(const Operator* op) |
| 109 WARN_UNUSED_RESULT; |
| 107 | 110 |
| 108 ExternalArrayType ExternalArrayTypeOf(const Operator* op) WARN_UNUSED_RESULT; | 111 ExternalArrayType ExternalArrayTypeOf(const Operator* op) WARN_UNUSED_RESULT; |
| 109 | 112 |
| 110 enum class CheckFloat64HoleMode : uint8_t { | 113 enum class CheckFloat64HoleMode : uint8_t { |
| 111 kNeverReturnHole, // Never return the hole (deoptimize instead). | 114 kNeverReturnHole, // Never return the hole (deoptimize instead). |
| 112 kAllowReturnHole // Allow to return the hole (signaling NaN). | 115 kAllowReturnHole // Allow to return the hole (signaling NaN). |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 size_t hash_value(CheckFloat64HoleMode); | 118 size_t hash_value(CheckFloat64HoleMode); |
| 116 | 119 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // A hint for speculative number operations. | 174 // A hint for speculative number operations. |
| 172 enum class NumberOperationHint : uint8_t { | 175 enum class NumberOperationHint : uint8_t { |
| 173 kSignedSmall, // Inputs were always Smi so far, output was in Smi range. | 176 kSignedSmall, // Inputs were always Smi so far, output was in Smi range. |
| 174 kSigned32, // Inputs and output were Signed32 so far. | 177 kSigned32, // Inputs and output were Signed32 so far. |
| 175 kNumber, // Inputs were Number, output was Number. | 178 kNumber, // Inputs were Number, output was Number. |
| 176 kNumberOrOddball, // Inputs were Number or Oddball, output was Number. | 179 kNumberOrOddball, // Inputs were Number or Oddball, output was Number. |
| 177 }; | 180 }; |
| 178 | 181 |
| 179 size_t hash_value(NumberOperationHint); | 182 size_t hash_value(NumberOperationHint); |
| 180 | 183 |
| 181 std::ostream& operator<<(std::ostream&, NumberOperationHint); | 184 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, NumberOperationHint); |
| 182 | 185 |
| 183 NumberOperationHint NumberOperationHintOf(const Operator* op) | 186 NumberOperationHint NumberOperationHintOf(const Operator* op) |
| 184 WARN_UNUSED_RESULT; | 187 WARN_UNUSED_RESULT; |
| 185 | 188 |
| 186 PretenureFlag PretenureFlagOf(const Operator* op) WARN_UNUSED_RESULT; | 189 PretenureFlag PretenureFlagOf(const Operator* op) WARN_UNUSED_RESULT; |
| 187 | 190 |
| 188 UnicodeEncoding UnicodeEncodingOf(const Operator*) WARN_UNUSED_RESULT; | 191 UnicodeEncoding UnicodeEncodingOf(const Operator*) WARN_UNUSED_RESULT; |
| 189 | 192 |
| 190 // Interface for building simplified operators, which represent the | 193 // Interface for building simplified operators, which represent the |
| 191 // medium-level operations of V8, including adding numbers, allocating objects, | 194 // medium-level operations of V8, including adding numbers, allocating objects, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 202 | 205 |
| 203 // Additional representations for intermediate code or non-JS code: | 206 // Additional representations for intermediate code or non-JS code: |
| 204 // - Int64: an untagged signed 64-bit integer | 207 // - Int64: an untagged signed 64-bit integer |
| 205 // - Uint64: an untagged unsigned 64-bit integer | 208 // - Uint64: an untagged unsigned 64-bit integer |
| 206 // - Float32: an untagged float32 | 209 // - Float32: an untagged float32 |
| 207 | 210 |
| 208 // Boolean values can be: | 211 // Boolean values can be: |
| 209 // - Bool: a tagged pointer to either the canonical JS #false or | 212 // - Bool: a tagged pointer to either the canonical JS #false or |
| 210 // the canonical JS #true object | 213 // the canonical JS #true object |
| 211 // - Bit: an untagged integer 0 or 1, but word-sized | 214 // - Bit: an untagged integer 0 or 1, but word-sized |
| 212 class SimplifiedOperatorBuilder final : public ZoneObject { | 215 class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final |
| 216 : public NON_EXPORTED_BASE(ZoneObject) { |
| 213 public: | 217 public: |
| 214 explicit SimplifiedOperatorBuilder(Zone* zone); | 218 explicit SimplifiedOperatorBuilder(Zone* zone); |
| 215 | 219 |
| 216 const Operator* BooleanNot(); | 220 const Operator* BooleanNot(); |
| 217 | 221 |
| 218 const Operator* NumberEqual(); | 222 const Operator* NumberEqual(); |
| 219 const Operator* NumberLessThan(); | 223 const Operator* NumberLessThan(); |
| 220 const Operator* NumberLessThanOrEqual(); | 224 const Operator* NumberLessThanOrEqual(); |
| 221 const Operator* NumberAdd(); | 225 const Operator* NumberAdd(); |
| 222 const Operator* NumberSubtract(); | 226 const Operator* NumberSubtract(); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 Zone* const zone_; | 394 Zone* const zone_; |
| 391 | 395 |
| 392 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); | 396 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); |
| 393 }; | 397 }; |
| 394 | 398 |
| 395 } // namespace compiler | 399 } // namespace compiler |
| 396 } // namespace internal | 400 } // namespace internal |
| 397 } // namespace v8 | 401 } // namespace v8 |
| 398 | 402 |
| 399 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 403 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
| OLD | NEW |