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

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: 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
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 // An access descriptor for loads/stores of fixed structures like field
17 // like field accesses of heap objects. 17 // accesses of heap objects. Accesses from either tagged or untagged base
18 // pointers are supported; untagging is done automatically during lowering.
18 struct FieldAccess { 19 struct FieldAccess {
19 int offset; 20 bool base_is_tagged; // {true} if the base pointer is tagged.
20 Handle<Name> name; // debug only. 21 int offset; // offset of the field, without tag.
21 Type* type; 22 Handle<Name> name; // debugging only.
22 MachineRepresentation representation; 23 Type* type; // type of the field.
24 MachineRepresentation representation; // machine representation of field.
23 }; 25 };
24 26
25 27
26 // An access descriptor for loads/stores of indexed structures 28 // An access descriptor for loads/stores of indexed structures like characters
27 // like characters in strings or off-heap backing stores. 29 // in strings or off-heap backing stores. Accesses from either tagged or
30 // untagged base pointers are supported; untagging is done automatically during
31 // lowering.
28 struct ElementAccess { 32 struct ElementAccess {
29 int header_size; 33 bool base_is_tagged; // {true} if the base pointer is tagged.
30 Type* type; 34 int header_size; // size of the header, without tag.
31 MachineRepresentation representation; 35 Type* type; // type of the element.
36 MachineRepresentation representation; // machine representation of element.
32 }; 37 };
33 38
34 39
35 // If the accessed object is not a heap object, add this to the header_size. 40 // If the accessed object is not a heap object, add this to the header_size.
36 static const int kNonHeapObjectHeaderSize = kHeapObjectTag; 41 static const int kNonHeapObjectHeaderSize = kHeapObjectTag;
37 42
38 43
39 // Specialization for static parameters of type {FieldAccess}. 44 // Specialization for static parameters of type {FieldAccess}.
40 template <> 45 template <>
41 struct StaticParameterTraits<const FieldAccess> { 46 struct StaticParameterTraits<const FieldAccess> {
42 static OStream& PrintTo(OStream& os, const FieldAccess& val) { // NOLINT 47 static OStream& PrintTo(OStream& os, const FieldAccess& val) { // NOLINT
43 return os << val.offset; 48 return os << val.offset;
44 } 49 }
45 static int HashCode(const FieldAccess& val) { 50 static int HashCode(const FieldAccess& val) {
46 return (val.offset < 16) | (val.representation & 0xffff); 51 return (val.offset < 16) | (val.representation & 0xffff);
47 } 52 }
48 static bool Equals(const FieldAccess& a, const FieldAccess& b) { 53 static bool Equals(const FieldAccess& a, const FieldAccess& b) {
49 return a.offset == b.offset && a.representation == b.representation && 54 return a.base_is_tagged == b.base_is_tagged && a.offset == b.offset &&
50 a.type->Is(b.type); 55 a.representation == b.representation && a.type->Is(b.type);
51 } 56 }
52 }; 57 };
53 58
54 59
55 // Specialization for static parameters of type {ElementAccess}. 60 // Specialization for static parameters of type {ElementAccess}.
56 template <> 61 template <>
57 struct StaticParameterTraits<const ElementAccess> { 62 struct StaticParameterTraits<const ElementAccess> {
58 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT 63 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT
59 return os << val.header_size; 64 return os << val.header_size;
60 } 65 }
61 static int HashCode(const ElementAccess& val) { 66 static int HashCode(const ElementAccess& val) {
62 return (val.header_size < 16) | (val.representation & 0xffff); 67 return (val.header_size < 16) | (val.representation & 0xffff);
63 } 68 }
64 static bool Equals(const ElementAccess& a, const ElementAccess& b) { 69 static bool Equals(const ElementAccess& a, const ElementAccess& b) {
65 return a.header_size == b.header_size && 70 return a.base_is_tagged == b.base_is_tagged &&
71 a.header_size == b.header_size &&
66 a.representation == b.representation && a.type->Is(b.type); 72 a.representation == b.representation && a.type->Is(b.type);
67 } 73 }
68 }; 74 };
69 75
70 76
71 inline const FieldAccess FieldAccessOf(Operator* op) { 77 inline const FieldAccess FieldAccessOf(Operator* op) {
72 ASSERT(op->opcode() == IrOpcode::kLoadField || 78 ASSERT(op->opcode() == IrOpcode::kLoadField ||
73 op->opcode() == IrOpcode::kStoreField); 79 op->opcode() == IrOpcode::kStoreField);
74 return static_cast<Operator1<FieldAccess>*>(op)->parameter(); 80 return static_cast<Operator1<FieldAccess>*>(op)->parameter();
75 } 81 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 #undef SIMPLE 174 #undef SIMPLE
169 175
170 private: 176 private:
171 Zone* zone_; 177 Zone* zone_;
172 }; 178 };
173 } 179 }
174 } 180 }
175 } // namespace v8::internal::compiler 181 } // namespace v8::internal::compiler
176 182
177 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ 183 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698