Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: src/ic.h

Issue 106453003: Allocation site support for monomorphic StringAdds in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Michael's comments. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 _could_ create allocation mementos.
857 bool CouldCreateAllocationMementos() const {
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 &&
868 CouldCreateAllocationMementos();
869 }
870
856 bool HasSideEffects() const { 871 bool HasSideEffects() const {
857 return Max(left_kind_, right_kind_) == GENERIC; 872 return Max(left_kind_, right_kind_) == GENERIC;
858 } 873 }
859 874
875 // Returns true if the IC should enable the inline smi code (i.e. if either
876 // parameter may be a smi).
860 bool UseInlinedSmiCode() const { 877 bool UseInlinedSmiCode() const {
861 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); 878 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_);
862 } 879 }
863 880
864 static const int FIRST_TOKEN = Token::BIT_OR; 881 static const int FIRST_TOKEN = Token::BIT_OR;
865 static const int LAST_TOKEN = Token::MOD; 882 static const int LAST_TOKEN = Token::MOD;
866 883
867 Token::Value op() const { return op_; } 884 Token::Value op() const { return op_; }
868 OverwriteMode mode() const { return mode_; } 885 OverwriteMode mode() const { return mode_; }
869 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } 886 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 Kind left_kind_; 928 Kind left_kind_;
912 Kind right_kind_; 929 Kind right_kind_;
913 Kind result_kind_; 930 Kind result_kind_;
914 Maybe<int> fixed_right_arg_; 931 Maybe<int> fixed_right_arg_;
915 }; 932 };
916 933
917 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } 934 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
918 935
919 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); 936 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op);
920 937
921 MUST_USE_RESULT MaybeObject* Transition(Handle<Object> left, 938 MaybeObject* Transition(Handle<AllocationSite> allocation_site,
922 Handle<Object> right); 939 Handle<Object> left,
940 Handle<Object> right) V8_WARN_UNUSED_RESULT;
923 }; 941 };
924 942
925 943
926 class CompareIC: public IC { 944 class CompareIC: public IC {
927 public: 945 public:
928 // The type/state lattice is defined by the following inequations: 946 // The type/state lattice is defined by the following inequations:
929 // UNINITIALIZED < ... 947 // UNINITIALIZED < ...
930 // ... < GENERIC 948 // ... < GENERIC
931 // SMI < NUMBER 949 // SMI < NUMBER
932 // INTERNALIZED_STRING < STRING 950 // INTERNALIZED_STRING < STRING
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; 1039 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK };
1022 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); 1040 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check);
1023 1041
1024 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); 1042 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure);
1025 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); 1043 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure);
1026 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); 1044 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss);
1027 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 1045 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
1028 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure); 1046 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure);
1029 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 1047 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
1030 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 1048 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
1049 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite);
1031 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 1050 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
1032 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 1051 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
1033 1052
1034 1053
1035 } } // namespace v8::internal 1054 } } // namespace v8::internal
1036 1055
1037 #endif // V8_IC_H_ 1056 #endif // V8_IC_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/ia32/lithium-codegen-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698