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

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

Issue 602563002: [turbofan] Add length operand to LoadElement and StoreElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 years, 3 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-operator.h ('k') | src/compiler/simplified-operator-unittest.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/compiler/simplified-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/types-inl.h" 10 #include "src/types-inl.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 OStream& operator<<(OStream& os, BaseTaggedness base_taggedness) {
17 switch (base_taggedness) {
18 case kUntaggedBase:
19 return os << "untagged base";
20 case kTaggedBase:
21 return os << "tagged base";
22 }
23 UNREACHABLE();
24 return os;
25 }
26
27
28 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) {
29 return lhs.base_is_tagged == rhs.base_is_tagged &&
30 lhs.header_size == rhs.header_size && lhs.type == rhs.type &&
31 lhs.machine_type == rhs.machine_type;
32 }
33
34
35 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) {
36 return !(lhs == rhs);
37 }
38
39
40 OStream& operator<<(OStream& os, ElementAccess const& access) {
41 os << "[" << access.base_is_tagged << ", " << access.header_size << ", ";
42 access.type->PrintTo(os);
43 os << ", " << access.machine_type << "]";
44 return os;
45 }
46
47
16 const FieldAccess& FieldAccessOf(const Operator* op) { 48 const FieldAccess& FieldAccessOf(const Operator* op) {
17 DCHECK_NOT_NULL(op); 49 DCHECK_NOT_NULL(op);
18 DCHECK(op->opcode() == IrOpcode::kLoadField || 50 DCHECK(op->opcode() == IrOpcode::kLoadField ||
19 op->opcode() == IrOpcode::kStoreField); 51 op->opcode() == IrOpcode::kStoreField);
20 return OpParameter<FieldAccess>(op); 52 return OpParameter<FieldAccess>(op);
21 } 53 }
22 54
23 55
24 const ElementAccess& ElementAccessOf(const Operator* op) { 56 const ElementAccess& ElementAccessOf(const Operator* op) {
25 DCHECK_NOT_NULL(op); 57 DCHECK_NOT_NULL(op);
(...skipping 16 matching lines...) Expand all
42 return lhs.base_is_tagged == rhs.base_is_tagged && 74 return lhs.base_is_tagged == rhs.base_is_tagged &&
43 lhs.offset == rhs.offset && lhs.machine_type == rhs.machine_type && 75 lhs.offset == rhs.offset && lhs.machine_type == rhs.machine_type &&
44 lhs.type->Is(rhs.type); 76 lhs.type->Is(rhs.type);
45 } 77 }
46 }; 78 };
47 79
48 80
49 // Specialization for static parameters of type {ElementAccess}. 81 // Specialization for static parameters of type {ElementAccess}.
50 template <> 82 template <>
51 struct StaticParameterTraits<ElementAccess> { 83 struct StaticParameterTraits<ElementAccess> {
52 static OStream& PrintTo(OStream& os, const ElementAccess& val) { 84 static OStream& PrintTo(OStream& os, const ElementAccess& access) {
53 return os << val.header_size; 85 return os << access;
54 } 86 }
55 static int HashCode(const ElementAccess& val) { 87 static int HashCode(const ElementAccess& access) {
56 return (val.header_size < 16) | (val.machine_type & 0xffff); 88 return (access.header_size < 16) | (access.machine_type & 0xffff);
57 } 89 }
58 static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs) { 90 static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs) {
59 return lhs.base_is_tagged == rhs.base_is_tagged && 91 return lhs.base_is_tagged == rhs.base_is_tagged &&
60 lhs.header_size == rhs.header_size && 92 lhs.header_size == rhs.header_size &&
61 lhs.machine_type == rhs.machine_type && lhs.type->Is(rhs.type); 93 lhs.machine_type == rhs.machine_type && lhs.type->Is(rhs.type);
62 } 94 }
63 }; 95 };
64 96
65 97
66 #define PURE_OP_LIST(V) \ 98 #define PURE_OP_LIST(V) \
(...skipping 19 matching lines...) Expand all
86 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \ 118 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \
87 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \ 119 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \
88 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \ 120 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \
89 V(ChangeBoolToBit, Operator::kNoProperties, 1) \ 121 V(ChangeBoolToBit, Operator::kNoProperties, 1) \
90 V(ChangeBitToBool, Operator::kNoProperties, 1) 122 V(ChangeBitToBool, Operator::kNoProperties, 1)
91 123
92 124
93 #define ACCESS_OP_LIST(V) \ 125 #define ACCESS_OP_LIST(V) \
94 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1) \ 126 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1) \
95 V(StoreField, FieldAccess, Operator::kNoRead, 2, 0) \ 127 V(StoreField, FieldAccess, Operator::kNoRead, 2, 0) \
96 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1) \ 128 V(LoadElement, ElementAccess, Operator::kNoWrite, 3, 1) \
97 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 0) 129 V(StoreElement, ElementAccess, Operator::kNoRead, 4, 0)
98 130
99 131
100 struct SimplifiedOperatorBuilderImpl FINAL { 132 struct SimplifiedOperatorBuilderImpl FINAL {
101 #define PURE(Name, properties, input_count) \ 133 #define PURE(Name, properties, input_count) \
102 struct Name##Operator FINAL : public SimpleOperator { \ 134 struct Name##Operator FINAL : public SimpleOperator { \
103 Name##Operator() \ 135 Name##Operator() \
104 : SimpleOperator(IrOpcode::k##Name, Operator::kPure | properties, \ 136 : SimpleOperator(IrOpcode::k##Name, Operator::kPure | properties, \
105 input_count, 1, #Name) {} \ 137 input_count, 1, #Name) {} \
106 }; \ 138 }; \
107 Name##Operator k##Name; 139 Name##Operator k##Name;
(...skipping 29 matching lines...) Expand all
137 return new (zone()) \ 169 return new (zone()) \
138 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ 170 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
139 input_count, output_count, #Name, access); \ 171 input_count, output_count, #Name, access); \
140 } 172 }
141 ACCESS_OP_LIST(ACCESS) 173 ACCESS_OP_LIST(ACCESS)
142 #undef ACCESS 174 #undef ACCESS
143 175
144 } // namespace compiler 176 } // namespace compiler
145 } // namespace internal 177 } // namespace internal
146 } // namespace v8 178 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/simplified-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698