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/unique.h" | 10 #include "src/unique.h" |
11 #include "src/zone.h" | 11 #include "src/zone.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 namespace compiler { | 15 namespace compiler { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // TODO(turbofan): Use size_t instead of int here. | 19 // TODO(turbofan): Use size_t instead of int here. |
20 class ControlOperator : public Operator1<int> { | 20 class ControlOperator : public Operator1<int> { |
21 public: | 21 public: |
22 ControlOperator(IrOpcode::Value opcode, Properties properties, int inputs, | 22 ControlOperator(IrOpcode::Value opcode, Properties properties, int inputs, |
23 int outputs, int controls, const char* mnemonic) | 23 int outputs, int controls, const char* mnemonic) |
24 : Operator1<int>(opcode, properties, inputs, outputs, mnemonic, | 24 : Operator1<int>(opcode, properties, inputs, outputs, mnemonic, |
25 controls) {} | 25 controls) {} |
26 | 26 |
27 virtual OStream& PrintParameter(OStream& os) const FINAL { return os; } | 27 virtual std::ostream& PrintParameter(std::ostream& os) const FINAL { |
| 28 return os; |
| 29 } |
28 }; | 30 }; |
29 | 31 |
30 } // namespace | 32 } // namespace |
31 | 33 |
32 | 34 |
33 // Specialization for static parameters of type {ExternalReference}. | 35 // Specialization for static parameters of type {ExternalReference}. |
34 template <> | 36 template <> |
35 struct StaticParameterTraits<ExternalReference> { | 37 struct StaticParameterTraits<ExternalReference> { |
36 static OStream& PrintTo(OStream& os, ExternalReference reference) { | 38 static std::ostream& PrintTo(std::ostream& os, ExternalReference reference) { |
37 os << reference.address(); | 39 os << reference.address(); |
38 // TODO(bmeurer): Move to operator<<(os, ExternalReference) | 40 // TODO(bmeurer): Move to operator<<(os, ExternalReference) |
39 const Runtime::Function* function = | 41 const Runtime::Function* function = |
40 Runtime::FunctionForEntry(reference.address()); | 42 Runtime::FunctionForEntry(reference.address()); |
41 if (function) { | 43 if (function) { |
42 os << " <" << function->name << ".entry>"; | 44 os << " <" << function->name << ".entry>"; |
43 } | 45 } |
44 return os; | 46 return os; |
45 } | 47 } |
46 static int HashCode(ExternalReference reference) { | 48 static int HashCode(ExternalReference reference) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // TODO(titzer): Operator still uses int, whereas CallDescriptor uses | 229 // TODO(titzer): Operator still uses int, whereas CallDescriptor uses |
228 // size_t. | 230 // size_t. |
229 CallOperator(const CallDescriptor* descriptor, const char* mnemonic) | 231 CallOperator(const CallDescriptor* descriptor, const char* mnemonic) |
230 : Operator1<const CallDescriptor*>( | 232 : Operator1<const CallDescriptor*>( |
231 IrOpcode::kCall, descriptor->properties(), | 233 IrOpcode::kCall, descriptor->properties(), |
232 static_cast<int>(descriptor->InputCount() + | 234 static_cast<int>(descriptor->InputCount() + |
233 descriptor->FrameStateCount()), | 235 descriptor->FrameStateCount()), |
234 static_cast<int>(descriptor->ReturnCount()), mnemonic, | 236 static_cast<int>(descriptor->ReturnCount()), mnemonic, |
235 descriptor) {} | 237 descriptor) {} |
236 | 238 |
237 virtual OStream& PrintParameter(OStream& os) const OVERRIDE { | 239 virtual std::ostream& PrintParameter(std::ostream& os) const OVERRIDE { |
238 return os << "[" << *parameter() << "]"; | 240 return os << "[" << *parameter() << "]"; |
239 } | 241 } |
240 }; | 242 }; |
241 return new (zone()) CallOperator(descriptor, "Call"); | 243 return new (zone()) CallOperator(descriptor, "Call"); |
242 } | 244 } |
243 | 245 |
244 | 246 |
245 const Operator* CommonOperatorBuilder::Projection(size_t index) { | 247 const Operator* CommonOperatorBuilder::Projection(size_t index) { |
246 return new (zone()) Operator1<size_t>(IrOpcode::kProjection, Operator::kPure, | 248 return new (zone()) Operator1<size_t>(IrOpcode::kProjection, Operator::kPure, |
247 1, 1, "Projection", index); | 249 1, 1, "Projection", index); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 289 } |
288 | 290 |
289 | 291 |
290 bool OutputFrameStateCombine::IsOutputIgnored() { | 292 bool OutputFrameStateCombine::IsOutputIgnored() { |
291 return kind() == kPushOutput && GetPushCount() == 0; | 293 return kind() == kPushOutput && GetPushCount() == 0; |
292 } | 294 } |
293 | 295 |
294 } // namespace compiler | 296 } // namespace compiler |
295 } // namespace internal | 297 } // namespace internal |
296 } // namespace v8 | 298 } // namespace v8 |
OLD | NEW |