X87: Rename ascii to one-byte where applicable.

port r23840.

original commit message:

  Rename ascii to one-byte where applicable.

BUG=
R=weiliang.lin@intel.com

Review URL: https://codereview.chromium.org/565853002

Patch from Jing Bao <jing.bao@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23895 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e3ab5b58
......@@ -899,7 +899,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
__ JumpIfNotSmi(ebx, &runtime);
__ cmp(ebx, FieldOperand(edx, String::kLengthOffset));
__ j(above_equal, &runtime);
__ mov(edx, FieldOperand(ecx, JSRegExp::kDataAsciiCodeOffset));
__ mov(edx, FieldOperand(ecx, JSRegExp::kDataOneByteCodeOffset));
__ Move(ecx, Immediate(1)); // Type is one byte.
// (E) Carry on. String handling is done.
......@@ -913,7 +913,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
// eax: subject string
// ebx: previous index (smi)
// edx: code
// ecx: encoding of subject string (1 if ASCII, 0 if two_byte);
// ecx: encoding of subject string (1 if one_byte, 0 if two_byte);
// All checks done. Now push arguments for native regexp code.
Counters* counters = isolate()->counters();
__ IncrementCounter(counters->regexp_entry_native(), 1);
......@@ -958,7 +958,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
// esi: original subject string
// eax: underlying subject string
// ebx: previous index
// ecx: encoding of subject string (1 if ASCII 0 if two_byte);
// ecx: encoding of subject string (1 if one_byte 0 if two_byte);
// edx: code
// Argument 4: End of string data
// Argument 3: Start of string data
......@@ -1414,15 +1414,15 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
__ bind(&check_for_strings);
__ JumpIfNotBothSequentialAsciiStrings(edx, eax, ecx, ebx,
&check_unequal_objects);
__ JumpIfNotBothSequentialOneByteStrings(edx, eax, ecx, ebx,
&check_unequal_objects);
// Inline comparison of ASCII strings.
// Inline comparison of one-byte strings.
if (cc == equal) {
StringHelper::GenerateFlatAsciiStringEquals(masm, edx, eax, ecx, ebx);
StringHelper::GenerateFlatOneByteStringEquals(masm, edx, eax, ecx, ebx);
} else {
StringHelper::GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx,
edi);
StringHelper::GenerateCompareFlatOneByteStrings(masm, edx, eax, ecx, ebx,
edi);
}
#ifdef DEBUG
__ Abort(kUnexpectedFallThroughFromStringComparison);
......@@ -2494,7 +2494,7 @@ void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
STATIC_ASSERT(kSmiShiftSize == 0);
// At this point code register contains smi tagged ASCII char code.
// At this point code register contains smi tagged one byte char code.
__ mov(result_, FieldOperand(result_,
code_, times_half_pointer_size,
FixedArray::kHeaderSize));
......@@ -2658,7 +2658,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
__ test(ebx, Immediate(kStringEncodingMask));
__ j(zero, &two_byte_slice, Label::kNear);
__ AllocateAsciiSlicedString(eax, ebx, no_reg, &runtime);
__ AllocateOneByteSlicedString(eax, ebx, no_reg, &runtime);
__ jmp(&set_slice_header, Label::kNear);
__ bind(&two_byte_slice);
__ AllocateTwoByteSlicedString(eax, ebx, no_reg, &runtime);
......@@ -2705,8 +2705,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
__ test_b(ebx, kStringEncodingMask);
__ j(zero, &two_byte_sequential);
// Sequential ASCII string. Allocate the result.
__ AllocateAsciiString(eax, ecx, ebx, edx, edi, &runtime_drop_two);
// Sequential one byte string. Allocate the result.
__ AllocateOneByteString(eax, ecx, ebx, edx, edi, &runtime_drop_two);
// eax: result string
// ecx: result string length
......@@ -2777,10 +2777,11 @@ void SubStringStub::Generate(MacroAssembler* masm) {
}
void StringHelper::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
Register left, Register right,
Register scratch1,
Register scratch2) {
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
Register left,
Register right,
Register scratch1,
Register scratch2) {
Register length = scratch1;
// Compare lengths.
......@@ -2803,8 +2804,8 @@ void StringHelper::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
// Compare characters.
__ bind(&compare_chars);
GenerateAsciiCharsCompareLoop(masm, left, right, length, scratch2,
&strings_not_equal, Label::kNear);
GenerateOneByteCharsCompareLoop(masm, left, right, length, scratch2,
&strings_not_equal, Label::kNear);
// Characters are equal.
__ Move(eax, Immediate(Smi::FromInt(EQUAL)));
......@@ -2812,7 +2813,7 @@ void StringHelper::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
}
void StringHelper::GenerateCompareFlatAsciiStrings(
void StringHelper::GenerateCompareFlatOneByteStrings(
MacroAssembler* masm, Register left, Register right, Register scratch1,
Register scratch2, Register scratch3) {
Counters* counters = masm->isolate()->counters();
......@@ -2840,8 +2841,8 @@ void StringHelper::GenerateCompareFlatAsciiStrings(
// Compare characters.
Label result_not_equal;
GenerateAsciiCharsCompareLoop(masm, left, right, min_length, scratch2,
&result_not_equal, Label::kNear);
GenerateOneByteCharsCompareLoop(masm, left, right, min_length, scratch2,
&result_not_equal, Label::kNear);
// Compare lengths - strings up to min-length are equal.
__ bind(&compare_lengths);
......@@ -2875,7 +2876,7 @@ void StringHelper::GenerateCompareFlatAsciiStrings(
}
void StringHelper::GenerateAsciiCharsCompareLoop(
void StringHelper::GenerateOneByteCharsCompareLoop(
MacroAssembler* masm, Register left, Register right, Register length,
Register scratch, Label* chars_not_equal,
Label::Distance chars_not_equal_near) {
......@@ -2923,15 +2924,16 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
__ bind(&not_same);
// Check that both objects are sequential ASCII strings.
__ JumpIfNotBothSequentialAsciiStrings(edx, eax, ecx, ebx, &runtime);
// Check that both objects are sequential one-byte strings.
__ JumpIfNotBothSequentialOneByteStrings(edx, eax, ecx, ebx, &runtime);
// Compare flat ASCII strings.
// Compare flat one-byte strings.
// Drop arguments from the stack.
__ pop(ecx);
__ add(esp, Immediate(2 * kPointerSize));
__ push(ecx);
StringHelper::GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi);
StringHelper::GenerateCompareFlatOneByteStrings(masm, edx, eax, ecx, ebx,
edi);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
......@@ -3198,16 +3200,17 @@ void CompareICStub::GenerateStrings(MacroAssembler* masm) {
__ bind(&do_compare);
}
// Check that both strings are sequential ASCII.
// Check that both strings are sequential one-byte.
Label runtime;
__ JumpIfNotBothSequentialAsciiStrings(left, right, tmp1, tmp2, &runtime);
__ JumpIfNotBothSequentialOneByteStrings(left, right, tmp1, tmp2, &runtime);
// Compare flat ASCII strings. Returns when done.
// Compare flat one byte strings. Returns when done.
if (equality) {
StringHelper::GenerateFlatAsciiStringEquals(masm, left, right, tmp1, tmp2);
StringHelper::GenerateFlatOneByteStringEquals(masm, left, right, tmp1,
tmp2);
} else {
StringHelper::GenerateCompareFlatAsciiStrings(masm, left, right, tmp1, tmp2,
tmp3);
StringHelper::GenerateCompareFlatOneByteStrings(masm, left, right, tmp1,
tmp2, tmp3);
}
// Handle more complex cases in runtime.
......
......@@ -26,28 +26,23 @@ class StringHelper : public AllStatic {
Register scratch,
String::Encoding encoding);
// Compares two flat ASCII strings and returns result in eax.
static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
// Compares two flat one byte strings and returns result in eax.
static void GenerateCompareFlatOneByteStrings(MacroAssembler* masm,
Register left, Register right,
Register scratch1,
Register scratch2,
Register scratch3);
// Compares two flat one byte strings for equality and returns result in eax.
static void GenerateFlatOneByteStringEquals(MacroAssembler* masm,
Register left, Register right,
Register scratch1,
Register scratch2,
Register scratch3);
// Compares two flat ASCII strings for equality and returns result in eax.
static void GenerateFlatAsciiStringEquals(MacroAssembler* masm,
Register left,
Register right,
Register scratch1,
Register scratch2);
Register scratch2);
private:
static void GenerateAsciiCharsCompareLoop(
MacroAssembler* masm,
Register left,
Register right,
Register length,
Register scratch,
Label* chars_not_equal,
static void GenerateOneByteCharsCompareLoop(
MacroAssembler* masm, Register left, Register right, Register length,
Register scratch, Label* chars_not_equal,
Label::Distance chars_not_equal_near = Label::kFar);
DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
......
......@@ -531,7 +531,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
__ j(zero, &seq_string, Label::kNear);
// Handle external strings.
Label ascii_external, done;
Label one_byte_external, done;
if (FLAG_debug_code) {
// Assert that we do not have a cons or slice (indirect strings) here.
// Sequential strings have already been ruled out.
......@@ -546,22 +546,22 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
STATIC_ASSERT(kTwoByteStringTag == 0);
__ test_b(result, kStringEncodingMask);
__ mov(result, FieldOperand(string, ExternalString::kResourceDataOffset));
__ j(not_equal, &ascii_external, Label::kNear);
__ j(not_equal, &one_byte_external, Label::kNear);
// Two-byte string.
__ movzx_w(result, Operand(result, index, times_2, 0));
__ jmp(&done, Label::kNear);
__ bind(&ascii_external);
// Ascii string.
__ bind(&one_byte_external);
// One-byte string.
__ movzx_b(result, Operand(result, index, times_1, 0));
__ jmp(&done, Label::kNear);
// Dispatch on the encoding: ASCII or two-byte.
Label ascii;
// Dispatch on the encoding: one-byte or two-byte.
Label one_byte;
__ bind(&seq_string);
STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0);
STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
__ test(result, Immediate(kStringEncodingMask));
__ j(not_zero, &ascii, Label::kNear);
__ j(not_zero, &one_byte, Label::kNear);
// Two-byte string.
// Load the two-byte character code into the result register.
......@@ -571,9 +571,9 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
SeqTwoByteString::kHeaderSize));
__ jmp(&done, Label::kNear);
// Ascii string.
// One-byte string.
// Load the byte into the result register.
__ bind(&ascii);
__ bind(&one_byte);
__ movzx_b(result, FieldOperand(string,
index,
times_1,
......
......@@ -3745,7 +3745,7 @@ void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
}
void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
void FullCodeGenerator::EmitFastOneByteArrayJoin(CallRuntime* expr) {
Label bailout, done, one_char_separator, long_separator,
non_trivial_array, not_size_one_array, loop,
loop_1, loop_1_condition, loop_2, loop_2_entry, loop_3, loop_3_entry;
......@@ -3803,7 +3803,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
array = no_reg;
// Check that all array elements are sequential ASCII strings, and
// Check that all array elements are sequential one-byte strings, and
// accumulate the sum of their lengths, as a smi-encoded value.
__ Move(index, Immediate(0));
__ Move(string_length, Immediate(0));
......@@ -3812,7 +3812,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
// scratch, string_length, elements.
if (generate_debug_code_) {
__ cmp(index, array_length);
__ Assert(less, kNoEmptyArraysHereInEmitFastAsciiArrayJoin);
__ Assert(less, kNoEmptyArraysHereInEmitFastOneByteArrayJoin);
}
__ bind(&loop);
__ mov(string, FieldOperand(elements,
......@@ -3850,7 +3850,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
// string_length: Sum of string lengths, as a smi.
// elements: FixedArray of strings.
// Check that the separator is a flat ASCII string.
// Check that the separator is a flat one-byte string.
__ mov(string, separator_operand);
__ JumpIfSmi(string, &bailout);
__ mov(scratch, FieldOperand(string, HeapObject::kMapOffset));
......@@ -3874,8 +3874,8 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
// Live registers and stack values:
// string_length
// elements
__ AllocateAsciiString(result_pos, string_length, scratch,
index, string, &bailout);
__ AllocateOneByteString(result_pos, string_length, scratch, index, string,
&bailout);
__ mov(result_operand, result_pos);
__ lea(result_pos, FieldOperand(result_pos, SeqOneByteString::kHeaderSize));
......@@ -3918,7 +3918,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
// One-character separator case
__ bind(&one_char_separator);
// Replace separator with its ASCII character value.
// Replace separator with its one-byte character value.
__ mov_b(scratch, FieldOperand(string, SeqOneByteString::kHeaderSize));
__ mov_b(separator_operand, scratch);
......
......@@ -1628,12 +1628,10 @@ void MacroAssembler::AllocateTwoByteString(Register result,
}
void MacroAssembler::AllocateAsciiString(Register result,
Register length,
Register scratch1,
Register scratch2,
Register scratch3,
Label* gc_required) {
void MacroAssembler::AllocateOneByteString(Register result, Register length,
Register scratch1, Register scratch2,
Register scratch3,
Label* gc_required) {
// Calculate the number of bytes needed for the characters in the string while
// observing object alignment.
DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0);
......@@ -1642,7 +1640,7 @@ void MacroAssembler::AllocateAsciiString(Register result,
add(scratch1, Immediate(kObjectAlignmentMask));
and_(scratch1, Immediate(~kObjectAlignmentMask));
// Allocate ASCII string in new space.
// Allocate one-byte string in new space.
Allocate(SeqOneByteString::kHeaderSize,
times_1,
scratch1,
......@@ -1655,7 +1653,7 @@ void MacroAssembler::AllocateAsciiString(Register result,
// Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(isolate()->factory()->ascii_string_map()));
Immediate(isolate()->factory()->one_byte_string_map()));
mov(scratch1, length);
SmiTag(scratch1);
mov(FieldOperand(result, String::kLengthOffset), scratch1);
......@@ -1664,20 +1662,18 @@ void MacroAssembler::AllocateAsciiString(Register result,
}
void MacroAssembler::AllocateAsciiString(Register result,
int length,
Register scratch1,
Register scratch2,
Label* gc_required) {
void MacroAssembler::AllocateOneByteString(Register result, int length,
Register scratch1, Register scratch2,
Label* gc_required) {
DCHECK(length > 0);
// Allocate ASCII string in new space.
// Allocate one-byte string in new space.
Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2,
gc_required, TAG_OBJECT);
// Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(isolate()->factory()->ascii_string_map()));
Immediate(isolate()->factory()->one_byte_string_map()));
mov(FieldOperand(result, String::kLengthOffset),
Immediate(Smi::FromInt(length)));
mov(FieldOperand(result, String::kHashFieldOffset),
......@@ -1699,10 +1695,10 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
}
void MacroAssembler::AllocateAsciiConsString(Register result,
Register scratch1,
Register scratch2,
Label* gc_required) {
void MacroAssembler::AllocateOneByteConsString(Register result,
Register scratch1,
Register scratch2,
Label* gc_required) {
Allocate(ConsString::kSize,
result,
scratch1,
......@@ -1712,7 +1708,7 @@ void MacroAssembler::AllocateAsciiConsString(Register result,
// Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(isolate()->factory()->cons_ascii_string_map()));
Immediate(isolate()->factory()->cons_one_byte_string_map()));
}
......@@ -1730,17 +1726,17 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
}
void MacroAssembler::AllocateAsciiSlicedString(Register result,
Register scratch1,
Register scratch2,
Label* gc_required) {
void MacroAssembler::AllocateOneByteSlicedString(Register result,
Register scratch1,
Register scratch2,
Label* gc_required) {
// Allocate heap number in new space.
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT);
// Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset),
Immediate(isolate()->factory()->sliced_ascii_string_map()));
Immediate(isolate()->factory()->sliced_one_byte_string_map()));
}
......@@ -2798,10 +2794,8 @@ void MacroAssembler::LookupNumberStringCache(Register object,
}
void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii(
Register instance_type,
Register scratch,
Label* failure) {
void MacroAssembler::JumpIfInstanceTypeIsNotSequentialOneByte(
Register instance_type, Register scratch, Label* failure) {
if (!scratch.is(instance_type)) {
mov(scratch, instance_type);
}
......@@ -2812,11 +2806,11 @@ void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii(
}
void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register object1,
Register object2,
Register scratch1,
Register scratch2,
Label* failure) {
void MacroAssembler::JumpIfNotBothSequentialOneByteStrings(Register object1,
Register object2,
Register scratch1,
Register scratch2,
Label* failure) {
// Check that both objects are not smis.
STATIC_ASSERT(kSmiTag == 0);
mov(scratch1, object1);
......@@ -2829,17 +2823,17 @@ void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register object1,
movzx_b(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset));
movzx_b(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset));
// Check that both are flat ASCII strings.
const int kFlatAsciiStringMask =
// Check that both are flat one-byte strings.
const int kFlatOneByteStringMask =
kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask;
const int kFlatAsciiStringTag =
const int kFlatOneByteStringTag =
kStringTag | kOneByteStringTag | kSeqStringTag;
// Interleave bits from both instance types and compare them in one check.
DCHECK_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
and_(scratch1, kFlatAsciiStringMask);
and_(scratch2, kFlatAsciiStringMask);
DCHECK_EQ(0, kFlatOneByteStringMask & (kFlatOneByteStringMask << 3));
and_(scratch1, kFlatOneByteStringMask);
and_(scratch2, kFlatOneByteStringMask);
lea(scratch1, Operand(scratch1, scratch2, times_8, 0));
cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3));
cmp(scratch1, kFlatOneByteStringTag | (kFlatOneByteStringTag << 3));
j(not_equal, failure);
}
......@@ -3178,12 +3172,12 @@ void MacroAssembler::EnsureNotWhite(
jmp(&is_data_object, Label::kNear);
bind(&not_external);
// Sequential string, either ASCII or UC16.
// Sequential string, either Latin1 or UC16.
DCHECK(kOneByteStringTag == 0x04);
and_(length, Immediate(kStringEncodingMask));
xor_(length, Immediate(kStringEncodingMask));
add(length, Immediate(0x04));
// Value now either 4 (if ASCII) or 8 (if UC16), i.e., char-size shifted
// Value now either 4 (if Latin1) or 8 (if UC16), i.e., char-size shifted
// by 2. If we multiply the string length as smi by this, it still
// won't overflow a 32-bit value.
DCHECK_EQ(SeqOneByteString::kMaxSize, SeqTwoByteString::kMaxSize);
......
......@@ -637,17 +637,11 @@ class MacroAssembler: public Assembler {
Register scratch2,
Register scratch3,
Label* gc_required);
void AllocateAsciiString(Register result,
Register length,
Register scratch1,
Register scratch2,
Register scratch3,
Label* gc_required);
void AllocateAsciiString(Register result,
int length,
Register scratch1,
Register scratch2,
Label* gc_required);
void AllocateOneByteString(Register result, Register length,
Register scratch1, Register scratch2,
Register scratch3, Label* gc_required);
void AllocateOneByteString(Register result, int length, Register scratch1,
Register scratch2, Label* gc_required);
// Allocate a raw cons string object. Only the map field of the result is
// initialized.
......@@ -655,10 +649,8 @@ class MacroAssembler: public Assembler {
Register scratch1,
Register scratch2,
Label* gc_required);
void AllocateAsciiConsString(Register result,
Register scratch1,
Register scratch2,
Label* gc_required);
void AllocateOneByteConsString(Register result, Register scratch1,
Register scratch2, Label* gc_required);
// Allocate a raw sliced string object. Only the map field of the result is
// initialized.
......@@ -666,10 +658,8 @@ class MacroAssembler: public Assembler {
Register scratch1,
Register scratch2,
Label* gc_required);
void AllocateAsciiSlicedString(Register result,
Register scratch1,
Register scratch2,
Label* gc_required);
void AllocateOneByteSlicedString(Register result, Register scratch1,
Register scratch2, Label* gc_required);
// Copy memory, byte-by-byte, from source to destination. Not optimized for
// long or aligned copies.
......@@ -888,20 +878,18 @@ class MacroAssembler: public Assembler {
Register scratch2,
Label* not_found);
// Check whether the instance type represents a flat ASCII string. Jump to the
// label if not. If the instance type can be scratched specify same register
// for both instance type and scratch.
void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type,
Register scratch,
Label* on_not_flat_ascii_string);
// Check whether the instance type represents a flat one-byte string. Jump to
// the label if not. If the instance type can be scratched specify same
// register for both instance type and scratch.
void JumpIfInstanceTypeIsNotSequentialOneByte(
Register instance_type, Register scratch,
Label* on_not_flat_one_byte_string);
// Checks if both objects are sequential ASCII strings, and jumps to label
// Checks if both objects are sequential one-byte strings, and jumps to label
// if either is not.
void JumpIfNotBothSequentialAsciiStrings(Register object1,
Register object2,
Register scratch1,
Register scratch2,
Label* on_not_flat_ascii_strings);
void JumpIfNotBothSequentialOneByteStrings(
Register object1, Register object2, Register scratch1, Register scratch2,
Label* on_not_flat_one_byte_strings);
// Checks if the given register or operand is a unique name
void JumpIfNotUniqueName(Register reg, Label* not_unique_name,
......
......@@ -219,7 +219,7 @@ void RegExpMacroAssemblerX87::CheckNotBackReferenceIgnoreCase(
__ add(eax, ebx);
BranchOrBacktrack(greater, on_no_match);
if (mode_ == ASCII) {
if (mode_ == LATIN1) {
Label success;
Label fail;
Label loop_increment;
......@@ -365,7 +365,7 @@ void RegExpMacroAssemblerX87::CheckNotBackReference(
Label loop;
__ bind(&loop);
if (mode_ == ASCII) {
if (mode_ == LATIN1) {
__ movzx_b(eax, Operand(edx, 0));
__ cmpb_al(Operand(ebx, 0));
} else {
......@@ -475,7 +475,7 @@ void RegExpMacroAssemblerX87::CheckBitInTable(
Label* on_bit_set) {
__ mov(eax, Immediate(table));
Register index = current_character();
if (mode_ != ASCII || kTableMask != String::kMaxOneByteCharCode) {
if (mode_ != LATIN1 || kTableMask != String::kMaxOneByteCharCode) {
__ mov(ebx, kTableSize - 1);
__ and_(ebx, current_character());
index = ebx;
......@@ -492,7 +492,7 @@ bool RegExpMacroAssemblerX87::CheckSpecialCharacterClass(uc16 type,
switch (type) {
case 's':
// Match space-characters
if (mode_ == ASCII) {
if (mode_ == LATIN1) {
// One byte space characters are '\t'..'\r', ' ' and \u00a0.
Label success;
__ cmp(current_character(), ' ');
......@@ -542,8 +542,8 @@ bool RegExpMacroAssemblerX87::CheckSpecialCharacterClass(uc16 type,
return true;
}
case 'w': {
if (mode_ != ASCII) {
// Table is 128 entries, so all ASCII characters can be tested.
if (mode_ != LATIN1) {
// Table is 256 entries, so all Latin1 characters can be tested.
__ cmp(current_character(), Immediate('z'));
BranchOrBacktrack(above, on_no_match);
}
......@@ -556,8 +556,8 @@ bool RegExpMacroAssemblerX87::CheckSpecialCharacterClass(uc16 type,
}
case 'W': {
Label done;
if (mode_ != ASCII) {
// Table is 128 entries, so all ASCII characters can be tested.
if (mode_ != LATIN1) {
// Table is 256 entries, so all Latin1 characters can be tested.
__ cmp(current_character(), Immediate('z'));
__ j(above, &done);
}
......@@ -566,7 +566,7 @@ bool RegExpMacroAssemblerX87::CheckSpecialCharacterClass(uc16 type,
__ test_b(current_character(),
Operand::StaticArray(current_character(), times_1, word_map));
BranchOrBacktrack(not_zero, on_no_match);
if (mode_ != ASCII) {
if (mode_ != LATIN1) {
__ bind(&done);
}
return true;
......@@ -583,7 +583,7 @@ bool RegExpMacroAssemblerX87::CheckSpecialCharacterClass(uc16 type,
// See if current character is '\n'^1 or '\r'^1, i.e., 0x0b or 0x0c
__ sub(eax, Immediate(0x0b));
__ cmp(eax, 0x0c - 0x0b);
if (mode_ == ASCII) {
if (mode_ == LATIN1) {
BranchOrBacktrack(above, on_no_match);
} else {
Label done;
......@@ -1098,7 +1098,7 @@ int RegExpMacroAssemblerX87::CheckStackGuardState(Address* return_address,
Handle<String> subject(frame_entry<String*>(re_frame, kInputString));
// Current string.
bool is_ascii = subject->IsOneByteRepresentationUnderneath();
bool is_one_byte = subject->IsOneByteRepresentationUnderneath();
DCHECK(re_code->instruction_start() <= *return_address);
DCHECK(*return_address <=
......@@ -1129,8 +1129,8 @@ int RegExpMacroAssemblerX87::CheckStackGuardState(Address* return_address,
}
// String might have changed.
if (subject_tmp->IsOneByteRepresentation() != is_ascii) {
// If we changed between an ASCII and an UC16 string, the specialized
if (subject_tmp->IsOneByteRepresentation() != is_one_byte) {
// If we changed between an LATIN1 and an UC16 string, the specialized
// code cannot be used, and we need to restart regexp matching from
// scratch (including, potentially, compiling a new version of the code).
return RETRY;
......@@ -1277,7 +1277,7 @@ void RegExpMacroAssemblerX87::CheckStackLimit() {
void RegExpMacroAssemblerX87::LoadCurrentCharacterUnchecked(int cp_offset,
int characters) {
if (mode_ == ASCII) {
if (mode_ == LATIN1) {
if (characters == 4) {
__ mov(current_character(), Operand(esi, edi, times_1, cp_offset));
} else if (characters == 2) {
......
......@@ -174,7 +174,7 @@ class RegExpMacroAssemblerX87: public NativeRegExpMacroAssembler {
MacroAssembler* masm_;
// Which mode to generate code for (ASCII or UC16).
// Which mode to generate code for (LATIN1 or UC16).
Mode mode_;
// One greater than maximal register index actually used.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment