diff options
Diffstat (limited to 'chromium/v8/src/ia32/code-stubs-ia32.h')
-rw-r--r-- | chromium/v8/src/ia32/code-stubs-ia32.h | 152 |
1 files changed, 25 insertions, 127 deletions
diff --git a/chromium/v8/src/ia32/code-stubs-ia32.h b/chromium/v8/src/ia32/code-stubs-ia32.h index 14259241c85..8700181a86f 100644 --- a/chromium/v8/src/ia32/code-stubs-ia32.h +++ b/chromium/v8/src/ia32/code-stubs-ia32.h @@ -1,36 +1,12 @@ // Copyright 2011 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// 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 "macro-assembler.h" -#include "code-stubs.h" -#include "ic-inl.h" +#include "src/macro-assembler.h" +#include "src/ic-inl.h" namespace v8 { namespace internal { @@ -40,37 +16,11 @@ void ArrayNativeCode(MacroAssembler* masm, bool construct_call, Label* call_generic_code); -// Compute a transcendental math function natively, or call the -// TranscendentalCache runtime function. -class TranscendentalCacheStub: public PlatformCodeStub { - public: - enum ArgumentType { - TAGGED = 0, - UNTAGGED = 1 << TranscendentalCache::kTranscendentalTypeBits - }; - - TranscendentalCacheStub(TranscendentalCache::Type type, - ArgumentType argument_type) - : type_(type), argument_type_(argument_type) {} - void Generate(MacroAssembler* masm); - static void GenerateOperation(MacroAssembler* masm, - TranscendentalCache::Type type); - private: - TranscendentalCache::Type type_; - ArgumentType argument_type_; - - Major MajorKey() { return TranscendentalCache; } - int MinorKey() { return type_ | argument_type_; } - Runtime::FunctionId RuntimeFunction(); -}; - class StoreBufferOverflowStub: public PlatformCodeStub { public: - explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp) - : save_doubles_(save_fp) { - ASSERT(CpuFeatures::IsSafeForSnapshot(SSE2) || save_fp == kDontSaveFPRegs); - } + StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) + : PlatformCodeStub(isolate), save_doubles_(save_fp) { } void Generate(MacroAssembler* masm); @@ -87,43 +37,15 @@ class StoreBufferOverflowStub: public PlatformCodeStub { class StringHelper : public AllStatic { 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. + // 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, - 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. - static void GenerateCopyCharactersREP(MacroAssembler* masm, - Register dest, // Must be edi. - Register src, // Must be esi. - Register count, // Must be ecx. - Register scratch, // Neither of above. - bool ascii); - - // Probe the string table for a two character string. If the string - // requires non-standard hashing a jump to the label not_probed is - // performed and registers c1 and c2 are preserved. In all other - // cases they are clobbered. If the string is 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 string table. If the - // string is found the code falls through with the string in - // register eax. - static void GenerateTwoCharacterStringTableProbe(MacroAssembler* masm, - Register c1, - Register c2, - Register scratch1, - Register scratch2, - Register scratch3, - Label* not_probed, - Label* not_found); + String::Encoding encoding); // Generate string hash. static void GenerateHashInit(MacroAssembler* masm, @@ -143,34 +65,9 @@ class StringHelper : public AllStatic { }; -class StringAddStub: public PlatformCodeStub { - public: - explicit StringAddStub(StringAddFlags flags) : flags_(flags) {} - - private: - Major MajorKey() { return StringAdd; } - int MinorKey() { return flags_; } - - void Generate(MacroAssembler* masm); - - void GenerateConvertArgument(MacroAssembler* masm, - int stack_offset, - Register arg, - Register scratch1, - Register scratch2, - Register scratch3, - Label* slow); - - void GenerateRegisterArgsPush(MacroAssembler* masm); - void GenerateRegisterArgsPop(MacroAssembler* masm, Register temp); - - const StringAddFlags flags_; -}; - - class SubStringStub: public PlatformCodeStub { public: - SubStringStub() {} + explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} private: Major MajorKey() { return SubString; } @@ -182,7 +79,7 @@ class SubStringStub: public PlatformCodeStub { class StringCompareStub: public PlatformCodeStub { public: - StringCompareStub() { } + explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) { } // Compares two flat ASCII strings and returns result in eax. static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, @@ -220,11 +117,13 @@ class NameDictionaryLookupStub: public PlatformCodeStub { public: enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; - NameDictionaryLookupStub(Register dictionary, + NameDictionaryLookupStub(Isolate* isolate, + Register dictionary, Register result, Register index, LookupMode mode) - : dictionary_(dictionary), result_(result), index_(index), mode_(mode) { } + : PlatformCodeStub(isolate), + dictionary_(dictionary), result_(result), index_(index), mode_(mode) { } void Generate(MacroAssembler* masm); @@ -280,12 +179,14 @@ class NameDictionaryLookupStub: public PlatformCodeStub { class RecordWriteStub: public PlatformCodeStub { public: - RecordWriteStub(Register object, + RecordWriteStub(Isolate* isolate, + Register object, Register value, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) - : object_(object), + : PlatformCodeStub(isolate), + object_(object), value_(value), address_(address), remembered_set_action_(remembered_set_action), @@ -293,7 +194,6 @@ class RecordWriteStub: public PlatformCodeStub { regs_(object, // An input reg. address, // An input reg. value) { // One scratch reg. - ASSERT(CpuFeatures::IsSafeForSnapshot(SSE2) || fp_mode == kDontSaveFPRegs); } enum Mode { @@ -435,11 +335,10 @@ class RecordWriteStub: public PlatformCodeStub { if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->push(eax); if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->push(edx); if (mode == kSaveFPRegs) { - CpuFeatureScope scope(masm, SSE2); masm->sub(esp, - Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); + Immediate(kDoubleSize * (XMMRegister::kMaxNumRegisters - 1))); // Save all XMM registers except XMM0. - for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { + for (int i = XMMRegister::kMaxNumRegisters - 1; i > 0; i--) { XMMRegister reg = XMMRegister::from_code(i); masm->movsd(Operand(esp, (i - 1) * kDoubleSize), reg); } @@ -449,14 +348,13 @@ class RecordWriteStub: public PlatformCodeStub { inline void RestoreCallerSaveRegisters(MacroAssembler*masm, SaveFPRegsMode mode) { if (mode == kSaveFPRegs) { - CpuFeatureScope scope(masm, SSE2); // Restore all XMM registers except XMM0. - for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { + for (int i = XMMRegister::kMaxNumRegisters - 1; i > 0; i--) { XMMRegister reg = XMMRegister::from_code(i); masm->movsd(reg, Operand(esp, (i - 1) * kDoubleSize)); } masm->add(esp, - Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); + Immediate(kDoubleSize * (XMMRegister::kMaxNumRegisters - 1))); } if (!scratch0_.is(edx) && !scratch1_.is(edx)) masm->pop(edx); if (!scratch0_.is(eax) && !scratch1_.is(eax)) masm->pop(eax); @@ -505,7 +403,7 @@ class RecordWriteStub: public PlatformCodeStub { MacroAssembler* masm, OnNoNeedToInformIncrementalMarker on_no_need, Mode mode); - void InformIncrementalMarker(MacroAssembler* masm, Mode mode); + void InformIncrementalMarker(MacroAssembler* masm); Major MajorKey() { return RecordWrite; } |