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

Side by Side Diff: src/code-stubs.h

Issue 8510005: Simplify StringCharCodeAt in non-crankshaft codegen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // string. Additional index constraints are specified by the 764 // string. Additional index constraints are specified by the
765 // flags. Otherwise, bails out to the provided labels. 765 // flags. Otherwise, bails out to the provided labels.
766 // 766 //
767 // Register usage: |object| may be changed to another string in a way 767 // Register usage: |object| may be changed to another string in a way
768 // that doesn't affect charCodeAt/charAt semantics, |index| is 768 // that doesn't affect charCodeAt/charAt semantics, |index| is
769 // preserved, |scratch| and |result| are clobbered. 769 // preserved, |scratch| and |result| are clobbered.
770 class StringCharCodeAtGenerator { 770 class StringCharCodeAtGenerator {
771 public: 771 public:
772 StringCharCodeAtGenerator(Register object, 772 StringCharCodeAtGenerator(Register object,
773 Register index, 773 Register index,
774 Register scratch,
775 Register result, 774 Register result,
776 Label* receiver_not_string, 775 Label* receiver_not_string,
777 Label* index_not_number, 776 Label* index_not_number,
778 Label* index_out_of_range, 777 Label* index_out_of_range,
779 StringIndexFlags index_flags) 778 StringIndexFlags index_flags)
780 : object_(object), 779 : object_(object),
781 index_(index), 780 index_(index),
782 scratch_(scratch),
783 result_(result), 781 result_(result),
784 receiver_not_string_(receiver_not_string), 782 receiver_not_string_(receiver_not_string),
785 index_not_number_(index_not_number), 783 index_not_number_(index_not_number),
786 index_out_of_range_(index_out_of_range), 784 index_out_of_range_(index_out_of_range),
787 index_flags_(index_flags) { 785 index_flags_(index_flags) {
788 ASSERT(!scratch_.is(object_)); 786 ASSERT(!scratch_.is(object_));
789 ASSERT(!scratch_.is(index_)); 787 ASSERT(!scratch_.is(index_));
790 ASSERT(!scratch_.is(result_)); 788 ASSERT(!scratch_.is(result_));
791 ASSERT(!result_.is(object_)); 789 ASSERT(!result_.is(object_));
792 ASSERT(!result_.is(index_)); 790 ASSERT(!result_.is(index_));
793 } 791 }
794 792
795 // Generates the fast case code. On the fallthrough path |result| 793 // Generates the fast case code. On the fallthrough path |result|
796 // register contains the result. 794 // register contains the result.
797 void GenerateFast(MacroAssembler* masm); 795 void GenerateFast(MacroAssembler* masm);
798 796
799 // Generates the slow case code. Must not be naturally 797 // Generates the slow case code. Must not be naturally
800 // reachable. Expected to be put after a ret instruction (e.g., in 798 // reachable. Expected to be put after a ret instruction (e.g., in
801 // deferred code). Always jumps back to the fast case. 799 // deferred code). Always jumps back to the fast case.
802 void GenerateSlow(MacroAssembler* masm, 800 void GenerateSlow(MacroAssembler* masm,
803 const RuntimeCallHelper& call_helper); 801 const RuntimeCallHelper& call_helper);
804 802
805 private: 803 private:
806 Register object_; 804 Register object_;
807 Register index_; 805 Register index_;
808 Register scratch_;
809 Register result_; 806 Register result_;
810 807
811 Label* receiver_not_string_; 808 Label* receiver_not_string_;
812 Label* index_not_number_; 809 Label* index_not_number_;
813 Label* index_out_of_range_; 810 Label* index_out_of_range_;
814 811
815 StringIndexFlags index_flags_; 812 StringIndexFlags index_flags_;
816 813
817 Label call_runtime_; 814 Label call_runtime_;
818 Label index_not_smi_; 815 Label index_not_smi_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // string. Additional index constraints are specified by the 858 // string. Additional index constraints are specified by the
862 // flags. Otherwise, bails out to the provided labels. 859 // flags. Otherwise, bails out to the provided labels.
863 // 860 //
864 // Register usage: |object| may be changed to another string in a way 861 // Register usage: |object| may be changed to another string in a way
865 // that doesn't affect charCodeAt/charAt semantics, |index| is 862 // that doesn't affect charCodeAt/charAt semantics, |index| is
866 // preserved, |scratch1|, |scratch2|, and |result| are clobbered. 863 // preserved, |scratch1|, |scratch2|, and |result| are clobbered.
867 class StringCharAtGenerator { 864 class StringCharAtGenerator {
868 public: 865 public:
869 StringCharAtGenerator(Register object, 866 StringCharAtGenerator(Register object,
870 Register index, 867 Register index,
871 Register scratch1, 868 Register scratch,
872 Register scratch2,
873 Register result, 869 Register result,
874 Label* receiver_not_string, 870 Label* receiver_not_string,
875 Label* index_not_number, 871 Label* index_not_number,
876 Label* index_out_of_range, 872 Label* index_out_of_range,
877 StringIndexFlags index_flags) 873 StringIndexFlags index_flags)
878 : char_code_at_generator_(object, 874 : char_code_at_generator_(object,
879 index, 875 index,
880 scratch1, 876 scratch,
881 scratch2,
882 receiver_not_string, 877 receiver_not_string,
883 index_not_number, 878 index_not_number,
884 index_out_of_range, 879 index_out_of_range,
885 index_flags), 880 index_flags),
886 char_from_code_generator_(scratch2, result) {} 881 char_from_code_generator_(scratch, result) {}
887 882
888 // Generates the fast case code. On the fallthrough path |result| 883 // Generates the fast case code. On the fallthrough path |result|
889 // register contains the result. 884 // register contains the result.
890 void GenerateFast(MacroAssembler* masm); 885 void GenerateFast(MacroAssembler* masm);
891 886
892 // Generates the slow case code. Must not be naturally 887 // Generates the slow case code. Must not be naturally
893 // reachable. Expected to be put after a ret instruction (e.g., in 888 // reachable. Expected to be put after a ret instruction (e.g., in
894 // deferred code). Always jumps back to the fast case. 889 // deferred code). Always jumps back to the fast case.
895 void GenerateSlow(MacroAssembler* masm, 890 void GenerateSlow(MacroAssembler* masm,
896 const RuntimeCallHelper& call_helper); 891 const RuntimeCallHelper& call_helper);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 int MinorKey() { return 0; } 1068 int MinorKey() { return 0; }
1074 1069
1075 void Generate(MacroAssembler* masm); 1070 void Generate(MacroAssembler* masm);
1076 1071
1077 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 1072 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
1078 }; 1073 };
1079 1074
1080 } } // namespace v8::internal 1075 } } // namespace v8::internal
1081 1076
1082 #endif // V8_CODE_STUBS_H_ 1077 #endif // V8_CODE_STUBS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698