OLD | NEW |
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 #include "src/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 0, 0, kInputCount, 0, 0, 1) {} // counts | 197 0, 0, kInputCount, 0, 0, 1) {} // counts |
198 }; | 198 }; |
199 #define CACHED_MERGE(input_count) \ | 199 #define CACHED_MERGE(input_count) \ |
200 MergeOperator<input_count> kMerge##input_count##Operator; | 200 MergeOperator<input_count> kMerge##input_count##Operator; |
201 CACHED_MERGE_LIST(CACHED_MERGE) | 201 CACHED_MERGE_LIST(CACHED_MERGE) |
202 #undef CACHED_MERGE | 202 #undef CACHED_MERGE |
203 | 203 |
204 template <int kIndex> | 204 template <int kIndex> |
205 struct ParameterOperator FINAL : public Operator1<int> { | 205 struct ParameterOperator FINAL : public Operator1<int> { |
206 ParameterOperator() | 206 ParameterOperator() |
207 : Operator1<int>( // -- | 207 : Operator1<int>( // -- |
208 IrOpcode::kParameter, Operator::kPure, // opcode | 208 IrOpcode::kParameter, // opcode |
209 "Parameter", // name | 209 Operator::kFoldable | Operator::kNoThrow, // flags |
210 1, 0, 0, 1, 0, 0, // counts, | 210 "Parameter", // name |
211 kIndex) {} // parameter | 211 1, 0, 0, 1, 0, 0, // counts, |
| 212 kIndex) {} // parameter |
212 }; | 213 }; |
213 #define CACHED_PARAMETER(index) \ | 214 #define CACHED_PARAMETER(index) \ |
214 ParameterOperator<index> kParameter##index##Operator; | 215 ParameterOperator<index> kParameter##index##Operator; |
215 CACHED_PARAMETER_LIST(CACHED_PARAMETER) | 216 CACHED_PARAMETER_LIST(CACHED_PARAMETER) |
216 #undef CACHED_PARAMETER | 217 #undef CACHED_PARAMETER |
217 }; | 218 }; |
218 | 219 |
219 | 220 |
220 static base::LazyInstance<CommonOperatorGlobalCache>::type kCache = | 221 static base::LazyInstance<CommonOperatorGlobalCache>::type kCache = |
221 LAZY_INSTANCE_INITIALIZER; | 222 LAZY_INSTANCE_INITIALIZER; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 switch (index) { | 300 switch (index) { |
300 #define CACHED_PARAMETER(index) \ | 301 #define CACHED_PARAMETER(index) \ |
301 case index: \ | 302 case index: \ |
302 return &cache_.kParameter##index##Operator; | 303 return &cache_.kParameter##index##Operator; |
303 CACHED_PARAMETER_LIST(CACHED_PARAMETER) | 304 CACHED_PARAMETER_LIST(CACHED_PARAMETER) |
304 #undef CACHED_PARAMETER | 305 #undef CACHED_PARAMETER |
305 default: | 306 default: |
306 break; | 307 break; |
307 } | 308 } |
308 // Uncached. | 309 // Uncached. |
309 return new (zone()) Operator1<int>( // -- | 310 return new (zone()) Operator1<int>( // -- |
310 IrOpcode::kParameter, Operator::kPure, // opcode | 311 IrOpcode::kParameter, // opcode |
311 "Parameter", // name | 312 Operator::kFoldable | Operator::kNoThrow, // flags |
312 1, 0, 0, 1, 0, 0, // counts | 313 "Parameter", // name |
313 index); // parameter | 314 1, 0, 0, 1, 0, 0, // counts |
| 315 index); // parameter |
314 } | 316 } |
315 | 317 |
316 | 318 |
317 const Operator* CommonOperatorBuilder::OsrValue(int index) { | 319 const Operator* CommonOperatorBuilder::OsrValue(int index) { |
318 return new (zone()) Operator1<int>( // -- | 320 return new (zone()) Operator1<int>( // -- |
319 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode | 321 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode |
320 "OsrValue", // name | 322 "OsrValue", // name |
321 0, 0, 1, 1, 0, 0, // counts | 323 0, 0, 1, 1, 0, 0, // counts |
322 index); // parameter | 324 index); // parameter |
323 } | 325 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } else { | 510 } else { |
509 UNREACHABLE(); | 511 UNREACHABLE(); |
510 return nullptr; | 512 return nullptr; |
511 } | 513 } |
512 } | 514 } |
513 | 515 |
514 | 516 |
515 } // namespace compiler | 517 } // namespace compiler |
516 } // namespace internal | 518 } // namespace internal |
517 } // namespace v8 | 519 } // namespace v8 |
OLD | NEW |