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

Side by Side Diff: src/x64/codegen-x64.h

Issue 1750017: Port string keyed load IC improvements (r4444) to x64. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 7 months 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
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 return runtime_operands_type_ != BinaryOpIC::STRINGS; 809 return runtime_operands_type_ != BinaryOpIC::STRINGS;
810 } 810 }
811 811
812 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } 812 virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
813 813
814 virtual InlineCacheState GetICState() { 814 virtual InlineCacheState GetICState() {
815 return BinaryOpIC::ToState(runtime_operands_type_); 815 return BinaryOpIC::ToState(runtime_operands_type_);
816 } 816 }
817 }; 817 };
818 818
819 class StringHelper : public AllStatic {
820 public:
821 // Generates fast code for getting a char code out of a string
822 // object at the given index. May bail out for four reasons (in the
823 // listed order):
824 // * Receiver is not a string (receiver_not_string label).
825 // * Index is not a smi (index_not_smi label).
826 // * Index is out of range (index_out_of_range).
827 // * Some other reason (slow_case label). In this case it's
828 // guaranteed that the above conditions are not violated,
829 // e.g. it's safe to assume the receiver is a string and the
830 // index is a non-negative smi < length.
831 // When successful, object, index, and scratch are clobbered.
832 // Otherwise, scratch and result are clobbered.
833 static void GenerateFastCharCodeAt(MacroAssembler* masm,
834 Register object,
835 Register index,
836 Register scratch,
837 Register result,
838 Label* receiver_not_string,
839 Label* index_not_smi,
840 Label* index_out_of_range,
841 Label* slow_case);
819 842
820 class StringStubBase: public CodeStub { 843 // Generates code for creating a one-char string from the given char
821 public: 844 // code. May do a runtime call, so any register can be clobbered
845 // and, if the given invoke flag specifies a call, an internal frame
846 // is required. In tail call mode the result must be rax register.
847 static void GenerateCharFromCode(MacroAssembler* masm,
848 Register code,
849 Register result,
850 Register scratch,
851 InvokeFlag flag);
852
822 // Generate code for copying characters using a simple loop. This should only 853 // Generate code for copying characters using a simple loop. This should only
823 // be used in places where the number of characters is small and the 854 // be used in places where the number of characters is small and the
824 // additional setup and checking in GenerateCopyCharactersREP adds too much 855 // additional setup and checking in GenerateCopyCharactersREP adds too much
825 // overhead. Copying of overlapping regions is not supported. 856 // overhead. Copying of overlapping regions is not supported.
826 void GenerateCopyCharacters(MacroAssembler* masm, 857 static void GenerateCopyCharacters(MacroAssembler* masm,
827 Register dest, 858 Register dest,
828 Register src, 859 Register src,
829 Register count, 860 Register count,
830 bool ascii); 861 bool ascii);
831 862
832 // Generate code for copying characters using the rep movs instruction. 863 // Generate code for copying characters using the rep movs instruction.
833 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is 864 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is
834 // not supported. 865 // not supported.
835 void GenerateCopyCharactersREP(MacroAssembler* masm, 866 static void GenerateCopyCharactersREP(MacroAssembler* masm,
836 Register dest, // Must be rdi. 867 Register dest, // Must be rdi.
837 Register src, // Must be rsi. 868 Register src, // Must be rsi.
838 Register count, // Must be rcx. 869 Register count, // Must be rcx.
839 bool ascii); 870 bool ascii);
840 871
841 872
842 // Probe the symbol table for a two character string. If the string is 873 // Probe the symbol table for a two character string. If the string is
843 // not found by probing a jump to the label not_found is performed. This jump 874 // not found by probing a jump to the label not_found is performed. This jump
844 // does not guarantee that the string is not in the symbol table. If the 875 // does not guarantee that the string is not in the symbol table. If the
845 // string is found the code falls through with the string in register rax. 876 // string is found the code falls through with the string in register rax.
846 void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, 877 static void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
847 Register c1, 878 Register c1,
848 Register c2, 879 Register c2,
849 Register scratch1, 880 Register scratch1,
850 Register scratch2, 881 Register scratch2,
851 Register scratch3, 882 Register scratch3,
852 Register scratch4, 883 Register scratch4,
853 Label* not_found); 884 Label* not_found);
854 885
855 // Generate string hash. 886 // Generate string hash.
856 void GenerateHashInit(MacroAssembler* masm, 887 static void GenerateHashInit(MacroAssembler* masm,
857 Register hash, 888 Register hash,
858 Register character, 889 Register character,
859 Register scratch); 890 Register scratch);
860 void GenerateHashAddCharacter(MacroAssembler* masm, 891 static void GenerateHashAddCharacter(MacroAssembler* masm,
861 Register hash, 892 Register hash,
862 Register character, 893 Register character,
863 Register scratch); 894 Register scratch);
864 void GenerateHashGetHash(MacroAssembler* masm, 895 static void GenerateHashGetHash(MacroAssembler* masm,
865 Register hash, 896 Register hash,
866 Register scratch); 897 Register scratch);
898 private:
899 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
867 }; 900 };
868 901
869 902
870 // Flag that indicates how to generate code for the stub StringAddStub. 903 // Flag that indicates how to generate code for the stub StringAddStub.
871 enum StringAddFlags { 904 enum StringAddFlags {
872 NO_STRING_ADD_FLAGS = 0, 905 NO_STRING_ADD_FLAGS = 0,
873 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub. 906 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub.
874 }; 907 };
875 908
876 909
877 class StringAddStub: public StringStubBase { 910 class StringAddStub: public CodeStub {
878 public: 911 public:
879 explicit StringAddStub(StringAddFlags flags) { 912 explicit StringAddStub(StringAddFlags flags) {
880 string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0); 913 string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0);
881 } 914 }
882 915
883 private: 916 private:
884 Major MajorKey() { return StringAdd; } 917 Major MajorKey() { return StringAdd; }
885 int MinorKey() { return string_check_ ? 0 : 1; } 918 int MinorKey() { return string_check_ ? 0 : 1; }
886 919
887 void Generate(MacroAssembler* masm); 920 void Generate(MacroAssembler* masm);
888 921
889 // Should the stub check whether arguments are strings? 922 // Should the stub check whether arguments are strings?
890 bool string_check_; 923 bool string_check_;
891 }; 924 };
892 925
893 926
894 class SubStringStub: public StringStubBase { 927 class SubStringStub: public CodeStub {
895 public: 928 public:
896 SubStringStub() {} 929 SubStringStub() {}
897 930
898 private: 931 private:
899 Major MajorKey() { return SubString; } 932 Major MajorKey() { return SubString; }
900 int MinorKey() { return 0; } 933 int MinorKey() { return 0; }
901 934
902 void Generate(MacroAssembler* masm); 935 void Generate(MacroAssembler* masm);
903 }; 936 };
904 937
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 void Print() { 991 void Print() {
959 PrintF("NumberToStringStub\n"); 992 PrintF("NumberToStringStub\n");
960 } 993 }
961 #endif 994 #endif
962 }; 995 };
963 996
964 997
965 } } // namespace v8::internal 998 } } // namespace v8::internal
966 999
967 #endif // V8_X64_CODEGEN_X64_H_ 1000 #endif // V8_X64_CODEGEN_X64_H_
OLDNEW
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698