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

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

Issue 680313003: Move input/output counts directly into Operators, simplying OperatorProperties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 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"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 V(ObjectIsNonNegativeSmi, Operator::kNoProperties, 1) 140 V(ObjectIsNonNegativeSmi, Operator::kNoProperties, 1)
141 141
142 142
143 #define ACCESS_OP_LIST(V) \ 143 #define ACCESS_OP_LIST(V) \
144 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1) \ 144 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1) \
145 V(StoreField, FieldAccess, Operator::kNoRead, 2, 0) \ 145 V(StoreField, FieldAccess, Operator::kNoRead, 2, 0) \
146 V(LoadElement, ElementAccess, Operator::kNoWrite, 3, 1) \ 146 V(LoadElement, ElementAccess, Operator::kNoWrite, 3, 1) \
147 V(StoreElement, ElementAccess, Operator::kNoRead, 4, 0) 147 V(StoreElement, ElementAccess, Operator::kNoRead, 4, 0)
148 148
149 149
150 struct SimplifiedOperatorBuilderImpl FINAL { 150 struct SimplifiedOperatorGlobalCache FINAL {
151 #define PURE(Name, properties, input_count) \ 151 #define PURE(Name, properties, input_count) \
152 struct Name##Operator FINAL : public SimpleOperator { \ 152 struct Name##Operator FINAL : public Operator { \
153 Name##Operator() \ 153 Name##Operator() \
154 : SimpleOperator(IrOpcode::k##Name, Operator::kPure | properties, \ 154 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
155 input_count, 1, #Name) {} \ 155 input_count, 0, 0, 1, 0, 0) {} \
156 }; \ 156 }; \
157 Name##Operator k##Name; 157 Name##Operator k##Name;
158 PURE_OP_LIST(PURE) 158 PURE_OP_LIST(PURE)
159 #undef PURE 159 #undef PURE
160 }; 160 };
161 161
162 162
163 static base::LazyInstance<SimplifiedOperatorBuilderImpl>::type kImpl = 163 static base::LazyInstance<SimplifiedOperatorGlobalCache>::type kCache =
164 LAZY_INSTANCE_INITIALIZER; 164 LAZY_INSTANCE_INITIALIZER;
165 165
166 166
167 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) 167 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
168 : impl_(kImpl.Get()), zone_(zone) {} 168 : cache_(kCache.Get()), zone_(zone) {}
169 169
170 170
171 #define PURE(Name, properties, input_count) \ 171 #define PURE(Name, properties, input_count) \
172 const Operator* SimplifiedOperatorBuilder::Name() { return &impl_.k##Name; } 172 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; }
173 PURE_OP_LIST(PURE) 173 PURE_OP_LIST(PURE)
174 #undef PURE 174 #undef PURE
175 175
176 176
177 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { 177 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) {
178 // TODO(titzer): What about the type parameter? 178 // TODO(titzer): What about the type parameter?
179 return new (zone()) SimpleOperator(IrOpcode::kReferenceEqual, 179 return new (zone()) Operator(IrOpcode::kReferenceEqual,
180 Operator::kCommutative | Operator::kPure, 180 Operator::kCommutative | Operator::kPure,
181 2, 1, "ReferenceEqual"); 181 "ReferenceEqual", 2, 0, 0, 1, 0, 0);
182 } 182 }
183 183
184 184
185 #define ACCESS(Name, Type, properties, input_count, output_count) \ 185 #define ACCESS(Name, Type, properties, input_count, output_count) \
186 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ 186 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \
187 return new (zone()) \ 187 return new (zone()) \
188 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ 188 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
189 input_count, output_count, #Name, access); \ 189 #Name, input_count, 1, 1, output_count, 1, 0, access); \
190 } 190 }
191 ACCESS_OP_LIST(ACCESS) 191 ACCESS_OP_LIST(ACCESS)
192 #undef ACCESS 192 #undef ACCESS
193 193
194 } // namespace compiler 194 } // namespace compiler
195 } // namespace internal 195 } // namespace internal
196 } // namespace v8 196 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698