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/js-operator.h" | 5 #include "src/compiler/js-operator.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/lazy-instance.h" | 9 #include "src/base/lazy-instance.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
11 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 namespace compiler { | 15 namespace compiler { |
16 | 16 |
17 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { | 17 bool operator==(CallFunctionParameters const& lhs, |
18 return os << p.arity() << ", " << p.flags() << ", " << p.language_mode(); | 18 CallFunctionParameters const& rhs) { |
| 19 return lhs.arity() == rhs.arity() && lhs.flags() == rhs.flags(); |
19 } | 20 } |
20 | 21 |
21 | 22 |
| 23 bool operator!=(CallFunctionParameters const& lhs, |
| 24 CallFunctionParameters const& rhs) { |
| 25 return !(lhs == rhs); |
| 26 } |
| 27 |
| 28 |
| 29 size_t hash_value(CallFunctionParameters const& p) { |
| 30 return base::hash_combine(p.arity(), p.flags()); |
| 31 } |
| 32 |
| 33 |
| 34 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { |
| 35 return os << p.arity() << ", " << p.flags(); |
| 36 } |
| 37 |
| 38 |
22 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { | 39 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { |
23 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); | 40 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); |
24 return OpParameter<CallFunctionParameters>(op); | 41 return OpParameter<CallFunctionParameters>(op); |
25 } | 42 } |
26 | 43 |
27 | 44 |
28 bool operator==(CallRuntimeParameters const& lhs, | 45 bool operator==(CallRuntimeParameters const& lhs, |
29 CallRuntimeParameters const& rhs) { | 46 CallRuntimeParameters const& rhs) { |
30 return lhs.id() == rhs.id() && lhs.arity() == rhs.arity(); | 47 return lhs.id() == rhs.id() && lhs.arity() == rhs.arity(); |
31 } | 48 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 break; /* %*!%^$#@ */ \ | 347 break; /* %*!%^$#@ */ \ |
331 } \ | 348 } \ |
332 UNREACHABLE(); \ | 349 UNREACHABLE(); \ |
333 return nullptr; \ | 350 return nullptr; \ |
334 } | 351 } |
335 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) | 352 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) |
336 #undef CACHED_WITH_LANGUAGE_MODE | 353 #undef CACHED_WITH_LANGUAGE_MODE |
337 | 354 |
338 | 355 |
339 const Operator* JSOperatorBuilder::CallFunction(size_t arity, | 356 const Operator* JSOperatorBuilder::CallFunction(size_t arity, |
340 CallFunctionFlags flags, | 357 CallFunctionFlags flags) { |
341 LanguageMode language_mode) { | 358 CallFunctionParameters parameters(arity, flags); |
342 CallFunctionParameters parameters(arity, flags, language_mode); | |
343 return new (zone()) Operator1<CallFunctionParameters>( // -- | 359 return new (zone()) Operator1<CallFunctionParameters>( // -- |
344 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode | 360 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode |
345 "JSCallFunction", // name | 361 "JSCallFunction", // name |
346 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 362 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
347 parameters); // parameter | 363 parameters); // parameter |
348 } | 364 } |
349 | 365 |
350 | 366 |
351 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, | 367 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, |
352 size_t arity) { | 368 size_t arity) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 return new (zone()) Operator1<Unique<String>>( // -- | 470 return new (zone()) Operator1<Unique<String>>( // -- |
455 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 471 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
456 "JSCreateCatchContext", // name | 472 "JSCreateCatchContext", // name |
457 2, 1, 1, 1, 1, 2, // counts | 473 2, 1, 1, 1, 1, 2, // counts |
458 name); // parameter | 474 name); // parameter |
459 } | 475 } |
460 | 476 |
461 } // namespace compiler | 477 } // namespace compiler |
462 } // namespace internal | 478 } // namespace internal |
463 } // namespace v8 | 479 } // namespace v8 |
OLD | NEW |