Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(828)

Side by Side Diff: src/compiler/simplified-operator.h

Issue 470593002: Unify MachineType and RepType. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-operator.h" 8 #include "src/compiler/machine-operator.h"
9 #include "src/compiler/opcodes.h" 9 #include "src/compiler/opcodes.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 enum BaseTaggedness { kUntaggedBase, kTaggedBase }; 16 enum BaseTaggedness { kUntaggedBase, kTaggedBase };
17 17
18 // An access descriptor for loads/stores of fixed structures like field 18 // An access descriptor for loads/stores of fixed structures like field
19 // accesses of heap objects. Accesses from either tagged or untagged base 19 // accesses of heap objects. Accesses from either tagged or untagged base
20 // pointers are supported; untagging is done automatically during lowering. 20 // pointers are supported; untagging is done automatically during lowering.
21 struct FieldAccess { 21 struct FieldAccess {
22 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. 22 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
23 int offset; // offset of the field, without tag. 23 int offset; // offset of the field, without tag.
24 Handle<Name> name; // debugging only. 24 Handle<Name> name; // debugging only.
25 Type* type; // type of the field. 25 Type* type; // type of the field.
26 MachineType representation; // machine representation of field. 26 MachineType machine_type; // machine type of the field.
27 27
28 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } 28 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
29 }; 29 };
30 30
31 31
32 // An access descriptor for loads/stores of indexed structures like characters 32 // An access descriptor for loads/stores of indexed structures like characters
33 // in strings or off-heap backing stores. Accesses from either tagged or 33 // in strings or off-heap backing stores. Accesses from either tagged or
34 // untagged base pointers are supported; untagging is done automatically during 34 // untagged base pointers are supported; untagging is done automatically during
35 // lowering. 35 // lowering.
36 struct ElementAccess { 36 struct ElementAccess {
37 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. 37 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
38 int header_size; // size of the header, without tag. 38 int header_size; // size of the header, without tag.
39 Type* type; // type of the element. 39 Type* type; // type of the element.
40 MachineType representation; // machine representation of element. 40 MachineType machine_type; // machine type of the element.
41 41
42 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } 42 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
43 }; 43 };
44 44
45 45
46 // If the accessed object is not a heap object, add this to the header_size. 46 // If the accessed object is not a heap object, add this to the header_size.
47 static const int kNonHeapObjectHeaderSize = kHeapObjectTag; 47 static const int kNonHeapObjectHeaderSize = kHeapObjectTag;
48 48
49 49
50 // Specialization for static parameters of type {FieldAccess}. 50 // Specialization for static parameters of type {FieldAccess}.
51 template <> 51 template <>
52 struct StaticParameterTraits<const FieldAccess> { 52 struct StaticParameterTraits<const FieldAccess> {
53 static OStream& PrintTo(OStream& os, const FieldAccess& val) { // NOLINT 53 static OStream& PrintTo(OStream& os, const FieldAccess& val) { // NOLINT
54 return os << val.offset; 54 return os << val.offset;
55 } 55 }
56 static int HashCode(const FieldAccess& val) { 56 static int HashCode(const FieldAccess& val) {
57 return (val.offset < 16) | (val.representation & 0xffff); 57 return (val.offset < 16) | (val.machine_type & 0xffff);
58 } 58 }
59 static bool Equals(const FieldAccess& a, const FieldAccess& b) { 59 static bool Equals(const FieldAccess& a, const FieldAccess& b) {
60 return a.base_is_tagged == b.base_is_tagged && a.offset == b.offset && 60 return a.base_is_tagged == b.base_is_tagged && a.offset == b.offset &&
61 a.representation == b.representation && a.type->Is(b.type); 61 a.machine_type == b.machine_type && a.type->Is(b.type);
62 } 62 }
63 }; 63 };
64 64
65 65
66 // Specialization for static parameters of type {ElementAccess}. 66 // Specialization for static parameters of type {ElementAccess}.
67 template <> 67 template <>
68 struct StaticParameterTraits<const ElementAccess> { 68 struct StaticParameterTraits<const ElementAccess> {
69 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT 69 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT
70 return os << val.header_size; 70 return os << val.header_size;
71 } 71 }
72 static int HashCode(const ElementAccess& val) { 72 static int HashCode(const ElementAccess& val) {
73 return (val.header_size < 16) | (val.representation & 0xffff); 73 return (val.header_size < 16) | (val.machine_type & 0xffff);
74 } 74 }
75 static bool Equals(const ElementAccess& a, const ElementAccess& b) { 75 static bool Equals(const ElementAccess& a, const ElementAccess& b) {
76 return a.base_is_tagged == b.base_is_tagged && 76 return a.base_is_tagged == b.base_is_tagged &&
77 a.header_size == b.header_size && 77 a.header_size == b.header_size && a.machine_type == b.machine_type &&
78 a.representation == b.representation && a.type->Is(b.type); 78 a.type->Is(b.type);
79 } 79 }
80 }; 80 };
81 81
82 82
83 inline const FieldAccess FieldAccessOf(Operator* op) { 83 inline const FieldAccess FieldAccessOf(Operator* op) {
84 DCHECK(op->opcode() == IrOpcode::kLoadField || 84 DCHECK(op->opcode() == IrOpcode::kLoadField ||
85 op->opcode() == IrOpcode::kStoreField); 85 op->opcode() == IrOpcode::kStoreField);
86 return static_cast<Operator1<FieldAccess>*>(op)->parameter(); 86 return static_cast<Operator1<FieldAccess>*>(op)->parameter();
87 } 87 }
88 88
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 #undef SIMPLE 180 #undef SIMPLE
181 181
182 private: 182 private:
183 Zone* zone_; 183 Zone* zone_;
184 }; 184 };
185 } 185 }
186 } 186 }
187 } // namespace v8::internal::compiler 187 } // namespace v8::internal::compiler
188 188
189 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ 189 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698