| 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 5491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5502 // ebx: length of first string as a smi | 5502 // ebx: length of first string as a smi |
| 5503 // ecx: length of second string as a smi | 5503 // ecx: length of second string as a smi |
| 5504 // edx: second string | 5504 // edx: second string |
| 5505 // Look at the length of the result of adding the two strings. | 5505 // Look at the length of the result of adding the two strings. |
| 5506 Label string_add_flat_result, longer_than_two; | 5506 Label string_add_flat_result, longer_than_two; |
| 5507 __ bind(&both_not_zero_length); | 5507 __ bind(&both_not_zero_length); |
| 5508 __ add(ebx, Operand(ecx)); | 5508 __ add(ebx, Operand(ecx)); |
| 5509 STATIC_ASSERT(Smi::kMaxValue == String::kMaxLength); | 5509 STATIC_ASSERT(Smi::kMaxValue == String::kMaxLength); |
| 5510 // Handle exceptionally long strings in the runtime system. | 5510 // Handle exceptionally long strings in the runtime system. |
| 5511 __ j(overflow, &string_add_runtime); | 5511 __ j(overflow, &string_add_runtime); |
| 5512 // Use the runtime system when adding two one character strings, as it | 5512 // Use the symbol table when adding two one character strings, as it |
| 5513 // contains optimizations for this specific case using the symbol table. | 5513 // helps later optimizations to return a symbol here. |
| 5514 __ cmp(Operand(ebx), Immediate(Smi::FromInt(2))); | 5514 __ cmp(Operand(ebx), Immediate(Smi::FromInt(2))); |
| 5515 __ j(not_equal, &longer_than_two); | 5515 __ j(not_equal, &longer_than_two); |
| 5516 | 5516 |
| 5517 // Check that both strings are non-external ascii strings. | 5517 // Check that both strings are non-external ascii strings. |
| 5518 __ JumpIfNotBothSequentialAsciiStrings(eax, edx, ebx, ecx, | 5518 __ JumpIfNotBothSequentialAsciiStrings(eax, edx, ebx, ecx, |
| 5519 &string_add_runtime); | 5519 &string_add_runtime); |
| 5520 | 5520 |
| 5521 // Get the two characters forming the new string. | 5521 // Get the two characters forming the new string. |
| 5522 __ movzx_b(ebx, FieldOperand(eax, SeqAsciiString::kHeaderSize)); | 5522 __ movzx_b(ebx, FieldOperand(eax, SeqAsciiString::kHeaderSize)); |
| 5523 __ movzx_b(ecx, FieldOperand(edx, SeqAsciiString::kHeaderSize)); | 5523 __ movzx_b(ecx, FieldOperand(edx, SeqAsciiString::kHeaderSize)); |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5920 STATIC_ASSERT(SymbolTable::kEntrySize == 1); | 5920 STATIC_ASSERT(SymbolTable::kEntrySize == 1); |
| 5921 __ mov(candidate, | 5921 __ mov(candidate, |
| 5922 FieldOperand(symbol_table, | 5922 FieldOperand(symbol_table, |
| 5923 scratch, | 5923 scratch, |
| 5924 times_pointer_size, | 5924 times_pointer_size, |
| 5925 SymbolTable::kElementsStartOffset)); | 5925 SymbolTable::kElementsStartOffset)); |
| 5926 | 5926 |
| 5927 // If entry is undefined no string with this hash can be found. | 5927 // If entry is undefined no string with this hash can be found. |
| 5928 __ cmp(candidate, Factory::undefined_value()); | 5928 __ cmp(candidate, Factory::undefined_value()); |
| 5929 __ j(equal, not_found); | 5929 __ j(equal, not_found); |
| 5930 __ cmp(candidate, Factory::null_value()); |
| 5931 __ j(equal, &next_probe[i]); |
| 5930 | 5932 |
| 5931 // If length is not 2 the string is not a candidate. | 5933 // If length is not 2 the string is not a candidate. |
| 5932 __ cmp(FieldOperand(candidate, String::kLengthOffset), | 5934 __ cmp(FieldOperand(candidate, String::kLengthOffset), |
| 5933 Immediate(Smi::FromInt(2))); | 5935 Immediate(Smi::FromInt(2))); |
| 5934 __ j(not_equal, &next_probe[i]); | 5936 __ j(not_equal, &next_probe[i]); |
| 5935 | 5937 |
| 5936 // As we are out of registers save the mask on the stack and use that | 5938 // As we are out of registers save the mask on the stack and use that |
| 5937 // register as a temporary. | 5939 // register as a temporary. |
| 5938 __ push(mask); | 5940 __ push(mask); |
| 5939 Register temp = mask; | 5941 Register temp = mask; |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6478 // Do a tail call to the rewritten stub. | 6480 // Do a tail call to the rewritten stub. |
| 6479 __ jmp(Operand(edi)); | 6481 __ jmp(Operand(edi)); |
| 6480 } | 6482 } |
| 6481 | 6483 |
| 6482 | 6484 |
| 6483 #undef __ | 6485 #undef __ |
| 6484 | 6486 |
| 6485 } } // namespace v8::internal | 6487 } } // namespace v8::internal |
| 6486 | 6488 |
| 6487 #endif // V8_TARGET_ARCH_IA32 | 6489 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |