Chromium Code Reviews| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 Isolate*, void (*Generate)(Isolate*, const State&)); | 846 Isolate*, void (*Generate)(Isolate*, const State&)); |
| 847 | 847 |
| 848 bool CanReuseDoubleBox() const { | 848 bool CanReuseDoubleBox() const { |
| 849 return (result_kind_ > SMI && result_kind_ <= NUMBER) && | 849 return (result_kind_ > SMI && result_kind_ <= NUMBER) && |
| 850 ((mode_ == OVERWRITE_LEFT && | 850 ((mode_ == OVERWRITE_LEFT && |
| 851 left_kind_ > SMI && left_kind_ <= NUMBER) || | 851 left_kind_ > SMI && left_kind_ <= NUMBER) || |
| 852 (mode_ == OVERWRITE_RIGHT && | 852 (mode_ == OVERWRITE_RIGHT && |
| 853 right_kind_ > SMI && right_kind_ <= NUMBER)); | 853 right_kind_ > SMI && right_kind_ <= NUMBER)); |
| 854 } | 854 } |
| 855 | 855 |
| 856 // Returns true if the IC _can_ create allocation mementos. | |
| 857 bool CanCreateAllocationMementos() const { | |
|
mvstanton
2013/12/11 08:15:29
Change Can to Could, because Should and Could are
Benedikt Meurer
2013/12/11 12:17:46
Done.
| |
| 858 if (left_kind_ == STRING || right_kind_ == STRING) { | |
| 859 ASSERT_EQ(Token::ADD, op_); | |
| 860 return true; | |
| 861 } | |
| 862 return false; | |
| 863 } | |
| 864 | |
| 865 // Returns true if the IC _should_ create allocation mementos. | |
| 866 bool ShouldCreateAllocationMementos() const { | |
| 867 return FLAG_allocation_site_pretenuring && CanCreateAllocationMementos(); | |
| 868 } | |
| 869 | |
| 856 bool HasSideEffects() const { | 870 bool HasSideEffects() const { |
| 857 return Max(left_kind_, right_kind_) == GENERIC; | 871 return Max(left_kind_, right_kind_) == GENERIC; |
| 858 } | 872 } |
| 859 | 873 |
| 874 // Returns true if the IC should enable the inline smi code (i.e. if either | |
| 875 // parameter may be a smi). | |
| 860 bool UseInlinedSmiCode() const { | 876 bool UseInlinedSmiCode() const { |
| 861 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); | 877 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); |
| 862 } | 878 } |
| 863 | 879 |
| 864 static const int FIRST_TOKEN = Token::BIT_OR; | 880 static const int FIRST_TOKEN = Token::BIT_OR; |
| 865 static const int LAST_TOKEN = Token::MOD; | 881 static const int LAST_TOKEN = Token::MOD; |
| 866 | 882 |
| 867 Token::Value op() const { return op_; } | 883 Token::Value op() const { return op_; } |
| 868 OverwriteMode mode() const { return mode_; } | 884 OverwriteMode mode() const { return mode_; } |
| 869 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 885 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 911 Kind left_kind_; | 927 Kind left_kind_; |
| 912 Kind right_kind_; | 928 Kind right_kind_; |
| 913 Kind result_kind_; | 929 Kind result_kind_; |
| 914 Maybe<int> fixed_right_arg_; | 930 Maybe<int> fixed_right_arg_; |
| 915 }; | 931 }; |
| 916 | 932 |
| 917 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } | 933 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
| 918 | 934 |
| 919 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); | 935 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); |
| 920 | 936 |
| 921 MUST_USE_RESULT MaybeObject* Transition(Handle<Object> left, | 937 MaybeObject* Transition(Handle<AllocationSite> allocation_site, |
| 922 Handle<Object> right); | 938 Handle<Object> left, |
| 939 Handle<Object> right) V8_WARN_UNUSED_RESULT; | |
| 923 }; | 940 }; |
| 924 | 941 |
| 925 | 942 |
| 926 class CompareIC: public IC { | 943 class CompareIC: public IC { |
| 927 public: | 944 public: |
| 928 // The type/state lattice is defined by the following inequations: | 945 // The type/state lattice is defined by the following inequations: |
| 929 // UNINITIALIZED < ... | 946 // UNINITIALIZED < ... |
| 930 // ... < GENERIC | 947 // ... < GENERIC |
| 931 // SMI < NUMBER | 948 // SMI < NUMBER |
| 932 // INTERNALIZED_STRING < STRING | 949 // INTERNALIZED_STRING < STRING |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1021 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 1038 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 1022 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 1039 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
| 1023 | 1040 |
| 1024 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); | 1041 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); |
| 1025 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); | 1042 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); |
| 1026 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 1043 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 1027 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 1044 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
| 1028 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure); | 1045 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure); |
| 1029 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 1046 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 1030 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); | 1047 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); |
| 1048 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); | |
| 1031 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 1049 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 1032 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 1050 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 1033 | 1051 |
| 1034 | 1052 |
| 1035 } } // namespace v8::internal | 1053 } } // namespace v8::internal |
| 1036 | 1054 |
| 1037 #endif // V8_IC_H_ | 1055 #endif // V8_IC_H_ |
| OLD | NEW |