| OLD | NEW | 
|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 6163 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6174 | 6174 | 
| 6175   __ bind(&seq_or_external_string); | 6175   __ bind(&seq_or_external_string); | 
| 6176   // Sequential or external string.  Just move string to the expected register. | 6176   // Sequential or external string.  Just move string to the expected register. | 
| 6177   __ mov(edi, eax); | 6177   __ mov(edi, eax); | 
| 6178 | 6178 | 
| 6179   __ bind(&underlying_unpacked); | 6179   __ bind(&underlying_unpacked); | 
| 6180 | 6180 | 
| 6181   if (FLAG_string_slices) { | 6181   if (FLAG_string_slices) { | 
| 6182     Label copy_routine; | 6182     Label copy_routine; | 
| 6183     // edi: underlying subject string | 6183     // edi: underlying subject string | 
| 6184     // ebx: instance type of original subject string | 6184     // ebx: instance type of underlying subject string | 
| 6185     // edx: adjusted start index (smi) | 6185     // edx: adjusted start index (smi) | 
| 6186     // ecx: length (smi) | 6186     // ecx: length (smi) | 
| 6187     __ cmp(ecx, Immediate(Smi::FromInt(SlicedString::kMinLength))); | 6187     __ cmp(ecx, Immediate(Smi::FromInt(SlicedString::kMinLength))); | 
| 6188     // Short slice.  Copy instead of slicing. | 6188     // Short slice.  Copy instead of slicing. | 
| 6189     __ j(less, ©_routine); | 6189     __ j(less, ©_routine); | 
| 6190     // Allocate new sliced string.  At this point we do not reload the instance | 6190     // Allocate new sliced string.  At this point we do not reload the instance | 
| 6191     // type including the string encoding because we simply rely on the info | 6191     // type including the string encoding because we simply rely on the info | 
| 6192     // provided by the original string.  It does not matter if the original | 6192     // provided by the original string.  It does not matter if the original | 
| 6193     // string's encoding is wrong because we always have to recheck encoding of | 6193     // string's encoding is wrong because we always have to recheck encoding of | 
| 6194     // the newly created string's parent anyways due to externalized strings. | 6194     // the newly created string's parent anyways due to externalized strings. | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 6207     __ mov(FieldOperand(eax, SlicedString::kParentOffset), edi); | 6207     __ mov(FieldOperand(eax, SlicedString::kParentOffset), edi); | 
| 6208     __ mov(FieldOperand(eax, SlicedString::kHashFieldOffset), | 6208     __ mov(FieldOperand(eax, SlicedString::kHashFieldOffset), | 
| 6209            Immediate(String::kEmptyHashField)); | 6209            Immediate(String::kEmptyHashField)); | 
| 6210     __ IncrementCounter(counters->sub_string_native(), 1); | 6210     __ IncrementCounter(counters->sub_string_native(), 1); | 
| 6211     __ ret(3 * kPointerSize); | 6211     __ ret(3 * kPointerSize); | 
| 6212 | 6212 | 
| 6213     __ bind(©_routine); | 6213     __ bind(©_routine); | 
| 6214   } | 6214   } | 
| 6215 | 6215 | 
| 6216   // edi: underlying subject string | 6216   // edi: underlying subject string | 
| 6217   // ebx: instance type of original subject string | 6217   // ebx: instance type of underlying subject string | 
| 6218   // edx: adjusted start index (smi) | 6218   // edx: adjusted start index (smi) | 
| 6219   // ecx: length (smi) | 6219   // ecx: length (smi) | 
| 6220   // The subject string can only be external or sequential string of either | 6220   // The subject string can only be external or sequential string of either | 
| 6221   // encoding at this point. | 6221   // encoding at this point. | 
| 6222   Label two_byte_sequential, runtime_drop_two, sequential_string; | 6222   Label two_byte_sequential, runtime_drop_two, sequential_string; | 
| 6223   STATIC_ASSERT(kExternalStringTag != 0); | 6223   STATIC_ASSERT(kExternalStringTag != 0); | 
| 6224   STATIC_ASSERT(kSeqStringTag == 0); | 6224   STATIC_ASSERT(kSeqStringTag == 0); | 
| 6225   __ test_b(ebx, kExternalStringTag); | 6225   __ test_b(ebx, kExternalStringTag); | 
| 6226   __ j(zero, &sequential_string); | 6226   __ j(zero, &sequential_string); | 
| 6227 | 6227 | 
| 6228   // Handle external string. | 6228   // Handle external string. | 
| 6229   Label ascii_external, done; |  | 
| 6230   // Rule out short external strings. | 6229   // Rule out short external strings. | 
| 6231   STATIC_CHECK(kShortExternalStringTag != 0); | 6230   STATIC_CHECK(kShortExternalStringTag != 0); | 
| 6232   __ test_b(ebx, kShortExternalStringMask); | 6231   __ test_b(ebx, kShortExternalStringMask); | 
| 6233   __ j(not_zero, &runtime); | 6232   __ j(not_zero, &runtime); | 
| 6234   __ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset)); | 6233   __ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset)); | 
| 6235   // Move the pointer so that offset-wise, it looks like a sequential string. | 6234   // Move the pointer so that offset-wise, it looks like a sequential string. | 
| 6236   STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); | 6235   STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); | 
| 6237   __ sub(edi, Immediate(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 6236   __ sub(edi, Immediate(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 
| 6238 | 6237 | 
| 6239   __ bind(&sequential_string); | 6238   __ bind(&sequential_string); | 
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7310                                  false); | 7309                                  false); | 
| 7311   __ pop(edx); | 7310   __ pop(edx); | 
| 7312   __ ret(0); | 7311   __ ret(0); | 
| 7313 } | 7312 } | 
| 7314 | 7313 | 
| 7315 #undef __ | 7314 #undef __ | 
| 7316 | 7315 | 
| 7317 } }  // namespace v8::internal | 7316 } }  // namespace v8::internal | 
| 7318 | 7317 | 
| 7319 #endif  // V8_TARGET_ARCH_IA32 | 7318 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW | 
|---|