| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { | 33 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { |
| 34 return !(lhs == rhs); | 34 return !(lhs == rhs); |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 size_t hash_value(VectorSlotPair const& p) { | 38 size_t hash_value(VectorSlotPair const& p) { |
| 39 return base::hash_combine(p.slot(), p.vector().location()); | 39 return base::hash_combine(p.slot(), p.vector().location()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 size_t hash_value(ConvertReceiverMode const& mode) { |
| 44 return base::hash_value(static_cast<int>(mode)); |
| 45 } |
| 46 |
| 47 |
| 48 std::ostream& operator<<(std::ostream& os, ConvertReceiverMode const& mode) { |
| 49 switch (mode) { |
| 50 case ConvertReceiverMode::kNullOrUndefined: |
| 51 return os << "NULL_OR_UNDEFINED"; |
| 52 case ConvertReceiverMode::kNotNullOrUndefined: |
| 53 return os << "NOT_NULL_OR_UNDEFINED"; |
| 54 case ConvertReceiverMode::kAny: |
| 55 return os << "ANY"; |
| 56 } |
| 57 UNREACHABLE(); |
| 58 return os; |
| 59 } |
| 60 |
| 61 |
| 43 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { | 62 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { |
| 44 os << p.arity() << ", " << p.flags() << ", " << p.language_mode(); | 63 os << p.arity() << ", " << p.flags() << ", " << p.language_mode(); |
| 45 if (p.AllowTailCalls()) { | 64 if (p.AllowTailCalls()) { |
| 46 os << ", ALLOW_TAIL_CALLS"; | 65 os << ", ALLOW_TAIL_CALLS"; |
| 47 } | 66 } |
| 48 return os; | 67 return os; |
| 49 } | 68 } |
| 50 | 69 |
| 51 | 70 |
| 52 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { | 71 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 default: \ | 508 default: \ |
| 490 break; /* %*!%^$#@ */ \ | 509 break; /* %*!%^$#@ */ \ |
| 491 } \ | 510 } \ |
| 492 UNREACHABLE(); \ | 511 UNREACHABLE(); \ |
| 493 return nullptr; \ | 512 return nullptr; \ |
| 494 } | 513 } |
| 495 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) | 514 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) |
| 496 #undef CACHED_WITH_LANGUAGE_MODE | 515 #undef CACHED_WITH_LANGUAGE_MODE |
| 497 | 516 |
| 498 | 517 |
| 499 const Operator* JSOperatorBuilder::CallFunction(size_t arity, | 518 const Operator* JSOperatorBuilder::CallFunction( |
| 500 CallFunctionFlags flags, | 519 size_t arity, CallFunctionFlags flags, LanguageMode language_mode, |
| 501 LanguageMode language_mode, | 520 VectorSlotPair const& feedback, ConvertReceiverMode convert_mode, |
| 502 VectorSlotPair const& feedback, | 521 TailCallMode tail_call_mode) { |
| 503 TailCallMode tail_call_mode) { | |
| 504 CallFunctionParameters parameters(arity, flags, language_mode, feedback, | 522 CallFunctionParameters parameters(arity, flags, language_mode, feedback, |
| 505 tail_call_mode); | 523 tail_call_mode, convert_mode); |
| 506 return new (zone()) Operator1<CallFunctionParameters>( // -- | 524 return new (zone()) Operator1<CallFunctionParameters>( // -- |
| 507 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode | 525 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode |
| 508 "JSCallFunction", // name | 526 "JSCallFunction", // name |
| 509 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 527 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
| 510 parameters); // parameter | 528 parameters); // parameter |
| 511 } | 529 } |
| 512 | 530 |
| 513 | 531 |
| 514 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, | 532 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, |
| 515 size_t arity) { | 533 size_t arity) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 526 | 544 |
| 527 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { | 545 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { |
| 528 return new (zone()) Operator1<int>( // -- | 546 return new (zone()) Operator1<int>( // -- |
| 529 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 547 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
| 530 "JSCallConstruct", // name | 548 "JSCallConstruct", // name |
| 531 arguments, 1, 1, 1, 1, 2, // counts | 549 arguments, 1, 1, 1, 1, 2, // counts |
| 532 arguments); // parameter | 550 arguments); // parameter |
| 533 } | 551 } |
| 534 | 552 |
| 535 | 553 |
| 554 const Operator* JSOperatorBuilder::ConvertReceiver( |
| 555 ConvertReceiverMode convert_mode) { |
| 556 return new (zone()) Operator1<ConvertReceiverMode>( // -- |
| 557 IrOpcode::kJSConvertReceiver, Operator::kNoThrow, // opcode |
| 558 "JSConvertReceiver", // name |
| 559 1, 1, 1, 1, 1, 0, // counts |
| 560 convert_mode); // parameter |
| 561 } |
| 562 |
| 563 |
| 536 const Operator* JSOperatorBuilder::LoadNamed(LanguageMode language_mode, | 564 const Operator* JSOperatorBuilder::LoadNamed(LanguageMode language_mode, |
| 537 Handle<Name> name, | 565 Handle<Name> name, |
| 538 const VectorSlotPair& feedback) { | 566 const VectorSlotPair& feedback) { |
| 539 NamedAccess access(language_mode, name, feedback); | 567 NamedAccess access(language_mode, name, feedback); |
| 540 return new (zone()) Operator1<NamedAccess>( // -- | 568 return new (zone()) Operator1<NamedAccess>( // -- |
| 541 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode | 569 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode |
| 542 "JSLoadNamed", // name | 570 "JSLoadNamed", // name |
| 543 2, 1, 1, 1, 1, 2, // counts | 571 2, 1, 1, 1, 1, 2, // counts |
| 544 access); // parameter | 572 access); // parameter |
| 545 } | 573 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 Handle<ScopeInfo>::hash>( // -- | 766 Handle<ScopeInfo>::hash>( // -- |
| 739 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 767 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 740 "JSCreateScriptContext", // name | 768 "JSCreateScriptContext", // name |
| 741 1, 1, 1, 1, 1, 2, // counts | 769 1, 1, 1, 1, 1, 2, // counts |
| 742 scpope_info); // parameter | 770 scpope_info); // parameter |
| 743 } | 771 } |
| 744 | 772 |
| 745 } // namespace compiler | 773 } // namespace compiler |
| 746 } // namespace internal | 774 } // namespace internal |
| 747 } // namespace v8 | 775 } // namespace v8 |
| OLD | NEW |