OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 13277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13288 // ebx: instance type | 13288 // ebx: instance type |
13289 // Calculate length of sub string using the smi values. | 13289 // Calculate length of sub string using the smi values. |
13290 Label result_longer_than_two; | 13290 Label result_longer_than_two; |
13291 __ mov(ecx, Operand(esp, 1 * kPointerSize)); // To index. | 13291 __ mov(ecx, Operand(esp, 1 * kPointerSize)); // To index. |
13292 __ test(ecx, Immediate(kSmiTagMask)); | 13292 __ test(ecx, Immediate(kSmiTagMask)); |
13293 __ j(not_zero, &runtime); | 13293 __ j(not_zero, &runtime); |
13294 __ mov(edx, Operand(esp, 2 * kPointerSize)); // From index. | 13294 __ mov(edx, Operand(esp, 2 * kPointerSize)); // From index. |
13295 __ test(edx, Immediate(kSmiTagMask)); | 13295 __ test(edx, Immediate(kSmiTagMask)); |
13296 __ j(not_zero, &runtime); | 13296 __ j(not_zero, &runtime); |
13297 __ sub(ecx, Operand(edx)); | 13297 __ sub(ecx, Operand(edx)); |
| 13298 __ cmp(ecx, FieldOperand(eax, String::kLengthOffset)); |
| 13299 Label return_eax; |
| 13300 __ j(equal, &return_eax); |
13298 // Special handling of sub-strings of length 1 and 2. One character strings | 13301 // Special handling of sub-strings of length 1 and 2. One character strings |
13299 // are handled in the runtime system (looked up in the single character | 13302 // are handled in the runtime system (looked up in the single character |
13300 // cache). Two character strings are looked for in the symbol cache. | 13303 // cache). Two character strings are looked for in the symbol cache. |
13301 __ SmiUntag(ecx); // Result length is no longer smi. | 13304 __ SmiUntag(ecx); // Result length is no longer smi. |
13302 __ cmp(ecx, 2); | 13305 __ cmp(ecx, 2); |
13303 __ j(greater, &result_longer_than_two); | 13306 __ j(greater, &result_longer_than_two); |
13304 __ j(less, &runtime); | 13307 __ j(less, &runtime); |
13305 | 13308 |
13306 // Sub string of length 2 requested. | 13309 // Sub string of length 2 requested. |
13307 // eax: string | 13310 // eax: string |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13392 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 13395 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
13393 __ add(esi, Operand(ebx)); | 13396 __ add(esi, Operand(ebx)); |
13394 | 13397 |
13395 // eax: result string | 13398 // eax: result string |
13396 // ecx: result length | 13399 // ecx: result length |
13397 // edx: original value of esi | 13400 // edx: original value of esi |
13398 // edi: first character of result | 13401 // edi: first character of result |
13399 // esi: character of sub string start | 13402 // esi: character of sub string start |
13400 StringHelper::GenerateCopyCharactersREP(masm, edi, esi, ecx, ebx, false); | 13403 StringHelper::GenerateCopyCharactersREP(masm, edi, esi, ecx, ebx, false); |
13401 __ mov(esi, edx); // Restore esi. | 13404 __ mov(esi, edx); // Restore esi. |
| 13405 |
| 13406 __ bind(&return_eax); |
13402 __ IncrementCounter(&Counters::sub_string_native, 1); | 13407 __ IncrementCounter(&Counters::sub_string_native, 1); |
13403 __ ret(3 * kPointerSize); | 13408 __ ret(3 * kPointerSize); |
13404 | 13409 |
13405 // Just jump to runtime to create the sub string. | 13410 // Just jump to runtime to create the sub string. |
13406 __ bind(&runtime); | 13411 __ bind(&runtime); |
13407 __ TailCallRuntime(Runtime::kSubString, 3, 1); | 13412 __ TailCallRuntime(Runtime::kSubString, 3, 1); |
| 13413 |
13408 } | 13414 } |
13409 | 13415 |
13410 | 13416 |
13411 void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, | 13417 void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, |
13412 Register left, | 13418 Register left, |
13413 Register right, | 13419 Register right, |
13414 Register scratch1, | 13420 Register scratch1, |
13415 Register scratch2, | 13421 Register scratch2, |
13416 Register scratch3) { | 13422 Register scratch3) { |
13417 Label result_not_equal; | 13423 Label result_not_equal; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13729 masm.GetCode(&desc); | 13735 masm.GetCode(&desc); |
13730 // Call the function from C++. | 13736 // Call the function from C++. |
13731 return FUNCTION_CAST<MemCopyFunction>(buffer); | 13737 return FUNCTION_CAST<MemCopyFunction>(buffer); |
13732 } | 13738 } |
13733 | 13739 |
13734 #undef __ | 13740 #undef __ |
13735 | 13741 |
13736 } } // namespace v8::internal | 13742 } } // namespace v8::internal |
13737 | 13743 |
13738 #endif // V8_TARGET_ARCH_IA32 | 13744 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |