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

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

Issue 525085: Use generated code to create sub strings (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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/assembler-ia32.cc ('k') | src/ia32/codegen-ia32.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 void GenerateLog(ZoneList<Expression*>* args); 537 void GenerateLog(ZoneList<Expression*>* args);
538 538
539 void GenerateGetFramePointer(ZoneList<Expression*>* args); 539 void GenerateGetFramePointer(ZoneList<Expression*>* args);
540 540
541 // Fast support for Math.random(). 541 // Fast support for Math.random().
542 void GenerateRandomPositiveSmi(ZoneList<Expression*>* args); 542 void GenerateRandomPositiveSmi(ZoneList<Expression*>* args);
543 543
544 // Fast support for StringAdd. 544 // Fast support for StringAdd.
545 void GenerateStringAdd(ZoneList<Expression*>* args); 545 void GenerateStringAdd(ZoneList<Expression*>* args);
546 546
547 // Fast support for SubString.
548 void GenerateSubString(ZoneList<Expression*>* args);
549
547 // Support for direct calls from JavaScript to native RegExp code. 550 // Support for direct calls from JavaScript to native RegExp code.
548 void GenerateRegExpExec(ZoneList<Expression*>* args); 551 void GenerateRegExpExec(ZoneList<Expression*>* args);
549 552
550 // Simple condition analysis. 553 // Simple condition analysis.
551 enum ConditionAnalysis { 554 enum ConditionAnalysis {
552 ALWAYS_TRUE, 555 ALWAYS_TRUE,
553 ALWAYS_FALSE, 556 ALWAYS_FALSE,
554 DONT_KNOW 557 DONT_KNOW
555 }; 558 };
556 ConditionAnalysis AnalyzeCondition(Expression* cond); 559 ConditionAnalysis AnalyzeCondition(Expression* cond);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 }; 743 };
741 744
742 745
743 // Flag that indicates how to generate code for the stub StringAddStub. 746 // Flag that indicates how to generate code for the stub StringAddStub.
744 enum StringAddFlags { 747 enum StringAddFlags {
745 NO_STRING_ADD_FLAGS = 0, 748 NO_STRING_ADD_FLAGS = 0,
746 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub. 749 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub.
747 }; 750 };
748 751
749 752
750 class StringAddStub: public CodeStub { 753 class StringStubBase: public CodeStub {
754 public:
755 // Generate code for copying characters using a simple loop. This should only
756 // be used in places where the number of characters is small and the
757 // additional setup and checking in GenerateCopyCharactersREP adds too much
758 // overhead. Copying of overlapping regions is not supported.
759 void GenerateCopyCharacters(MacroAssembler* masm,
760 Register dest,
761 Register src,
762 Register count,
763 Register scratch,
764 bool ascii);
765
766 // Generate code for copying characters using the rep movs instruction.
767 // Copies ecx characters from esi to edi. Copying of overlapping regions is
768 // not supported.
769 void GenerateCopyCharactersREP(MacroAssembler* masm,
770 Register dest, // Must be edi.
771 Register src, // Must be esi.
772 Register count, // Must be ecx.
773 Register scratch, // Neither of the above.
774 bool ascii);
775 };
776
777
778 class StringAddStub: public StringStubBase {
751 public: 779 public:
752 explicit StringAddStub(StringAddFlags flags) { 780 explicit StringAddStub(StringAddFlags flags) {
753 string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0); 781 string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0);
754 } 782 }
755 783
756 private: 784 private:
757 Major MajorKey() { return StringAdd; } 785 Major MajorKey() { return StringAdd; }
758 int MinorKey() { return string_check_ ? 0 : 1; } 786 int MinorKey() { return string_check_ ? 0 : 1; }
759 787
760 void Generate(MacroAssembler* masm); 788 void Generate(MacroAssembler* masm);
761 789
762 void GenerateCopyCharacters(MacroAssembler* masm,
763 Register desc,
764 Register src,
765 Register count,
766 Register scratch,
767 bool ascii);
768
769 // Should the stub check whether arguments are strings? 790 // Should the stub check whether arguments are strings?
770 bool string_check_; 791 bool string_check_;
771 }; 792 };
772 793
773 794
795 class SubStringStub: public StringStubBase {
796 public:
797 SubStringStub() {}
798
799 private:
800 Major MajorKey() { return SubString; }
801 int MinorKey() { return 0; }
802
803 void Generate(MacroAssembler* masm);
804 };
805
806
774 } } // namespace v8::internal 807 } } // namespace v8::internal
775 808
776 #endif // V8_IA32_CODEGEN_IA32_H_ 809 #endif // V8_IA32_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698