Index: src/x64/codegen-x64.h |
=================================================================== |
--- src/x64/codegen-x64.h (revision 4526) |
+++ src/x64/codegen-x64.h (working copy) |
@@ -816,14 +816,45 @@ |
} |
}; |
+class StringHelper : public AllStatic { |
+ public: |
+ // Generates fast code for getting a char code out of a string |
+ // object at the given index. May bail out for four reasons (in the |
+ // listed order): |
+ // * Receiver is not a string (receiver_not_string label). |
+ // * Index is not a smi (index_not_smi label). |
+ // * Index is out of range (index_out_of_range). |
+ // * Some other reason (slow_case label). In this case it's |
+ // guaranteed that the above conditions are not violated, |
+ // e.g. it's safe to assume the receiver is a string and the |
+ // index is a non-negative smi < length. |
+ // When successful, object, index, and scratch are clobbered. |
+ // Otherwise, scratch and result are clobbered. |
+ static void GenerateFastCharCodeAt(MacroAssembler* masm, |
+ Register object, |
+ Register index, |
+ Register scratch, |
+ Register result, |
+ Label* receiver_not_string, |
+ Label* index_not_smi, |
+ Label* index_out_of_range, |
+ Label* slow_case); |
-class StringStubBase: public CodeStub { |
- public: |
+ // Generates code for creating a one-char string from the given char |
+ // code. May do a runtime call, so any register can be clobbered |
+ // and, if the given invoke flag specifies a call, an internal frame |
+ // is required. In tail call mode the result must be rax register. |
+ static void GenerateCharFromCode(MacroAssembler* masm, |
+ Register code, |
+ Register result, |
+ Register scratch, |
+ InvokeFlag flag); |
+ |
// Generate code for copying characters using a simple loop. This should only |
// be used in places where the number of characters is small and the |
// additional setup and checking in GenerateCopyCharactersREP adds too much |
// overhead. Copying of overlapping regions is not supported. |
- void GenerateCopyCharacters(MacroAssembler* masm, |
+ static void GenerateCopyCharacters(MacroAssembler* masm, |
Register dest, |
Register src, |
Register count, |
@@ -832,7 +863,7 @@ |
// Generate code for copying characters using the rep movs instruction. |
// Copies rcx characters from rsi to rdi. Copying of overlapping regions is |
// not supported. |
- void GenerateCopyCharactersREP(MacroAssembler* masm, |
+ static void GenerateCopyCharactersREP(MacroAssembler* masm, |
Register dest, // Must be rdi. |
Register src, // Must be rsi. |
Register count, // Must be rcx. |
@@ -843,7 +874,7 @@ |
// not found by probing a jump to the label not_found is performed. This jump |
// does not guarantee that the string is not in the symbol table. If the |
// string is found the code falls through with the string in register rax. |
- void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, |
+ static void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, |
Register c1, |
Register c2, |
Register scratch1, |
@@ -853,17 +884,19 @@ |
Label* not_found); |
// Generate string hash. |
- void GenerateHashInit(MacroAssembler* masm, |
+ static void GenerateHashInit(MacroAssembler* masm, |
Register hash, |
Register character, |
Register scratch); |
- void GenerateHashAddCharacter(MacroAssembler* masm, |
+ static void GenerateHashAddCharacter(MacroAssembler* masm, |
Register hash, |
Register character, |
Register scratch); |
- void GenerateHashGetHash(MacroAssembler* masm, |
+ static void GenerateHashGetHash(MacroAssembler* masm, |
Register hash, |
Register scratch); |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
}; |
@@ -874,7 +907,7 @@ |
}; |
-class StringAddStub: public StringStubBase { |
+class StringAddStub: public CodeStub { |
public: |
explicit StringAddStub(StringAddFlags flags) { |
string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0); |
@@ -891,7 +924,7 @@ |
}; |
-class SubStringStub: public StringStubBase { |
+class SubStringStub: public CodeStub { |
public: |
SubStringStub() {} |