| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 | 736 |
| 737 | 737 |
| 738 // Mode to overwrite BinaryExpression values. | 738 // Mode to overwrite BinaryExpression values. |
| 739 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT }; | 739 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT }; |
| 740 | 740 |
| 741 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. | 741 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. |
| 742 class BinaryOpIC: public IC { | 742 class BinaryOpIC: public IC { |
| 743 public: | 743 public: |
| 744 class State V8_FINAL BASE_EMBEDDED { | 744 class State V8_FINAL BASE_EMBEDDED { |
| 745 public: | 745 public: |
| 746 explicit State(ExtraICState extra_ic_state); | 746 State(Isolate* isolate, ExtraICState extra_ic_state); |
| 747 | 747 |
| 748 State(Token::Value op, OverwriteMode mode) | 748 State(Isolate* isolate, Token::Value op, OverwriteMode mode) |
| 749 : op_(op), mode_(mode), left_kind_(NONE), right_kind_(NONE), | 749 : op_(op), mode_(mode), left_kind_(NONE), right_kind_(NONE), |
| 750 result_kind_(NONE) { | 750 result_kind_(NONE), isolate_(isolate) { |
| 751 ASSERT_LE(FIRST_TOKEN, op); | 751 ASSERT_LE(FIRST_TOKEN, op); |
| 752 ASSERT_LE(op, LAST_TOKEN); | 752 ASSERT_LE(op, LAST_TOKEN); |
| 753 } | 753 } |
| 754 | 754 |
| 755 InlineCacheState GetICState() const { | 755 InlineCacheState GetICState() const { |
| 756 if (Max(left_kind_, right_kind_) == NONE) { | 756 if (Max(left_kind_, right_kind_) == NONE) { |
| 757 return ::v8::internal::UNINITIALIZED; | 757 return ::v8::internal::UNINITIALIZED; |
| 758 } | 758 } |
| 759 if (Max(left_kind_, right_kind_) == GENERIC) { | 759 if (Max(left_kind_, right_kind_) == GENERIC) { |
| 760 return ::v8::internal::MEGAMORPHIC; | 760 return ::v8::internal::MEGAMORPHIC; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 return KindToType(right_kind_, zone); | 817 return KindToType(right_kind_, zone); |
| 818 } | 818 } |
| 819 Type* GetResultType(Zone* zone) const; | 819 Type* GetResultType(Zone* zone) const; |
| 820 | 820 |
| 821 void Print(StringStream* stream) const; | 821 void Print(StringStream* stream) const; |
| 822 | 822 |
| 823 void Update(Handle<Object> left, | 823 void Update(Handle<Object> left, |
| 824 Handle<Object> right, | 824 Handle<Object> right, |
| 825 Handle<Object> result); | 825 Handle<Object> result); |
| 826 | 826 |
| 827 Isolate* isolate() const { return isolate_; } |
| 828 |
| 827 private: | 829 private: |
| 828 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; | 830 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; |
| 829 | 831 |
| 830 Kind UpdateKind(Handle<Object> object, Kind kind) const; | 832 Kind UpdateKind(Handle<Object> object, Kind kind) const; |
| 831 | 833 |
| 832 static const char* KindToString(Kind kind); | 834 static const char* KindToString(Kind kind); |
| 833 static Type* KindToType(Kind kind, Zone* zone); | 835 static Type* KindToType(Kind kind, Zone* zone); |
| 834 static bool KindMaybeSmi(Kind kind) { | 836 static bool KindMaybeSmi(Kind kind) { |
| 835 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; | 837 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; |
| 836 } | 838 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 847 class HasFixedRightArgField: public BitField<bool, 13, 1> {}; | 849 class HasFixedRightArgField: public BitField<bool, 13, 1> {}; |
| 848 class FixedRightArgValueField: public BitField<int, 14, 4> {}; | 850 class FixedRightArgValueField: public BitField<int, 14, 4> {}; |
| 849 class RightKindField: public BitField<Kind, 14, 3> {}; | 851 class RightKindField: public BitField<Kind, 14, 3> {}; |
| 850 | 852 |
| 851 Token::Value op_; | 853 Token::Value op_; |
| 852 OverwriteMode mode_; | 854 OverwriteMode mode_; |
| 853 Kind left_kind_; | 855 Kind left_kind_; |
| 854 Kind right_kind_; | 856 Kind right_kind_; |
| 855 Kind result_kind_; | 857 Kind result_kind_; |
| 856 Maybe<int> fixed_right_arg_; | 858 Maybe<int> fixed_right_arg_; |
| 859 Isolate* isolate_; |
| 857 }; | 860 }; |
| 858 | 861 |
| 859 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } | 862 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
| 860 | 863 |
| 861 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); | 864 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); |
| 862 | 865 |
| 863 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, | 866 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, |
| 864 Handle<Object> left, | 867 Handle<Object> left, |
| 865 Handle<Object> right) V8_WARN_UNUSED_RESULT; | 868 Handle<Object> right) V8_WARN_UNUSED_RESULT; |
| 866 }; | 869 }; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); | 979 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); |
| 977 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); | 980 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); |
| 978 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); | 981 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); |
| 979 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); | 982 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); |
| 980 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); | 983 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); |
| 981 | 984 |
| 982 | 985 |
| 983 } } // namespace v8::internal | 986 } } // namespace v8::internal |
| 984 | 987 |
| 985 #endif // V8_IC_H_ | 988 #endif // V8_IC_H_ |
| OLD | NEW |