text: // Copyright 2011 the V8 project authors. All rights reserved.
  // Use of this source code is governed by a BSD-style license that can be
  // found in the LICENSE file.
  
  #ifndef V8_IA32_CODE_STUBS_IA32_H_
  #define V8_IA32_CODE_STUBS_IA32_H_
  
  #include "src/ic-inl.h"
  #include "src/macro-assembler.h"
  
  namespace v8 {
  namespace internal {
  
  
  void ArrayNativeCode(MacroAssembler* masm,
                       bool construct_call,
                       Label* call_generic_code);
  
  
  class StoreBufferOverflowStub: public PlatformCodeStub {
   public:
    StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp)
        : PlatformCodeStub(isolate), save_doubles_(save_fp) { }
  
    void Generate(MacroAssembler* masm);
  
    static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
    virtual bool SometimesSetsUpAFrame() { return false; }
  
   private:
    SaveFPRegsMode save_doubles_;
  
    Major MajorKey() const { return StoreBufferOverflow; }
    int MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
  };
  
  
  class StringHelper : public AllStatic {
   public:
    // Generate code for copying characters using the rep movs instruction.
    // Copies ecx characters from esi to edi. Copying of overlapping regions is
    // not supported.
    static void GenerateCopyCharacters(MacroAssembler* masm,
                                       Register dest,
                                       Register src,
                                       Register count,
                                       Register scratch,
                                       String::Encoding encoding);
  
    // Generate string hash.
    static void GenerateHashInit(MacroAssembler* masm,
                                 Register hash,
                                 Register character,
                                 Register scratch);
    static void GenerateHashAddCharacter(MacroAssembler* masm,
                                         Register hash,
                                         Register character,
                                         Register scratch);
    static void GenerateHashGetHash(MacroAssembler* masm,
                                    Register hash,
                                    Register scratch);
  
   private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
  };
  
  
  class SubStringStub: public PlatformCodeStub {
   public:
    explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
  
   private:
    Major MajorKey() const { return SubString; }
    int MinorKey() const { return 0; }
  
    void Generate(MacroAssembler* masm);
  };
  
  
  class StringCompareStub: public PlatformCo