| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 return os << p.language_mode(); | 384 return os << p.language_mode(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 | 387 |
| 388 const StorePropertyParameters& StorePropertyParametersOf(const Operator* op) { | 388 const StorePropertyParameters& StorePropertyParametersOf(const Operator* op) { |
| 389 DCHECK_EQ(IrOpcode::kJSStoreProperty, op->opcode()); | 389 DCHECK_EQ(IrOpcode::kJSStoreProperty, op->opcode()); |
| 390 return OpParameter<StorePropertyParameters>(op); | 390 return OpParameter<StorePropertyParameters>(op); |
| 391 } | 391 } |
| 392 | 392 |
| 393 | 393 |
| 394 bool operator==(CreateArgumentsParameters const& lhs, |
| 395 CreateArgumentsParameters const& rhs) { |
| 396 return lhs.type() == rhs.type() && lhs.start_index() == rhs.start_index(); |
| 397 } |
| 398 |
| 399 |
| 400 bool operator!=(CreateArgumentsParameters const& lhs, |
| 401 CreateArgumentsParameters const& rhs) { |
| 402 return !(lhs == rhs); |
| 403 } |
| 404 |
| 405 |
| 406 size_t hash_value(CreateArgumentsParameters const& p) { |
| 407 return base::hash_combine(p.type(), p.start_index()); |
| 408 } |
| 409 |
| 410 |
| 411 std::ostream& operator<<(std::ostream& os, CreateArgumentsParameters const& p) { |
| 412 return os << p.type() << ", " << p.start_index(); |
| 413 } |
| 414 |
| 415 |
| 394 bool operator==(CreateClosureParameters const& lhs, | 416 bool operator==(CreateClosureParameters const& lhs, |
| 395 CreateClosureParameters const& rhs) { | 417 CreateClosureParameters const& rhs) { |
| 396 return lhs.pretenure() == rhs.pretenure() && | 418 return lhs.pretenure() == rhs.pretenure() && |
| 397 lhs.shared_info().is_identical_to(rhs.shared_info()); | 419 lhs.shared_info().is_identical_to(rhs.shared_info()); |
| 398 } | 420 } |
| 399 | 421 |
| 400 | 422 |
| 401 bool operator!=(CreateClosureParameters const& lhs, | 423 bool operator!=(CreateClosureParameters const& lhs, |
| 402 CreateClosureParameters const& rhs) { | 424 CreateClosureParameters const& rhs) { |
| 403 return !(lhs == rhs); | 425 return !(lhs == rhs); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 ContextAccess context_access(depth, index, false); | 720 ContextAccess context_access(depth, index, false); |
| 699 DynamicContextAccess access(name, check_bitset, context_access); | 721 DynamicContextAccess access(name, check_bitset, context_access); |
| 700 return new (zone()) Operator1<DynamicContextAccess>( // -- | 722 return new (zone()) Operator1<DynamicContextAccess>( // -- |
| 701 IrOpcode::kJSLoadDynamicContext, Operator::kNoProperties, // opcode | 723 IrOpcode::kJSLoadDynamicContext, Operator::kNoProperties, // opcode |
| 702 "JSLoadDynamicContext", // name | 724 "JSLoadDynamicContext", // name |
| 703 1, 1, 1, 1, 1, 2, // counts | 725 1, 1, 1, 1, 1, 2, // counts |
| 704 access); // parameter | 726 access); // parameter |
| 705 } | 727 } |
| 706 | 728 |
| 707 | 729 |
| 730 const Operator* JSOperatorBuilder::CreateArguments( |
| 731 CreateArgumentsParameters::Type type, int start_index) { |
| 732 DCHECK_IMPLIES(start_index, type == CreateArgumentsParameters::kRestArray); |
| 733 CreateArgumentsParameters parameters(type, start_index); |
| 734 return new (zone()) Operator1<CreateArgumentsParameters>( // -- |
| 735 IrOpcode::kJSCreateArguments, Operator::kNoThrow, // opcode |
| 736 "JSCreateArguments", // name |
| 737 1, 1, 1, 1, 1, 0, // counts |
| 738 parameters); // parameter |
| 739 } |
| 740 |
| 741 |
| 708 const Operator* JSOperatorBuilder::CreateClosure( | 742 const Operator* JSOperatorBuilder::CreateClosure( |
| 709 Handle<SharedFunctionInfo> shared_info, PretenureFlag pretenure) { | 743 Handle<SharedFunctionInfo> shared_info, PretenureFlag pretenure) { |
| 710 CreateClosureParameters parameters(shared_info, pretenure); | 744 CreateClosureParameters parameters(shared_info, pretenure); |
| 711 return new (zone()) Operator1<CreateClosureParameters>( // -- | 745 return new (zone()) Operator1<CreateClosureParameters>( // -- |
| 712 IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode | 746 IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode |
| 713 "JSCreateClosure", // name | 747 "JSCreateClosure", // name |
| 714 0, 1, 1, 1, 1, 0, // counts | 748 0, 1, 1, 1, 1, 0, // counts |
| 715 parameters); // parameter | 749 parameters); // parameter |
| 716 } | 750 } |
| 717 | 751 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 740 Handle<String>::hash>( // -- | 774 Handle<String>::hash>( // -- |
| 741 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 775 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
| 742 "JSCreateCatchContext", // name | 776 "JSCreateCatchContext", // name |
| 743 2, 1, 1, 1, 1, 2, // counts | 777 2, 1, 1, 1, 1, 2, // counts |
| 744 name); // parameter | 778 name); // parameter |
| 745 } | 779 } |
| 746 | 780 |
| 747 } // namespace compiler | 781 } // namespace compiler |
| 748 } // namespace internal | 782 } // namespace internal |
| 749 } // namespace v8 | 783 } // namespace v8 |
| OLD | NEW |