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