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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 Name##Operator<BinaryOperationHint::kSignedSmall> \ | 588 Name##Operator<BinaryOperationHint::kSignedSmall> \ |
589 k##Name##SignedSmallOperator; \ | 589 k##Name##SignedSmallOperator; \ |
590 Name##Operator<BinaryOperationHint::kSigned32> k##Name##Signed32Operator; \ | 590 Name##Operator<BinaryOperationHint::kSigned32> k##Name##Signed32Operator; \ |
591 Name##Operator<BinaryOperationHint::kNumberOrOddball> \ | 591 Name##Operator<BinaryOperationHint::kNumberOrOddball> \ |
592 k##Name##NumberOrOddballOperator; \ | 592 k##Name##NumberOrOddballOperator; \ |
593 Name##Operator<BinaryOperationHint::kString> k##Name##StringOperator; \ | 593 Name##Operator<BinaryOperationHint::kString> k##Name##StringOperator; \ |
594 Name##Operator<BinaryOperationHint::kAny> k##Name##AnyOperator; | 594 Name##Operator<BinaryOperationHint::kAny> k##Name##AnyOperator; |
595 BINARY_OP_LIST(BINARY_OP) | 595 BINARY_OP_LIST(BINARY_OP) |
596 #undef BINARY_OP | 596 #undef BINARY_OP |
597 | 597 |
598 #define COMPARE_OP(Name, properties) \ | 598 #define COMPARE_OP(Name, properties) \ |
599 template <CompareOperationHint kHint> \ | 599 template <CompareOperationHint kHint> \ |
600 struct Name##Operator final : public Operator1<CompareOperationHint> { \ | 600 struct Name##Operator final : public Operator1<CompareOperationHint> { \ |
601 Name##Operator() \ | 601 Name##Operator() \ |
602 : Operator1<CompareOperationHint>( \ | 602 : Operator1<CompareOperationHint>( \ |
603 IrOpcode::kJS##Name, properties, "JS" #Name, 2, 1, 1, 1, 1, \ | 603 IrOpcode::kJS##Name, properties, "JS" #Name, 2, 1, 1, 1, 1, \ |
604 Operator::ZeroIfNoThrow(properties), kHint) {} \ | 604 Operator::ZeroIfNoThrow(properties), kHint) {} \ |
605 }; \ | 605 }; \ |
606 Name##Operator<CompareOperationHint::kNone> k##Name##NoneOperator; \ | 606 Name##Operator<CompareOperationHint::kNone> k##Name##NoneOperator; \ |
607 Name##Operator<CompareOperationHint::kSignedSmall> \ | 607 Name##Operator<CompareOperationHint::kSignedSmall> \ |
608 k##Name##SignedSmallOperator; \ | 608 k##Name##SignedSmallOperator; \ |
609 Name##Operator<CompareOperationHint::kNumber> k##Name##NumberOperator; \ | 609 Name##Operator<CompareOperationHint::kNumber> k##Name##NumberOperator; \ |
610 Name##Operator<CompareOperationHint::kNumberOrOddball> \ | 610 Name##Operator<CompareOperationHint::kNumberOrOddball> \ |
611 k##Name##NumberOrOddballOperator; \ | 611 k##Name##NumberOrOddballOperator; \ |
612 Name##Operator<CompareOperationHint::kString> k##Name##StringOperator; \ | 612 Name##Operator<CompareOperationHint::kInternalizedString> \ |
613 Name##Operator<CompareOperationHint::kInternalizedString> \ | 613 k##Name##InternalizedStringOperator; \ |
614 k##Name##InternalizedStringOperator; \ | 614 Name##Operator<CompareOperationHint::kString> k##Name##StringOperator; \ |
| 615 Name##Operator<CompareOperationHint::kReceiver> k##Name##ReceiverOperator; \ |
615 Name##Operator<CompareOperationHint::kAny> k##Name##AnyOperator; | 616 Name##Operator<CompareOperationHint::kAny> k##Name##AnyOperator; |
616 COMPARE_OP_LIST(COMPARE_OP) | 617 COMPARE_OP_LIST(COMPARE_OP) |
617 #undef COMPARE_OP | 618 #undef COMPARE_OP |
618 }; | 619 }; |
619 | 620 |
620 static base::LazyInstance<JSOperatorGlobalCache>::type kCache = | 621 static base::LazyInstance<JSOperatorGlobalCache>::type kCache = |
621 LAZY_INSTANCE_INITIALIZER; | 622 LAZY_INSTANCE_INITIALIZER; |
622 | 623 |
623 JSOperatorBuilder::JSOperatorBuilder(Zone* zone) | 624 JSOperatorBuilder::JSOperatorBuilder(Zone* zone) |
624 : cache_(kCache.Get()), zone_(zone) {} | 625 : cache_(kCache.Get()), zone_(zone) {} |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 case CompareOperationHint::kSignedSmall: \ | 661 case CompareOperationHint::kSignedSmall: \ |
661 return &cache_.k##Name##SignedSmallOperator; \ | 662 return &cache_.k##Name##SignedSmallOperator; \ |
662 case CompareOperationHint::kNumber: \ | 663 case CompareOperationHint::kNumber: \ |
663 return &cache_.k##Name##NumberOperator; \ | 664 return &cache_.k##Name##NumberOperator; \ |
664 case CompareOperationHint::kNumberOrOddball: \ | 665 case CompareOperationHint::kNumberOrOddball: \ |
665 return &cache_.k##Name##NumberOrOddballOperator; \ | 666 return &cache_.k##Name##NumberOrOddballOperator; \ |
666 case CompareOperationHint::kInternalizedString: \ | 667 case CompareOperationHint::kInternalizedString: \ |
667 return &cache_.k##Name##InternalizedStringOperator; \ | 668 return &cache_.k##Name##InternalizedStringOperator; \ |
668 case CompareOperationHint::kString: \ | 669 case CompareOperationHint::kString: \ |
669 return &cache_.k##Name##StringOperator; \ | 670 return &cache_.k##Name##StringOperator; \ |
| 671 case CompareOperationHint::kReceiver: \ |
| 672 return &cache_.k##Name##ReceiverOperator; \ |
670 case CompareOperationHint::kAny: \ | 673 case CompareOperationHint::kAny: \ |
671 return &cache_.k##Name##AnyOperator; \ | 674 return &cache_.k##Name##AnyOperator; \ |
672 } \ | 675 } \ |
673 UNREACHABLE(); \ | 676 UNREACHABLE(); \ |
674 return nullptr; \ | 677 return nullptr; \ |
675 } | 678 } |
676 COMPARE_OP_LIST(COMPARE_OP) | 679 COMPARE_OP_LIST(COMPARE_OP) |
677 #undef COMPARE_OP | 680 #undef COMPARE_OP |
678 | 681 |
679 const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral( | 682 const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral( |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1007 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
1005 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1008 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
1006 "JSCreateScriptContext", // name | 1009 "JSCreateScriptContext", // name |
1007 1, 1, 1, 1, 1, 2, // counts | 1010 1, 1, 1, 1, 1, 2, // counts |
1008 scope_info); // parameter | 1011 scope_info); // parameter |
1009 } | 1012 } |
1010 | 1013 |
1011 } // namespace compiler | 1014 } // namespace compiler |
1012 } // namespace internal | 1015 } // namespace internal |
1013 } // namespace v8 | 1016 } // namespace v8 |
OLD | NEW |