| 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 "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
| 9 #include "src/handles.h" | 9 #include "src/handles.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace compiler { | 22 namespace compiler { |
| 23 | 23 |
| 24 // Forward declarations. | 24 // Forward declarations. |
| 25 class Operator; | 25 class Operator; |
| 26 struct SimplifiedOperatorBuilderImpl; | 26 struct SimplifiedOperatorBuilderImpl; |
| 27 | 27 |
| 28 | 28 |
| 29 enum BaseTaggedness { kUntaggedBase, kTaggedBase }; | 29 enum BaseTaggedness { kUntaggedBase, kTaggedBase }; |
| 30 | 30 |
| 31 OStream& operator<<(OStream&, BaseTaggedness); |
| 32 |
| 31 // An access descriptor for loads/stores of fixed structures like field | 33 // An access descriptor for loads/stores of fixed structures like field |
| 32 // accesses of heap objects. Accesses from either tagged or untagged base | 34 // accesses of heap objects. Accesses from either tagged or untagged base |
| 33 // pointers are supported; untagging is done automatically during lowering. | 35 // pointers are supported; untagging is done automatically during lowering. |
| 34 struct FieldAccess { | 36 struct FieldAccess { |
| 35 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. | 37 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. |
| 36 int offset; // offset of the field, without tag. | 38 int offset; // offset of the field, without tag. |
| 37 Handle<Name> name; // debugging only. | 39 Handle<Name> name; // debugging only. |
| 38 Type* type; // type of the field. | 40 Type* type; // type of the field. |
| 39 MachineType machine_type; // machine type of the field. | 41 MachineType machine_type; // machine type of the field. |
| 40 | 42 |
| 41 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } | 43 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 | 46 |
| 45 // An access descriptor for loads/stores of indexed structures like characters | 47 // An access descriptor for loads/stores of indexed structures like characters |
| 46 // in strings or off-heap backing stores. Accesses from either tagged or | 48 // in strings or off-heap backing stores. Accesses from either tagged or |
| 47 // untagged base pointers are supported; untagging is done automatically during | 49 // untagged base pointers are supported; untagging is done automatically during |
| 48 // lowering. | 50 // lowering. |
| 49 struct ElementAccess { | 51 struct ElementAccess { |
| 50 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. | 52 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. |
| 51 int header_size; // size of the header, without tag. | 53 int header_size; // size of the header, without tag. |
| 52 Type* type; // type of the element. | 54 Type* type; // type of the element. |
| 53 MachineType machine_type; // machine type of the element. | 55 MachineType machine_type; // machine type of the element. |
| 54 | 56 |
| 55 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } | 57 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } |
| 56 }; | 58 }; |
| 57 | 59 |
| 60 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs); |
| 61 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs); |
| 62 |
| 63 OStream& operator<<(OStream&, ElementAccess const&); |
| 64 |
| 58 | 65 |
| 59 // If the accessed object is not a heap object, add this to the header_size. | 66 // If the accessed object is not a heap object, add this to the header_size. |
| 60 static const int kNonHeapObjectHeaderSize = kHeapObjectTag; | 67 static const int kNonHeapObjectHeaderSize = kHeapObjectTag; |
| 61 | 68 |
| 62 | 69 |
| 63 const FieldAccess& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT; | 70 const FieldAccess& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT; |
| 64 const ElementAccess& ElementAccessOf(const Operator* op) WARN_UNUSED_RESULT; | 71 const ElementAccess& ElementAccessOf(const Operator* op) WARN_UNUSED_RESULT; |
| 65 | 72 |
| 66 | 73 |
| 67 // Interface for building simplified operators, which represent the | 74 // Interface for building simplified operators, which represent the |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 const Operator* ChangeTaggedToUint32(); | 122 const Operator* ChangeTaggedToUint32(); |
| 116 const Operator* ChangeTaggedToFloat64(); | 123 const Operator* ChangeTaggedToFloat64(); |
| 117 const Operator* ChangeInt32ToTagged(); | 124 const Operator* ChangeInt32ToTagged(); |
| 118 const Operator* ChangeUint32ToTagged(); | 125 const Operator* ChangeUint32ToTagged(); |
| 119 const Operator* ChangeFloat64ToTagged(); | 126 const Operator* ChangeFloat64ToTagged(); |
| 120 const Operator* ChangeBoolToBit(); | 127 const Operator* ChangeBoolToBit(); |
| 121 const Operator* ChangeBitToBool(); | 128 const Operator* ChangeBitToBool(); |
| 122 | 129 |
| 123 const Operator* LoadField(const FieldAccess&); | 130 const Operator* LoadField(const FieldAccess&); |
| 124 const Operator* StoreField(const FieldAccess&); | 131 const Operator* StoreField(const FieldAccess&); |
| 125 const Operator* LoadElement(const ElementAccess&); | 132 |
| 126 const Operator* StoreElement(const ElementAccess&); | 133 // load-element [base + index], length |
| 134 const Operator* LoadElement(ElementAccess const&); |
| 135 |
| 136 // store-element [base + index], length, value |
| 137 const Operator* StoreElement(ElementAccess const&); |
| 127 | 138 |
| 128 private: | 139 private: |
| 129 Zone* zone() const { return zone_; } | 140 Zone* zone() const { return zone_; } |
| 130 | 141 |
| 131 const SimplifiedOperatorBuilderImpl& impl_; | 142 const SimplifiedOperatorBuilderImpl& impl_; |
| 132 Zone* const zone_; | 143 Zone* const zone_; |
| 133 | 144 |
| 134 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); | 145 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); |
| 135 }; | 146 }; |
| 136 | 147 |
| 137 } // namespace compiler | 148 } // namespace compiler |
| 138 } // namespace internal | 149 } // namespace internal |
| 139 } // namespace v8 | 150 } // namespace v8 |
| 140 | 151 |
| 141 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 152 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
| OLD | NEW |