__ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r2,
r3);
if (cc == eq) {
- StringCompareStub::GenerateFlatAsciiStringEquals(masm,
- lhs,
- rhs,
- r2,
- r3,
- r4);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, lhs, rhs, r2, r3, r4);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(masm,
- lhs,
- rhs,
- r2,
- r3,
- r4,
- r5);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, lhs, rhs, r2, r3, r4,
+ r5);
}
// Never falls through to here.
const Register scratch = r1;
- if (save_doubles_ == kSaveFPRegs) {
+ if (save_doubles()) {
__ SaveFPRegs(sp, scratch);
}
const int argument_count = 1;
__ CallCFunction(
ExternalReference::store_buffer_overflow_function(isolate()),
argument_count);
- if (save_doubles_ == kSaveFPRegs) {
+ if (save_doubles()) {
__ RestoreFPRegs(sp, scratch);
}
__ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0).
}
-void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3) {
+void StringHelper::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
+ Register left, Register right,
+ Register scratch1,
+ Register scratch2,
+ Register scratch3) {
Register length = scratch1;
// Compare lengths.
}
-void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Register scratch4) {
+void StringHelper::GenerateCompareFlatAsciiStrings(
+ MacroAssembler* masm, Register left, Register right, Register scratch1,
+ Register scratch2, Register scratch3, Register scratch4) {
Label result_not_equal, compare_lengths;
// Find minimum length and length difference.
__ ldr(scratch1, FieldMemOperand(left, String::kLengthOffset));
}
-void StringCompareStub::GenerateAsciiCharsCompareLoop(
- MacroAssembler* masm,
- Register left,
- Register right,
- Register length,
- Register scratch1,
- Register scratch2,
- Label* chars_not_equal) {
+void StringHelper::GenerateAsciiCharsCompareLoop(
+ MacroAssembler* masm, Register left, Register right, Register length,
+ Register scratch1, Register scratch2, Label* chars_not_equal) {
// Change index to run from -length to -1 by adding length to string
// start. This means that loop ends when index reaches zero, which
// doesn't need an additional compare.
// Compare flat ASCII strings natively. Remove arguments from stack first.
__ IncrementCounter(counters->string_compare_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
- GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
// Compare flat ASCII strings. Returns when done.
if (equality) {
- StringCompareStub::GenerateFlatAsciiStringEquals(
- masm, left, right, tmp1, tmp2, tmp3);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, left, right, tmp1, tmp2,
+ tmp3);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(
- masm, left, right, tmp1, tmp2, tmp3, tmp4);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, left, right, tmp1, tmp2,
+ tmp3, tmp4);
}
// Handle more complex cases in runtime.
void ArrayNativeCode(MacroAssembler* masm, 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; }
- uint32_t MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
-};
-
-
class StringHelper : public AllStatic {
public:
// Generate code for copying a large number of characters. This function
static void GenerateHashGetHash(MacroAssembler* masm,
Register hash);
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
-};
-
-
-class SubStringStub: public PlatformCodeStub {
- public:
- explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
-
- private:
- Major MajorKey() const { return SubString; }
- uint32_t MinorKey() const { return 0; }
-
- void Generate(MacroAssembler* masm);
-};
-
-
-
-class StringCompareStub: public PlatformCodeStub {
- public:
- explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
-
// Compares two flat ASCII strings and returns result in r0.
static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
Register left,
Register scratch3,
Register scratch4);
- // Compares two flat ASCII strings for equality and returns result
- // in r0.
+ // Compares two flat ASCII strings for equality and returns result in r0.
static void GenerateFlatAsciiStringEquals(MacroAssembler* masm,
Register left,
Register right,
Register scratch3);
private:
- virtual Major MajorKey() const { return StringCompare; }
- virtual uint32_t MinorKey() const { return 0; }
- virtual void Generate(MacroAssembler* masm);
-
static void GenerateAsciiCharsCompareLoop(MacroAssembler* masm,
Register left,
Register right,
Register scratch1,
Register scratch2,
Label* chars_not_equal);
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
};
__ IncrementCounter(isolate()->counters()->string_compare_native(), 1, x10,
x11);
if (cond == eq) {
- StringCompareStub::GenerateFlatAsciiStringEquals(masm, lhs, rhs,
- x10, x11, x12);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, lhs, rhs, x10, x11, x12);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(masm, lhs, rhs,
- x10, x11, x12, x13);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, lhs, rhs, x10, x11, x12,
+ x13);
}
// Never fall through to here.
saved_fp_regs.Remove(*(masm->FPTmpList()));
__ PushCPURegList(saved_regs);
- if (save_doubles_ == kSaveFPRegs) {
+ if (save_doubles()) {
__ PushCPURegList(saved_fp_regs);
}
__ CallCFunction(
ExternalReference::store_buffer_overflow_function(isolate()), 1, 0);
- if (save_doubles_ == kSaveFPRegs) {
+ if (save_doubles()) {
__ PopCPURegList(saved_fp_regs);
}
__ PopCPURegList(saved_regs);
// Compare flat ASCII strings. Returns when done.
if (equality) {
- StringCompareStub::GenerateFlatAsciiStringEquals(
- masm, lhs, rhs, x10, x11, x12);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, lhs, rhs, x10, x11, x12);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(
- masm, lhs, rhs, x10, x11, x12, x13);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, lhs, rhs, x10, x11, x12,
+ x13);
}
// Handle more complex cases in runtime.
}
-void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3) {
+void StringHelper::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
+ Register left, Register right,
+ Register scratch1,
+ Register scratch2,
+ Register scratch3) {
DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3));
Register result = x0;
Register left_length = scratch1;
}
-void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Register scratch4) {
+void StringHelper::GenerateCompareFlatAsciiStrings(
+ MacroAssembler* masm, Register left, Register right, Register scratch1,
+ Register scratch2, Register scratch3, Register scratch4) {
DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3, scratch4));
Label result_not_equal, compare_lengths;
}
-void StringCompareStub::GenerateAsciiCharsCompareLoop(
- MacroAssembler* masm,
- Register left,
- Register right,
- Register length,
- Register scratch1,
- Register scratch2,
- Label* chars_not_equal) {
+void StringHelper::GenerateAsciiCharsCompareLoop(
+ MacroAssembler* masm, Register left, Register right, Register length,
+ Register scratch1, Register scratch2, Label* chars_not_equal) {
DCHECK(!AreAliased(left, right, length, scratch1, scratch2));
// Change index to run from -length to -1 by adding length to string
// Compare flat ASCII strings natively. Remove arguments from stack first,
// as this function will generate a return.
__ IncrementCounter(counters->string_compare_native(), 1, x3, x4);
- GenerateCompareFlatAsciiStrings(masm, left, right, x12, x13, x14, x15);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, left, right, x12, x13,
+ x14, x15);
__ Bind(&runtime);
void ArrayNativeCode(MacroAssembler* masm, 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; }
- uint32_t MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
-};
-
-
class StringHelper : public AllStatic {
public:
// TODO(all): These don't seem to be used any more. Delete them.
Register hash,
Register scratch);
+ // Compares two flat ASCII strings and returns result in x0.
+ static void GenerateCompareFlatAsciiStrings(
+ MacroAssembler* masm, Register left, Register right, Register scratch1,
+ Register scratch2, Register scratch3, Register scratch4);
+
+ // Compare two flat ASCII strings for equality and returns result in x0.
+ static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, Register left,
+ Register right, Register scratch1,
+ Register scratch2,
+ Register scratch3);
+
private:
+ static void GenerateAsciiCharsCompareLoop(MacroAssembler* masm, Register left,
+ Register right, Register length,
+ Register scratch1,
+ Register scratch2,
+ Label* chars_not_equal);
+
DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
};
LookupMode mode_;
};
-
-class SubStringStub: public PlatformCodeStub {
- public:
- explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
-
- private:
- Major MajorKey() const { return SubString; }
- uint32_t MinorKey() const { return 0; }
-
- void Generate(MacroAssembler* masm);
-};
-
-
-class StringCompareStub: public PlatformCodeStub {
- public:
- explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
-
- // Compares two flat ASCII strings and returns result in x0.
- static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Register scratch4);
-
- // Compare two flat ASCII strings for equality and returns result
- // in x0.
- static void GenerateFlatAsciiStringEquals(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3);
-
- private:
- virtual Major MajorKey() const { return StringCompare; }
- virtual uint32_t MinorKey() const { return 0; }
- virtual void Generate(MacroAssembler* masm);
-
- static void GenerateAsciiCharsCompareLoop(MacroAssembler* masm,
- Register left,
- Register right,
- Register length,
- Register scratch1,
- Register scratch2,
- Label* chars_not_equal);
-};
-
} } // namespace v8::internal
#endif // V8_ARM64_CODE_STUBS_ARM64_H_
};
+class StoreBufferOverflowStub : public PlatformCodeStub {
+ public:
+ StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp)
+ : PlatformCodeStub(isolate) {
+ minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs);
+ }
+
+ void Generate(MacroAssembler* masm);
+
+ static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
+ virtual bool SometimesSetsUpAFrame() { return false; }
+
+ private:
+ Major MajorKey() const OVERRIDE { return StoreBufferOverflow; }
+
+ bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
+
+ class SaveDoublesBits : public BitField<bool, 0, 1> {};
+
+ DISALLOW_COPY_AND_ASSIGN(StoreBufferOverflowStub);
+};
+
+
+class SubStringStub : public PlatformCodeStub {
+ public:
+ explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
+
+ private:
+ Major MajorKey() const OVERRIDE { return SubString; }
+
+ void Generate(MacroAssembler* masm);
+
+ DISALLOW_COPY_AND_ASSIGN(SubStringStub);
+};
+
+
+class StringCompareStub : public PlatformCodeStub {
+ public:
+ explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
+
+ private:
+ virtual Major MajorKey() const { return StringCompare; }
+
+ virtual void Generate(MacroAssembler* masm);
+
+ DISALLOW_COPY_AND_ASSIGN(StringCompareStub);
+};
} } // namespace v8::internal
#endif // V8_CODE_STUBS_H_
// store the registers in any particular way, but we do have to store and
// restore them.
__ pushad();
- if (save_doubles_ == kSaveFPRegs) {
+ if (save_doubles()) {
__ sub(esp, Immediate(kDoubleSize * XMMRegister::kMaxNumRegisters));
for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) {
XMMRegister reg = XMMRegister::from_code(i);
__ CallCFunction(
ExternalReference::store_buffer_overflow_function(isolate()),
argument_count);
- if (save_doubles_ == kSaveFPRegs) {
+ if (save_doubles()) {
for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) {
XMMRegister reg = XMMRegister::from_code(i);
__ movsd(reg, Operand(esp, i * kDoubleSize));
// Inline comparison of ASCII strings.
if (cc == equal) {
- StringCompareStub::GenerateFlatAsciiStringEquals(masm,
- edx,
- eax,
- ecx,
- ebx);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, edx, eax, ecx, ebx);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(masm,
- edx,
- eax,
- ecx,
- ebx,
- edi);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx,
+ edi);
}
#ifdef DEBUG
__ Abort(kUnexpectedFallThroughFromStringComparison);
}
-void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2) {
+void StringHelper::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
+ Register left, Register right,
+ Register scratch1,
+ Register scratch2) {
Register length = scratch1;
// Compare lengths.
}
-void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3) {
+void StringHelper::GenerateCompareFlatAsciiStrings(
+ MacroAssembler* masm, Register left, Register right, Register scratch1,
+ Register scratch2, Register scratch3) {
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->string_compare_native(), 1);
}
-void StringCompareStub::GenerateAsciiCharsCompareLoop(
- MacroAssembler* masm,
- Register left,
- Register right,
- Register length,
- Register scratch,
- Label* chars_not_equal,
+void StringHelper::GenerateAsciiCharsCompareLoop(
+ MacroAssembler* masm, Register left, Register right, Register length,
+ Register scratch, Label* chars_not_equal,
Label::Distance chars_not_equal_near) {
// Change index to run from -length to -1 by adding length to string
// start. This means that loop ends when index reaches zero, which
__ pop(ecx);
__ add(esp, Immediate(2 * kPointerSize));
__ push(ecx);
- GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
// Compare flat ASCII strings. Returns when done.
if (equality) {
- StringCompareStub::GenerateFlatAsciiStringEquals(
- masm, left, right, tmp1, tmp2);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, left, right, tmp1, tmp2);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(
- masm, left, right, tmp1, tmp2, tmp3);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, left, right, tmp1, tmp2,
+ tmp3);
}
// Handle more complex cases in runtime.
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; }
- uint32_t MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
-};
-
-
class StringHelper : public AllStatic {
public:
// Generate code for copying characters using the rep movs instruction.
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; }
- uint32_t MinorKey() const { return 0; }
-
- void Generate(MacroAssembler* masm);
-};
-
-
-class StringCompareStub: public PlatformCodeStub {
- public:
- explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
-
// Compares two flat ASCII strings and returns result in eax.
static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
- Register left,
- Register right,
+ Register left, Register right,
Register scratch1,
Register scratch2,
Register scratch3);
- // Compares two flat ASCII strings for equality and returns result
- // in eax.
+ // Compares two flat ASCII strings for equality and returns result in eax.
static void GenerateFlatAsciiStringEquals(MacroAssembler* masm,
Register left,
Register right,
Register scratch2);
private:
- virtual Major MajorKey() const { return StringCompare; }
- virtual uint32_t MinorKey() const { return 0; }
- virtual void Generate(MacroAssembler* masm);
-
static void GenerateAsciiCharsCompareLoop(
MacroAssembler* masm,
Register left,
Register scratch,
Label* chars_not_equal,
Label::Distance chars_not_equal_near = Label::kFar);
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
};
void StoreBufferOverflowStub::Generate(MacroAssembler* masm) {
- __ PushCallerSaved(save_doubles_);
+ __ PushCallerSaved(save_doubles() ? kSaveFPRegs : kDontSaveFPRegs);
const int argument_count = 1;
__ PrepareCallCFunction(argument_count);
__ LoadAddress(arg_reg_1,
__ CallCFunction(
ExternalReference::store_buffer_overflow_function(isolate()),
argument_count);
- __ PopCallerSaved(save_doubles_);
+ __ PopCallerSaved(save_doubles() ? kSaveFPRegs : kDontSaveFPRegs);
__ ret(0);
}
// Inline comparison of ASCII strings.
if (cc == equal) {
- StringCompareStub::GenerateFlatAsciiStringEquals(masm,
- rdx,
- rax,
- rcx,
- rbx);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, rdx, rax, rcx, rbx);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(masm,
- rdx,
- rax,
- rcx,
- rbx,
- rdi,
- r8);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi,
+ r8);
}
#ifdef DEBUG
}
-void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2) {
+void StringHelper::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
+ Register left, Register right,
+ Register scratch1,
+ Register scratch2) {
Register length = scratch1;
// Compare lengths.
}
-void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Register scratch4) {
+void StringHelper::GenerateCompareFlatAsciiStrings(
+ MacroAssembler* masm, Register left, Register right, Register scratch1,
+ Register scratch2, Register scratch3, Register scratch4) {
// Ensure that you can always subtract a string length from a non-negative
// number (e.g. another length).
STATIC_ASSERT(String::kMaxLength < 0x7fffffff);
}
-void StringCompareStub::GenerateAsciiCharsCompareLoop(
- MacroAssembler* masm,
- Register left,
- Register right,
- Register length,
- Register scratch,
- Label* chars_not_equal,
- Label::Distance near_jump) {
+void StringHelper::GenerateAsciiCharsCompareLoop(
+ MacroAssembler* masm, Register left, Register right, Register length,
+ Register scratch, Label* chars_not_equal, Label::Distance near_jump) {
// Change index to run from -length to -1 by adding length to string
// start. This means that loop ends when index reaches zero, which
// doesn't need an additional compare.
__ PopReturnAddressTo(rcx);
__ addp(rsp, Immediate(2 * kPointerSize));
__ PushReturnAddressFrom(rcx);
- GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi,
+ r8);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
// Compare flat ASCII strings. Returns when done.
if (equality) {
- StringCompareStub::GenerateFlatAsciiStringEquals(
- masm, left, right, tmp1, tmp2);
+ StringHelper::GenerateFlatAsciiStringEquals(masm, left, right, tmp1, tmp2);
} else {
- StringCompareStub::GenerateCompareFlatAsciiStrings(
- masm, left, right, tmp1, tmp2, tmp3, kScratchRegister);
+ StringHelper::GenerateCompareFlatAsciiStrings(masm, left, right, tmp1, tmp2,
+ tmp3, kScratchRegister);
}
// Handle more complex cases in runtime.
void ArrayNativeCode(MacroAssembler* masm, 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; }
- uint32_t MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
-};
-
class StringHelper : public AllStatic {
public:
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; }
- uint32_t MinorKey() const { return 0; }
-
- void Generate(MacroAssembler* masm);
-};
-
-
-class StringCompareStub: public PlatformCodeStub {
- public:
- explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
-
// Compares two flat ASCII strings and returns result in rax.
- static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
- Register left,
- Register right,
- Register scratch1,
- Register scratch2,
- Register scratch3,
- Register scratch4);
-
- // Compares two flat ASCII strings for equality and returns result
- // in rax.
+ static void GenerateCompareFlatAsciiStrings(
+ MacroAssembler* masm, Register left, Register right, Register scratch1,
+ Register scratch2, Register scratch3, Register scratch4);
+
+ // Compares two flat ASCII strings for equality and returns result in rax.
static void GenerateFlatAsciiStringEquals(MacroAssembler* masm,
Register left,
Register right,
Register scratch2);
private:
- virtual Major MajorKey() const { return StringCompare; }
- virtual uint32_t MinorKey() const { return 0; }
- virtual void Generate(MacroAssembler* masm);
-
static void GenerateAsciiCharsCompareLoop(
MacroAssembler* masm,
Register left,
Register scratch,
Label* chars_not_equal,
Label::Distance near_jump = Label::kFar);
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
};