| 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 Isolate*, void (*Generate)(Isolate*, const State&)); | 854 Isolate*, void (*Generate)(Isolate*, const State&)); |
| 855 | 855 |
| 856 bool CanReuseDoubleBox() const { | 856 bool CanReuseDoubleBox() const { |
| 857 return (result_kind_ > SMI && result_kind_ <= NUMBER) && | 857 return (result_kind_ > SMI && result_kind_ <= NUMBER) && |
| 858 ((mode_ == OVERWRITE_LEFT && | 858 ((mode_ == OVERWRITE_LEFT && |
| 859 left_kind_ > SMI && left_kind_ <= NUMBER) || | 859 left_kind_ > SMI && left_kind_ <= NUMBER) || |
| 860 (mode_ == OVERWRITE_RIGHT && | 860 (mode_ == OVERWRITE_RIGHT && |
| 861 right_kind_ > SMI && right_kind_ <= NUMBER)); | 861 right_kind_ > SMI && right_kind_ <= NUMBER)); |
| 862 } | 862 } |
| 863 | 863 |
| 864 // Returns true if the IC _could_ create allocation mementos. | |
| 865 bool CouldCreateAllocationMementos() const { | |
| 866 if (left_kind_ == STRING || right_kind_ == STRING) { | |
| 867 ASSERT_EQ(Token::ADD, op_); | |
| 868 return true; | |
| 869 } | |
| 870 return false; | |
| 871 } | |
| 872 | |
| 873 // Returns true if the IC _should_ create allocation mementos. | |
| 874 bool ShouldCreateAllocationMementos() const { | |
| 875 return FLAG_allocation_site_pretenuring && | |
| 876 CouldCreateAllocationMementos(); | |
| 877 } | |
| 878 | |
| 879 bool HasSideEffects() const { | 864 bool HasSideEffects() const { |
| 880 return Max(left_kind_, right_kind_) == GENERIC; | 865 return Max(left_kind_, right_kind_) == GENERIC; |
| 881 } | 866 } |
| 882 | 867 |
| 883 // Returns true if the IC should enable the inline smi code (i.e. if either | |
| 884 // parameter may be a smi). | |
| 885 bool UseInlinedSmiCode() const { | 868 bool UseInlinedSmiCode() const { |
| 886 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); | 869 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); |
| 887 } | 870 } |
| 888 | 871 |
| 889 static const int FIRST_TOKEN = Token::BIT_OR; | 872 static const int FIRST_TOKEN = Token::BIT_OR; |
| 890 static const int LAST_TOKEN = Token::MOD; | 873 static const int LAST_TOKEN = Token::MOD; |
| 891 | 874 |
| 892 Token::Value op() const { return op_; } | 875 Token::Value op() const { return op_; } |
| 893 OverwriteMode mode() const { return mode_; } | 876 OverwriteMode mode() const { return mode_; } |
| 894 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 877 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 Kind left_kind_; | 919 Kind left_kind_; |
| 937 Kind right_kind_; | 920 Kind right_kind_; |
| 938 Kind result_kind_; | 921 Kind result_kind_; |
| 939 Maybe<int> fixed_right_arg_; | 922 Maybe<int> fixed_right_arg_; |
| 940 }; | 923 }; |
| 941 | 924 |
| 942 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } | 925 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
| 943 | 926 |
| 944 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); | 927 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); |
| 945 | 928 |
| 946 MaybeObject* Transition(Handle<AllocationSite> allocation_site, | 929 MUST_USE_RESULT MaybeObject* Transition(Handle<Object> left, |
| 947 Handle<Object> left, | 930 Handle<Object> right); |
| 948 Handle<Object> right) V8_WARN_UNUSED_RESULT; | |
| 949 }; | 931 }; |
| 950 | 932 |
| 951 | 933 |
| 952 class CompareIC: public IC { | 934 class CompareIC: public IC { |
| 953 public: | 935 public: |
| 954 // The type/state lattice is defined by the following inequations: | 936 // The type/state lattice is defined by the following inequations: |
| 955 // UNINITIALIZED < ... | 937 // UNINITIALIZED < ... |
| 956 // ... < GENERIC | 938 // ... < GENERIC |
| 957 // SMI < NUMBER | 939 // SMI < NUMBER |
| 958 // INTERNALIZED_STRING < STRING | 940 // INTERNALIZED_STRING < STRING |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 1029 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 1048 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 1030 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
| 1049 | 1031 |
| 1050 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); | 1032 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); |
| 1051 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); | 1033 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); |
| 1052 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 1034 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 1053 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 1035 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
| 1054 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure); | 1036 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure); |
| 1055 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 1037 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 1056 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); | 1038 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); |
| 1057 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); | |
| 1058 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 1039 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 1059 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 1040 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 1060 | 1041 |
| 1061 | 1042 |
| 1062 } } // namespace v8::internal | 1043 } } // namespace v8::internal |
| 1063 | 1044 |
| 1064 #endif // V8_IC_H_ | 1045 #endif // V8_IC_H_ |
| OLD | NEW |