Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 758d35f3a61e2ec1cad0cdced7ffe253d4a14b89..5cc02e4d7eb5a10d3becea138da155bac6b3ae92 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -350,7 +350,7 @@ void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
} |
-void NewStringAddStub::InitializeInterfaceDescriptor( |
+void StringAddStub::InitializeInterfaceDescriptor( |
Isolate* isolate, |
CodeStubInterfaceDescriptor* descriptor) { |
static Register registers[] = { r1, r0 }; |
@@ -3468,36 +3468,6 @@ void StringCharFromCodeGenerator::GenerateSlow( |
} |
-void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, |
- Register dest, |
- Register src, |
- Register count, |
- Register scratch, |
- bool ascii) { |
- Label loop; |
- Label done; |
- // This loop just copies one character at a time, as it is only used for very |
- // short strings. |
- if (!ascii) { |
- __ add(count, count, Operand(count), SetCC); |
- } else { |
- __ cmp(count, Operand::Zero()); |
- } |
- __ b(eq, &done); |
- |
- __ bind(&loop); |
- __ ldrb(scratch, MemOperand(src, 1, PostIndex)); |
- // Perform sub between load and dependent store to get the load time to |
- // complete. |
- __ sub(count, count, Operand(1), SetCC); |
- __ strb(scratch, MemOperand(dest, 1, PostIndex)); |
- // last iteration. |
- __ b(gt, &loop); |
- |
- __ bind(&done); |
-} |
- |
- |
enum CopyCharactersFlags { |
COPY_ASCII = 1, |
DEST_ALWAYS_ALIGNED = 2 |
@@ -3645,143 +3615,6 @@ void StringHelper::GenerateCopyCharactersLong(MacroAssembler* masm, |
} |
-void StringHelper::GenerateTwoCharacterStringTableProbe(MacroAssembler* masm, |
- Register c1, |
- Register c2, |
- Register scratch1, |
- Register scratch2, |
- Register scratch3, |
- Register scratch4, |
- Register scratch5, |
- Label* not_found) { |
- // Register scratch3 is the general scratch register in this function. |
- Register scratch = scratch3; |
- |
- // Make sure that both characters are not digits as such strings has a |
- // different hash algorithm. Don't try to look for these in the string table. |
- Label not_array_index; |
- __ sub(scratch, c1, Operand(static_cast<int>('0'))); |
- __ cmp(scratch, Operand(static_cast<int>('9' - '0'))); |
- __ b(hi, ¬_array_index); |
- __ sub(scratch, c2, Operand(static_cast<int>('0'))); |
- __ cmp(scratch, Operand(static_cast<int>('9' - '0'))); |
- |
- // If check failed combine both characters into single halfword. |
- // This is required by the contract of the method: code at the |
- // not_found branch expects this combination in c1 register |
- __ orr(c1, c1, Operand(c2, LSL, kBitsPerByte), LeaveCC, ls); |
- __ b(ls, not_found); |
- |
- __ bind(¬_array_index); |
- // Calculate the two character string hash. |
- Register hash = scratch1; |
- StringHelper::GenerateHashInit(masm, hash, c1); |
- StringHelper::GenerateHashAddCharacter(masm, hash, c2); |
- StringHelper::GenerateHashGetHash(masm, hash); |
- |
- // Collect the two characters in a register. |
- Register chars = c1; |
- __ orr(chars, chars, Operand(c2, LSL, kBitsPerByte)); |
- |
- // chars: two character string, char 1 in byte 0 and char 2 in byte 1. |
- // hash: hash of two character string. |
- |
- // Load string table |
- // Load address of first element of the string table. |
- Register string_table = c2; |
- __ LoadRoot(string_table, Heap::kStringTableRootIndex); |
- |
- Register undefined = scratch4; |
- __ LoadRoot(undefined, Heap::kUndefinedValueRootIndex); |
- |
- // Calculate capacity mask from the string table capacity. |
- Register mask = scratch2; |
- __ ldr(mask, FieldMemOperand(string_table, StringTable::kCapacityOffset)); |
- __ mov(mask, Operand(mask, ASR, 1)); |
- __ sub(mask, mask, Operand(1)); |
- |
- // Calculate untagged address of the first element of the string table. |
- Register first_string_table_element = string_table; |
- __ add(first_string_table_element, string_table, |
- Operand(StringTable::kElementsStartOffset - kHeapObjectTag)); |
- |
- // Registers |
- // chars: two character string, char 1 in byte 0 and char 2 in byte 1. |
- // hash: hash of two character string |
- // mask: capacity mask |
- // first_string_table_element: address of the first element of |
- // the string table |
- // undefined: the undefined object |
- // scratch: - |
- |
- // Perform a number of probes in the string table. |
- const int kProbes = 4; |
- Label found_in_string_table; |
- Label next_probe[kProbes]; |
- Register candidate = scratch5; // Scratch register contains candidate. |
- for (int i = 0; i < kProbes; i++) { |
- // Calculate entry in string table. |
- if (i > 0) { |
- __ add(candidate, hash, Operand(StringTable::GetProbeOffset(i))); |
- } else { |
- __ mov(candidate, hash); |
- } |
- |
- __ and_(candidate, candidate, Operand(mask)); |
- |
- // Load the entry from the symble table. |
- STATIC_ASSERT(StringTable::kEntrySize == 1); |
- __ ldr(candidate, |
- MemOperand(first_string_table_element, |
- candidate, |
- LSL, |
- kPointerSizeLog2)); |
- |
- // If entry is undefined no string with this hash can be found. |
- Label is_string; |
- __ CompareObjectType(candidate, scratch, scratch, ODDBALL_TYPE); |
- __ b(ne, &is_string); |
- |
- __ cmp(undefined, candidate); |
- __ b(eq, not_found); |
- // Must be the hole (deleted entry). |
- if (FLAG_debug_code) { |
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
- __ cmp(ip, candidate); |
- __ Assert(eq, kOddballInStringTableIsNotUndefinedOrTheHole); |
- } |
- __ jmp(&next_probe[i]); |
- |
- __ bind(&is_string); |
- |
- // Check that the candidate is a non-external ASCII string. The instance |
- // type is still in the scratch register from the CompareObjectType |
- // operation. |
- __ JumpIfInstanceTypeIsNotSequentialAscii(scratch, scratch, &next_probe[i]); |
- |
- // If length is not 2 the string is not a candidate. |
- __ ldr(scratch, FieldMemOperand(candidate, String::kLengthOffset)); |
- __ cmp(scratch, Operand(Smi::FromInt(2))); |
- __ b(ne, &next_probe[i]); |
- |
- // Check if the two characters match. |
- // Assumes that word load is little endian. |
- __ ldrh(scratch, FieldMemOperand(candidate, SeqOneByteString::kHeaderSize)); |
- __ cmp(chars, scratch); |
- __ b(eq, &found_in_string_table); |
- __ bind(&next_probe[i]); |
- } |
- |
- // No matching 2 character string found by probing. |
- __ jmp(not_found); |
- |
- // Scratch register contains result when we fall through to here. |
- Register result = candidate; |
- __ bind(&found_in_string_table); |
- __ Move(r0, result); |
-} |
- |
- |
void StringHelper::GenerateHashInit(MacroAssembler* masm, |
Register hash, |
Register character) { |
@@ -4433,362 +4266,6 @@ void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
} |
-void StringAddStub::Generate(MacroAssembler* masm) { |
- Label call_runtime, call_builtin; |
- Builtins::JavaScript builtin_id = Builtins::ADD; |
- |
- Counters* counters = masm->isolate()->counters(); |
- |
- // Stack on entry: |
- // sp[0]: second argument (right). |
- // sp[4]: first argument (left). |
- |
- // Load the two arguments. |
- __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); // First argument. |
- __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); // Second argument. |
- |
- // Make sure that both arguments are strings if not known in advance. |
- // Otherwise, at least one of the arguments is definitely a string, |
- // and we convert the one that is not known to be a string. |
- if ((flags_ & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { |
- ASSERT((flags_ & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT); |
- ASSERT((flags_ & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT); |
- __ JumpIfEitherSmi(r0, r1, &call_runtime); |
- // Load instance types. |
- __ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
- __ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
- __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
- __ ldrb(r5, FieldMemOperand(r5, Map::kInstanceTypeOffset)); |
- STATIC_ASSERT(kStringTag == 0); |
- // If either is not a string, go to runtime. |
- __ tst(r4, Operand(kIsNotStringMask)); |
- __ tst(r5, Operand(kIsNotStringMask), eq); |
- __ b(ne, &call_runtime); |
- } else if ((flags_ & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { |
- ASSERT((flags_ & STRING_ADD_CHECK_RIGHT) == 0); |
- GenerateConvertArgument( |
- masm, 1 * kPointerSize, r0, r2, r3, r4, r5, &call_builtin); |
- builtin_id = Builtins::STRING_ADD_RIGHT; |
- } else if ((flags_ & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { |
- ASSERT((flags_ & STRING_ADD_CHECK_LEFT) == 0); |
- GenerateConvertArgument( |
- masm, 0 * kPointerSize, r1, r2, r3, r4, r5, &call_builtin); |
- builtin_id = Builtins::STRING_ADD_LEFT; |
- } |
- |
- // Both arguments are strings. |
- // r0: first string |
- // r1: second string |
- // r4: first string instance type (if flags_ == NO_STRING_ADD_FLAGS) |
- // r5: second string instance type (if flags_ == NO_STRING_ADD_FLAGS) |
- { |
- Label strings_not_empty; |
- // Check if either of the strings are empty. In that case return the other. |
- __ ldr(r2, FieldMemOperand(r0, String::kLengthOffset)); |
- __ ldr(r3, FieldMemOperand(r1, String::kLengthOffset)); |
- STATIC_ASSERT(kSmiTag == 0); |
- __ cmp(r2, Operand(Smi::FromInt(0))); // Test if first string is empty. |
- __ mov(r0, Operand(r1), LeaveCC, eq); // If first is empty, return second. |
- STATIC_ASSERT(kSmiTag == 0); |
- // Else test if second string is empty. |
- __ cmp(r3, Operand(Smi::FromInt(0)), ne); |
- __ b(ne, &strings_not_empty); // If either string was empty, return r0. |
- |
- __ IncrementCounter(counters->string_add_native(), 1, r2, r3); |
- __ add(sp, sp, Operand(2 * kPointerSize)); |
- __ Ret(); |
- |
- __ bind(&strings_not_empty); |
- } |
- |
- __ SmiUntag(r2); |
- __ SmiUntag(r3); |
- // Both strings are non-empty. |
- // r0: first string |
- // r1: second string |
- // r2: length of first string |
- // r3: length of second string |
- // r4: first string instance type (if flags_ == NO_STRING_ADD_FLAGS) |
- // r5: second string instance type (if flags_ == NO_STRING_ADD_FLAGS) |
- // Look at the length of the result of adding the two strings. |
- Label string_add_flat_result, longer_than_two; |
- // Adding two lengths can't overflow. |
- STATIC_ASSERT(String::kMaxLength < String::kMaxLength * 2); |
- __ add(r6, r2, Operand(r3)); |
- // Use the string table when adding two one character strings, as it |
- // helps later optimizations to return a string here. |
- __ cmp(r6, Operand(2)); |
- __ b(ne, &longer_than_two); |
- |
- // Check that both strings are non-external ASCII strings. |
- if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { |
- __ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
- __ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
- __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
- __ ldrb(r5, FieldMemOperand(r5, Map::kInstanceTypeOffset)); |
- } |
- __ JumpIfBothInstanceTypesAreNotSequentialAscii(r4, r5, r6, r3, |
- &call_runtime); |
- |
- // Get the two characters forming the sub string. |
- __ ldrb(r2, FieldMemOperand(r0, SeqOneByteString::kHeaderSize)); |
- __ ldrb(r3, FieldMemOperand(r1, SeqOneByteString::kHeaderSize)); |
- |
- // Try to lookup two character string in string table. If it is not found |
- // just allocate a new one. |
- Label make_two_character_string; |
- StringHelper::GenerateTwoCharacterStringTableProbe( |
- masm, r2, r3, r6, r0, r4, r5, r9, &make_two_character_string); |
- __ IncrementCounter(counters->string_add_native(), 1, r2, r3); |
- __ add(sp, sp, Operand(2 * kPointerSize)); |
- __ Ret(); |
- |
- __ bind(&make_two_character_string); |
- // Resulting string has length 2 and first chars of two strings |
- // are combined into single halfword in r2 register. |
- // So we can fill resulting string without two loops by a single |
- // halfword store instruction (which assumes that processor is |
- // in a little endian mode) |
- __ mov(r6, Operand(2)); |
- __ AllocateAsciiString(r0, r6, r4, r5, r9, &call_runtime); |
- __ strh(r2, FieldMemOperand(r0, SeqOneByteString::kHeaderSize)); |
- __ IncrementCounter(counters->string_add_native(), 1, r2, r3); |
- __ add(sp, sp, Operand(2 * kPointerSize)); |
- __ Ret(); |
- |
- __ bind(&longer_than_two); |
- // Check if resulting string will be flat. |
- __ cmp(r6, Operand(ConsString::kMinLength)); |
- __ b(lt, &string_add_flat_result); |
- // Handle exceptionally long strings in the runtime system. |
- STATIC_ASSERT((String::kMaxLength & 0x80000000) == 0); |
- ASSERT(IsPowerOf2(String::kMaxLength + 1)); |
- // kMaxLength + 1 is representable as shifted literal, kMaxLength is not. |
- __ cmp(r6, Operand(String::kMaxLength + 1)); |
- __ b(hs, &call_runtime); |
- |
- // If result is not supposed to be flat, allocate a cons string object. |
- // If both strings are ASCII the result is an ASCII cons string. |
- if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { |
- __ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
- __ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
- __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
- __ ldrb(r5, FieldMemOperand(r5, Map::kInstanceTypeOffset)); |
- } |
- Label non_ascii, allocated, ascii_data; |
- STATIC_ASSERT(kTwoByteStringTag == 0); |
- __ tst(r4, Operand(kStringEncodingMask)); |
- __ tst(r5, Operand(kStringEncodingMask), ne); |
- __ b(eq, &non_ascii); |
- |
- // Allocate an ASCII cons string. |
- __ bind(&ascii_data); |
- __ AllocateAsciiConsString(r3, r6, r4, r5, &call_runtime); |
- __ bind(&allocated); |
- // Fill the fields of the cons string. |
- Label skip_write_barrier, after_writing; |
- ExternalReference high_promotion_mode = ExternalReference:: |
- new_space_high_promotion_mode_active_address(masm->isolate()); |
- __ mov(r4, Operand(high_promotion_mode)); |
- __ ldr(r4, MemOperand(r4, 0)); |
- __ cmp(r4, Operand::Zero()); |
- __ b(eq, &skip_write_barrier); |
- |
- __ str(r0, FieldMemOperand(r3, ConsString::kFirstOffset)); |
- __ RecordWriteField(r3, |
- ConsString::kFirstOffset, |
- r0, |
- r4, |
- kLRHasNotBeenSaved, |
- kDontSaveFPRegs); |
- __ str(r1, FieldMemOperand(r3, ConsString::kSecondOffset)); |
- __ RecordWriteField(r3, |
- ConsString::kSecondOffset, |
- r1, |
- r4, |
- kLRHasNotBeenSaved, |
- kDontSaveFPRegs); |
- __ jmp(&after_writing); |
- |
- __ bind(&skip_write_barrier); |
- __ str(r0, FieldMemOperand(r3, ConsString::kFirstOffset)); |
- __ str(r1, FieldMemOperand(r3, ConsString::kSecondOffset)); |
- |
- __ bind(&after_writing); |
- |
- __ mov(r0, Operand(r3)); |
- __ IncrementCounter(counters->string_add_native(), 1, r2, r3); |
- __ add(sp, sp, Operand(2 * kPointerSize)); |
- __ Ret(); |
- |
- __ bind(&non_ascii); |
- // At least one of the strings is two-byte. Check whether it happens |
- // to contain only one byte characters. |
- // r4: first instance type. |
- // r5: second instance type. |
- __ tst(r4, Operand(kOneByteDataHintMask)); |
- __ tst(r5, Operand(kOneByteDataHintMask), ne); |
- __ b(ne, &ascii_data); |
- __ eor(r4, r4, Operand(r5)); |
- STATIC_ASSERT(kOneByteStringTag != 0 && kOneByteDataHintTag != 0); |
- __ and_(r4, r4, Operand(kOneByteStringTag | kOneByteDataHintTag)); |
- __ cmp(r4, Operand(kOneByteStringTag | kOneByteDataHintTag)); |
- __ b(eq, &ascii_data); |
- |
- // Allocate a two byte cons string. |
- __ AllocateTwoByteConsString(r3, r6, r4, r5, &call_runtime); |
- __ jmp(&allocated); |
- |
- // We cannot encounter sliced strings or cons strings here since: |
- STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); |
- // Handle creating a flat result from either external or sequential strings. |
- // Locate the first characters' locations. |
- // r0: first string |
- // r1: second string |
- // r2: length of first string |
- // r3: length of second string |
- // r4: first string instance type (if flags_ == NO_STRING_ADD_FLAGS) |
- // r5: second string instance type (if flags_ == NO_STRING_ADD_FLAGS) |
- // r6: sum of lengths. |
- Label first_prepared, second_prepared; |
- __ bind(&string_add_flat_result); |
- if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { |
- __ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
- __ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
- __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
- __ ldrb(r5, FieldMemOperand(r5, Map::kInstanceTypeOffset)); |
- } |
- |
- // Check whether both strings have same encoding |
- __ eor(ip, r4, Operand(r5)); |
- ASSERT(__ ImmediateFitsAddrMode1Instruction(kStringEncodingMask)); |
- __ tst(ip, Operand(kStringEncodingMask)); |
- __ b(ne, &call_runtime); |
- |
- STATIC_ASSERT(kSeqStringTag == 0); |
- __ tst(r4, Operand(kStringRepresentationMask)); |
- STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize); |
- __ add(r6, |
- r0, |
- Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag), |
- LeaveCC, |
- eq); |
- __ b(eq, &first_prepared); |
- // External string: rule out short external string and load string resource. |
- STATIC_ASSERT(kShortExternalStringTag != 0); |
- __ tst(r4, Operand(kShortExternalStringMask)); |
- __ b(ne, &call_runtime); |
- __ ldr(r6, FieldMemOperand(r0, ExternalString::kResourceDataOffset)); |
- __ bind(&first_prepared); |
- |
- STATIC_ASSERT(kSeqStringTag == 0); |
- __ tst(r5, Operand(kStringRepresentationMask)); |
- STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize); |
- __ add(r1, |
- r1, |
- Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag), |
- LeaveCC, |
- eq); |
- __ b(eq, &second_prepared); |
- // External string: rule out short external string and load string resource. |
- STATIC_ASSERT(kShortExternalStringTag != 0); |
- __ tst(r5, Operand(kShortExternalStringMask)); |
- __ b(ne, &call_runtime); |
- __ ldr(r1, FieldMemOperand(r1, ExternalString::kResourceDataOffset)); |
- __ bind(&second_prepared); |
- |
- Label non_ascii_string_add_flat_result; |
- // r6: first character of first string |
- // r1: first character of second string |
- // r2: length of first string. |
- // r3: length of second string. |
- // Both strings have the same encoding. |
- STATIC_ASSERT(kTwoByteStringTag == 0); |
- __ tst(r5, Operand(kStringEncodingMask)); |
- __ b(eq, &non_ascii_string_add_flat_result); |
- |
- __ add(r2, r2, Operand(r3)); |
- __ AllocateAsciiString(r0, r2, r4, r5, r9, &call_runtime); |
- __ sub(r2, r2, Operand(r3)); |
- __ add(r5, r0, Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag)); |
- // r0: result string. |
- // r6: first character of first string. |
- // r1: first character of second string. |
- // r2: length of first string. |
- // r3: length of second string. |
- // r5: first character of result. |
- StringHelper::GenerateCopyCharacters(masm, r5, r6, r2, r4, true); |
- // r5: next character of result. |
- StringHelper::GenerateCopyCharacters(masm, r5, r1, r3, r4, true); |
- __ IncrementCounter(counters->string_add_native(), 1, r2, r3); |
- __ add(sp, sp, Operand(2 * kPointerSize)); |
- __ Ret(); |
- |
- __ bind(&non_ascii_string_add_flat_result); |
- __ add(r2, r2, Operand(r3)); |
- __ AllocateTwoByteString(r0, r2, r4, r5, r9, &call_runtime); |
- __ sub(r2, r2, Operand(r3)); |
- __ add(r5, r0, Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
- // r0: result string. |
- // r6: first character of first string. |
- // r1: first character of second string. |
- // r2: length of first string. |
- // r3: length of second string. |
- // r5: first character of result. |
- StringHelper::GenerateCopyCharacters(masm, r5, r6, r2, r4, false); |
- // r5: next character of result. |
- StringHelper::GenerateCopyCharacters(masm, r5, r1, r3, r4, false); |
- __ IncrementCounter(counters->string_add_native(), 1, r2, r3); |
- __ add(sp, sp, Operand(2 * kPointerSize)); |
- __ Ret(); |
- |
- // Just jump to runtime to add the two strings. |
- __ bind(&call_runtime); |
- __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
- |
- if (call_builtin.is_linked()) { |
- __ bind(&call_builtin); |
- __ InvokeBuiltin(builtin_id, JUMP_FUNCTION); |
- } |
-} |
- |
- |
-void StringAddStub::GenerateRegisterArgsPush(MacroAssembler* masm) { |
- __ push(r0); |
- __ push(r1); |
-} |
- |
- |
-void StringAddStub::GenerateRegisterArgsPop(MacroAssembler* masm) { |
- __ pop(r1); |
- __ pop(r0); |
-} |
- |
- |
-void StringAddStub::GenerateConvertArgument(MacroAssembler* masm, |
- int stack_offset, |
- Register arg, |
- Register scratch1, |
- Register scratch2, |
- Register scratch3, |
- Register scratch4, |
- Label* slow) { |
- // First check if the argument is already a string. |
- Label not_string, done; |
- __ JumpIfSmi(arg, ¬_string); |
- __ CompareObjectType(arg, scratch1, scratch1, FIRST_NONSTRING_TYPE); |
- __ b(lt, &done); |
- |
- // Check the number to string cache. |
- __ bind(¬_string); |
- // Puts the cached result into scratch1. |
- __ LookupNumberStringCache(arg, scratch1, scratch2, scratch3, scratch4, slow); |
- __ mov(arg, scratch1); |
- __ str(arg, MemOperand(sp, stack_offset)); |
- __ bind(&done); |
-} |
- |
- |
void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
ASSERT(state_ == CompareIC::SMI); |
Label miss; |