Chromium Code Reviews| Index: src/x64/code-stubs-x64.cc |
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
| index 1a6efcbd61acc781addb3f175e7c5e7f6cd1dd6b..094e158f9a53c7890582b11ad15b388a2020ad04 100644 |
| --- a/src/x64/code-stubs-x64.cc |
| +++ b/src/x64/code-stubs-x64.cc |
| @@ -3780,6 +3780,7 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| Label flat_string; |
| Label ascii_string; |
| Label got_char_code; |
| + Label sliced_string; |
| // If the receiver is a smi trigger the non-string case. |
| __ JumpIfSmi(object_, receiver_not_string_); |
| @@ -3808,8 +3809,11 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| __ j(zero, &flat_string); |
| // Handle non-flat strings. |
| - __ testb(result_, Immediate(kIsConsStringMask)); |
| - __ j(zero, &call_runtime_); |
| + __ and_(result_, Immediate(kStringRepresentationMask)); |
| + __ cmpb(result_, Immediate(kSlicedStringTag)); |
| + __ j(equal, &sliced_string); |
| + __ cmpb(result_, Immediate(kExternalStringTag)); |
| + __ j(equal, &call_runtime_); |
| // ConsString. |
| // Check whether the right hand side is the empty string (i.e. if |
| @@ -3827,6 +3831,14 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| STATIC_ASSERT(kSeqStringTag == 0); |
| __ testb(result_, Immediate(kStringRepresentationMask)); |
| __ j(not_zero, &call_runtime_); |
| + __ jmp(&flat_string); |
| + |
| + // SlicedString, unpack and add offset. |
| + __ bind(&sliced_string); |
| + __ addq(scratch_, FieldOperand(object_, SlicedString::kOffsetOffset)); |
| + __ movq(object_, FieldOperand(object_, SlicedString::kParentOffset)); |
| + __ movq(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
| + __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
| // Check for 1-byte or 2-byte string. |
| __ bind(&flat_string); |
| @@ -4137,6 +4149,8 @@ void StringAddStub::Generate(MacroAssembler* masm) { |
| __ and_(rcx, Immediate(kStringRepresentationMask)); |
| __ cmpl(rcx, Immediate(kExternalStringTag)); |
| __ j(equal, &string_add_runtime); |
| + // We cannot encounter sliced strings here since: |
| + STATIC_ASSERT(SlicedString::kMinLength >= String::kMinNonFlatLength); |
| // Now check if both strings are ascii strings. |
| // rax: first string |
| // rbx: length of resulting flat string |
| @@ -4529,6 +4543,9 @@ void StringHelper::GenerateHashGetHash(MacroAssembler* masm, |
| void SubStringStub::Generate(MacroAssembler* masm) { |
| Label runtime; |
|
Yang
2011/07/27 11:51:58
Do not create string slice unless experimental fla
|
| + if (FLAG_string_slices) { |
| + __ jmp(&runtime); |
| + } |
| // Stack frame on entry. |
| // rsp[0]: return address |
| // rsp[8]: to |