diff options
Diffstat (limited to 'deps/v8/src/ia32/codegen-ia32.h')
-rw-r--r-- | deps/v8/src/ia32/codegen-ia32.h | 83 |
1 files changed, 69 insertions, 14 deletions
diff --git a/deps/v8/src/ia32/codegen-ia32.h b/deps/v8/src/ia32/codegen-ia32.h index 3d17c96ad0..000222ff1c 100644 --- a/deps/v8/src/ia32/codegen-ia32.h +++ b/deps/v8/src/ia32/codegen-ia32.h @@ -541,15 +541,18 @@ class CodeGenerator: public AstVisitor { // Fast support for Math.random(). void GenerateRandomPositiveSmi(ZoneList<Expression*>* args); - // Fast support for Math.sin and Math.cos. - enum MathOp { SIN, COS }; - void GenerateFastMathOp(MathOp op, ZoneList<Expression*>* args); - inline void GenerateMathSin(ZoneList<Expression*>* args); - inline void GenerateMathCos(ZoneList<Expression*>* args); - // Fast support for StringAdd. void GenerateStringAdd(ZoneList<Expression*>* args); + // Fast support for SubString. + void GenerateSubString(ZoneList<Expression*>* args); + + // Fast support for StringCompare. + void GenerateStringCompare(ZoneList<Expression*>* args); + + // Support for direct calls from JavaScript to native RegExp code. + void GenerateRegExpExec(ZoneList<Expression*>* args); + // Simple condition analysis. enum ConditionAnalysis { ALWAYS_TRUE, @@ -750,7 +753,32 @@ enum StringAddFlags { }; -class StringAddStub: public CodeStub { +class StringStubBase: public CodeStub { + public: + // 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, + Register dest, + Register src, + Register count, + Register scratch, + bool ascii); + + // Generate code for copying characters using the rep movs instruction. + // Copies ecx characters from esi to edi. Copying of overlapping regions is + // not supported. + void GenerateCopyCharactersREP(MacroAssembler* masm, + Register dest, // Must be edi. + Register src, // Must be esi. + Register count, // Must be ecx. + Register scratch, // Neither of the above. + bool ascii); +}; + + +class StringAddStub: public StringStubBase { public: explicit StringAddStub(StringAddFlags flags) { string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0); @@ -762,18 +790,45 @@ class StringAddStub: public CodeStub { void Generate(MacroAssembler* masm); - void GenerateCopyCharacters(MacroAssembler* masm, - Register desc, - Register src, - Register count, - Register scratch, - bool ascii); - // Should the stub check whether arguments are strings? bool string_check_; }; +class SubStringStub: public StringStubBase { + public: + SubStringStub() {} + + private: + Major MajorKey() { return SubString; } + int MinorKey() { return 0; } + + void Generate(MacroAssembler* masm); +}; + + +class StringCompareStub: public StringStubBase { + public: + explicit StringCompareStub() { + } + + // Compare two flat ascii strings and returns result in eax after popping two + // arguments from the stack. + static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, + Register left, + Register right, + Register scratch1, + Register scratch2, + Register scratch3); + + private: + Major MajorKey() { return StringCompare; } + int MinorKey() { return 0; } + + void Generate(MacroAssembler* masm); +}; + + } } // namespace v8::internal #endif // V8_IA32_CODEGEN_IA32_H_ |