Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index f772db9be2078f0ecaa24a633e1af438be6dbe9c..2f14d191b0598d9f27be0eab01fdb90493a76be9 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -5873,36 +5873,12 @@ void SubStringStub::Generate(MacroAssembler* masm) { |
// r2: result string length |
__ ldr(r4, FieldMemOperand(r0, String::kLengthOffset)); |
__ cmp(r2, Operand(r4, ASR, 1)); |
+ // Return original string. |
__ b(eq, &return_r0); |
+ // Longer than original string's length or negative: unsafe arguments. |
+ __ b(hi, &runtime); |
+ // Shorter than original string's length: an actual substring. |
- Label result_longer_than_two; |
- // Check for special case of two character ASCII string, in which case |
- // we do a lookup in the symbol table first. |
- __ cmp(r2, Operand(2)); |
- __ b(gt, &result_longer_than_two); |
- __ b(lt, &runtime); |
- |
- __ JumpIfInstanceTypeIsNotSequentialAscii(r1, r1, &runtime); |
- |
- // Get the two characters forming the sub string. |
- __ add(r0, r0, Operand(r3)); |
- __ ldrb(r3, FieldMemOperand(r0, SeqAsciiString::kHeaderSize)); |
- __ ldrb(r4, FieldMemOperand(r0, SeqAsciiString::kHeaderSize + 1)); |
- |
- // Try to lookup two character string in symbol table. |
- Label make_two_character_string; |
- StringHelper::GenerateTwoCharacterSymbolTableProbe( |
- masm, r3, r4, r1, r5, r6, r7, r9, &make_two_character_string); |
- __ jmp(&return_r0); |
- |
- // r2: result string length. |
- // r3: two characters combined into halfword in little endian byte order. |
- __ bind(&make_two_character_string); |
- __ AllocateAsciiString(r0, r2, r4, r5, r9, &runtime); |
- __ strh(r3, FieldMemOperand(r0, SeqAsciiString::kHeaderSize)); |
- __ jmp(&return_r0); |
- |
- __ bind(&result_longer_than_two); |
// Deal with different string types: update the index if necessary |
// and put the underlying string into r5. |
// r0: original string |