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

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

Issue 439223004: Add support for untagged LoadField, StoreField, LoadElement, and StoreElement simplfied operators. … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments. 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') | test/cctest/compiler/test-simplified-lowering.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 // An access descriptor for loads/stores from/to fixed structures 16 enum BaseTaggedness { kUntaggedBase, kTaggedBase };
17 // like field accesses of heap objects. 17
18 // An access descriptor for loads/stores of fixed structures like field
19 // accesses of heap objects. Accesses from either tagged or untagged base
20 // pointers are supported; untagging is done automatically during lowering.
18 struct FieldAccess { 21 struct FieldAccess {
19 int offset; 22 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
20 Handle<Name> name; // debug only. 23 int offset; // offset of the field, without tag.
21 Type* type; 24 Handle<Name> name; // debugging only.
22 MachineRepresentation representation; 25 Type* type; // type of the field.
26 MachineRepresentation representation; // machine representation of field.
27
28 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
23 }; 29 };
24 30
25 31
26 // An access descriptor for loads/stores of indexed structures 32 // An access descriptor for loads/stores of indexed structures like characters
27 // like characters in strings or off-heap backing stores. 33 // in strings or off-heap backing stores. Accesses from either tagged or
34 // untagged base pointers are supported; untagging is done automatically during
35 // lowering.
28 struct ElementAccess { 36 struct ElementAccess {
29 int header_size; 37 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
30 Type* type; 38 int header_size; // size of the header, without tag.
31 MachineRepresentation representation; 39 Type* type; // type of the element.
40 MachineRepresentation representation; // machine representation of element.
41
42 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
32 }; 43 };
33 44
34 45
35 // 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.
36 static const int kNonHeapObjectHeaderSize = kHeapObjectTag; 47 static const int kNonHeapObjectHeaderSize = kHeapObjectTag;
37 48
38 49
39 // Specialization for static parameters of type {FieldAccess}. 50 // Specialization for static parameters of type {FieldAccess}.
40 template <> 51 template <>
41 struct StaticParameterTraits<const FieldAccess> { 52 struct StaticParameterTraits<const FieldAccess> {
42 static OStream& PrintTo(OStream& os, const FieldAccess& val) { // NOLINT 53 static OStream& PrintTo(OStream& os, const FieldAccess& val) { // NOLINT
43 return os << val.offset; 54 return os << val.offset;
44 } 55 }
45 static int HashCode(const FieldAccess& val) { 56 static int HashCode(const FieldAccess& val) {
46 return (val.offset < 16) | (val.representation & 0xffff); 57 return (val.offset < 16) | (val.representation & 0xffff);
47 } 58 }
48 static bool Equals(const FieldAccess& a, const FieldAccess& b) { 59 static bool Equals(const FieldAccess& a, const FieldAccess& b) {
49 return a.offset == b.offset && a.representation == b.representation && 60 return a.base_is_tagged == b.base_is_tagged && a.offset == b.offset &&
50 a.type->Is(b.type); 61 a.representation == b.representation && a.type->Is(b.type);
51 } 62 }
52 }; 63 };
53 64
54 65
55 // Specialization for static parameters of type {ElementAccess}. 66 // Specialization for static parameters of type {ElementAccess}.
56 template <> 67 template <>
57 struct StaticParameterTraits<const ElementAccess> { 68 struct StaticParameterTraits<const ElementAccess> {
58 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT 69 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT
59 return os << val.header_size; 70 return os << val.header_size;
60 } 71 }
61 static int HashCode(const ElementAccess& val) { 72 static int HashCode(const ElementAccess& val) {
62 return (val.header_size < 16) | (val.representation & 0xffff); 73 return (val.header_size < 16) | (val.representation & 0xffff);
63 } 74 }
64 static bool Equals(const ElementAccess& a, const ElementAccess& b) { 75 static bool Equals(const ElementAccess& a, const ElementAccess& b) {
65 return a.header_size == b.header_size && 76 return a.base_is_tagged == b.base_is_tagged &&
77 a.header_size == b.header_size &&
66 a.representation == b.representation && a.type->Is(b.type); 78 a.representation == b.representation && a.type->Is(b.type);
67 } 79 }
68 }; 80 };
69 81
70 82
71 inline const FieldAccess FieldAccessOf(Operator* op) { 83 inline const FieldAccess FieldAccessOf(Operator* op) {
72 ASSERT(op->opcode() == IrOpcode::kLoadField || 84 ASSERT(op->opcode() == IrOpcode::kLoadField ||
73 op->opcode() == IrOpcode::kStoreField); 85 op->opcode() == IrOpcode::kStoreField);
74 return static_cast<Operator1<FieldAccess>*>(op)->parameter(); 86 return static_cast<Operator1<FieldAccess>*>(op)->parameter();
75 } 87 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 #undef SIMPLE 180 #undef SIMPLE
169 181
170 private: 182 private:
171 Zone* zone_; 183 Zone* zone_;
172 }; 184 };
173 } 185 }
174 } 186 }
175 } // namespace v8::internal::compiler 187 } // namespace v8::internal::compiler
176 188
177 #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') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698