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/compiler/machine-type.h" | 10 #include "src/compiler/machine-type.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Forward declarations. | 26 // Forward declarations. |
27 class Operator; | 27 class Operator; |
28 struct SimplifiedOperatorBuilderImpl; | 28 struct SimplifiedOperatorBuilderImpl; |
29 | 29 |
30 | 30 |
31 enum BaseTaggedness { kUntaggedBase, kTaggedBase }; | 31 enum BaseTaggedness { kUntaggedBase, kTaggedBase }; |
32 | 32 |
33 std::ostream& operator<<(std::ostream&, BaseTaggedness); | 33 std::ostream& operator<<(std::ostream&, BaseTaggedness); |
34 | 34 |
| 35 |
35 // An access descriptor for loads/stores of fixed structures like field | 36 // An access descriptor for loads/stores of fixed structures like field |
36 // accesses of heap objects. Accesses from either tagged or untagged base | 37 // accesses of heap objects. Accesses from either tagged or untagged base |
37 // pointers are supported; untagging is done automatically during lowering. | 38 // pointers are supported; untagging is done automatically during lowering. |
38 struct FieldAccess { | 39 struct FieldAccess { |
39 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. | 40 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. |
40 int offset; // offset of the field, without tag. | 41 int offset; // offset of the field, without tag. |
41 MaybeHandle<Name> name; // debugging only. | 42 MaybeHandle<Name> name; // debugging only. |
42 Type* type; // type of the field. | 43 Type* type; // type of the field. |
43 MachineType machine_type; // machine type of the field. | 44 MachineType machine_type; // machine type of the field. |
44 | 45 |
45 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } | 46 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } |
46 }; | 47 }; |
47 | 48 |
48 bool operator==(FieldAccess const& lhs, FieldAccess const& rhs); | 49 bool operator==(FieldAccess const&, FieldAccess const&); |
49 bool operator!=(FieldAccess const& lhs, FieldAccess const& rhs); | 50 bool operator!=(FieldAccess const&, FieldAccess const&); |
| 51 |
| 52 size_t hash_value(FieldAccess const&); |
50 | 53 |
51 std::ostream& operator<<(std::ostream&, FieldAccess const&); | 54 std::ostream& operator<<(std::ostream&, FieldAccess const&); |
52 | 55 |
53 | 56 |
| 57 // The bound checking mode for ElementAccess below. |
54 enum BoundsCheckMode { kNoBoundsCheck, kTypedArrayBoundsCheck }; | 58 enum BoundsCheckMode { kNoBoundsCheck, kTypedArrayBoundsCheck }; |
55 | 59 |
56 std::ostream& operator<<(std::ostream&, BoundsCheckMode); | 60 std::ostream& operator<<(std::ostream&, BoundsCheckMode); |
57 | 61 |
58 | 62 |
59 // An access descriptor for loads/stores of indexed structures like characters | 63 // An access descriptor for loads/stores of indexed structures like characters |
60 // in strings or off-heap backing stores. Accesses from either tagged or | 64 // in strings or off-heap backing stores. Accesses from either tagged or |
61 // untagged base pointers are supported; untagging is done automatically during | 65 // untagged base pointers are supported; untagging is done automatically during |
62 // lowering. | 66 // lowering. |
63 struct ElementAccess { | 67 struct ElementAccess { |
64 BoundsCheckMode bounds_check; // specifies the bounds checking mode. | 68 BoundsCheckMode bounds_check; // specifies the bounds checking mode. |
65 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. | 69 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. |
66 int header_size; // size of the header, without tag. | 70 int header_size; // size of the header, without tag. |
67 Type* type; // type of the element. | 71 Type* type; // type of the element. |
68 MachineType machine_type; // machine type of the element. | 72 MachineType machine_type; // machine type of the element. |
69 | 73 |
70 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } | 74 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } |
71 }; | 75 }; |
72 | 76 |
73 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs); | 77 bool operator==(ElementAccess const&, ElementAccess const&); |
74 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs); | 78 bool operator!=(ElementAccess const&, ElementAccess const&); |
| 79 |
| 80 size_t hash_value(ElementAccess const&); |
75 | 81 |
76 std::ostream& operator<<(std::ostream&, ElementAccess const&); | 82 std::ostream& operator<<(std::ostream&, ElementAccess const&); |
77 | 83 |
78 | 84 |
79 // If the accessed object is not a heap object, add this to the header_size. | 85 // If the accessed object is not a heap object, add this to the header_size. |
80 static const int kNonHeapObjectHeaderSize = kHeapObjectTag; | 86 static const int kNonHeapObjectHeaderSize = kHeapObjectTag; |
81 | 87 |
82 | 88 |
83 const FieldAccess& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT; | 89 const FieldAccess& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT; |
84 const ElementAccess& ElementAccessOf(const Operator* op) WARN_UNUSED_RESULT; | 90 const ElementAccess& ElementAccessOf(const Operator* op) WARN_UNUSED_RESULT; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 Zone* const zone_; | 162 Zone* const zone_; |
157 | 163 |
158 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); | 164 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); |
159 }; | 165 }; |
160 | 166 |
161 } // namespace compiler | 167 } // namespace compiler |
162 } // namespace internal | 168 } // namespace internal |
163 } // namespace v8 | 169 } // namespace v8 |
164 | 170 |
165 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 171 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
OLD | NEW |