| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4770 __ sar(index.reg(), kSmiTagSize); | 4770 __ sar(index.reg(), kSmiTagSize); |
| 4771 | 4771 |
| 4772 __ bind(&try_again_with_new_string); | 4772 __ bind(&try_again_with_new_string); |
| 4773 // Fetch the instance type of the receiver into ecx. | 4773 // Fetch the instance type of the receiver into ecx. |
| 4774 __ mov(ecx, FieldOperand(object.reg(), HeapObject::kMapOffset)); | 4774 __ mov(ecx, FieldOperand(object.reg(), HeapObject::kMapOffset)); |
| 4775 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); | 4775 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); |
| 4776 // If the receiver is not a string trigger the slow case. | 4776 // If the receiver is not a string trigger the slow case. |
| 4777 __ test(ecx, Immediate(kIsNotStringMask)); | 4777 __ test(ecx, Immediate(kIsNotStringMask)); |
| 4778 __ j(not_zero, &slow_case); | 4778 __ j(not_zero, &slow_case); |
| 4779 | 4779 |
| 4780 // Here we make assumptions about the tag values and the shifts needed. | |
| 4781 // See the comment in objects.h. | |
| 4782 ASSERT(kLongStringTag == 0); | |
| 4783 ASSERT(kMediumStringTag + String::kLongLengthShift == | |
| 4784 String::kMediumLengthShift); | |
| 4785 ASSERT(kShortStringTag + String::kLongLengthShift == | |
| 4786 String::kShortLengthShift); | |
| 4787 __ and_(ecx, kStringSizeMask); | |
| 4788 __ add(Operand(ecx), Immediate(String::kLongLengthShift)); | |
| 4789 // Fetch the length field into the temporary register. | 4780 // Fetch the length field into the temporary register. |
| 4790 __ mov(temp.reg(), FieldOperand(object.reg(), String::kLengthOffset)); | 4781 __ mov(temp.reg(), FieldOperand(object.reg(), String::kLengthOffset)); |
| 4791 __ shr_cl(temp.reg()); | |
| 4792 // Check for index out of range. | 4782 // Check for index out of range. |
| 4793 __ cmp(index.reg(), Operand(temp.reg())); | 4783 __ cmp(index.reg(), Operand(temp.reg())); |
| 4794 __ j(greater_equal, &slow_case); | 4784 __ j(greater_equal, &slow_case); |
| 4795 // Reload the instance type (into the temp register this time).. | 4785 // Reload the instance type (into the temp register this time).. |
| 4796 __ mov(temp.reg(), FieldOperand(object.reg(), HeapObject::kMapOffset)); | 4786 __ mov(temp.reg(), FieldOperand(object.reg(), HeapObject::kMapOffset)); |
| 4797 __ movzx_b(temp.reg(), FieldOperand(temp.reg(), Map::kInstanceTypeOffset)); | 4787 __ movzx_b(temp.reg(), FieldOperand(temp.reg(), Map::kInstanceTypeOffset)); |
| 4798 | 4788 |
| 4799 // We need special handling for non-flat strings. | 4789 // We need special handling for non-flat strings. |
| 4800 ASSERT(kSeqStringTag == 0); | 4790 ASSERT(kSeqStringTag == 0); |
| 4801 __ test(temp.reg(), Immediate(kStringRepresentationMask)); | 4791 __ test(temp.reg(), Immediate(kStringRepresentationMask)); |
| (...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6495 __ and_(ebx, 1 << Map::kIsUndetectable); | 6485 __ and_(ebx, 1 << Map::kIsUndetectable); |
| 6496 __ j(not_zero, &false_result); | 6486 __ j(not_zero, &false_result); |
| 6497 | 6487 |
| 6498 // JavaScript object => true. | 6488 // JavaScript object => true. |
| 6499 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); | 6489 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); |
| 6500 __ j(above_equal, &true_result); | 6490 __ j(above_equal, &true_result); |
| 6501 | 6491 |
| 6502 // String value => false iff empty. | 6492 // String value => false iff empty. |
| 6503 __ cmp(ecx, FIRST_NONSTRING_TYPE); | 6493 __ cmp(ecx, FIRST_NONSTRING_TYPE); |
| 6504 __ j(above_equal, ¬_string); | 6494 __ j(above_equal, ¬_string); |
| 6505 __ and_(ecx, kStringSizeMask); | |
| 6506 __ cmp(ecx, kShortStringTag); | |
| 6507 __ j(not_equal, &true_result); // Empty string is always short. | |
| 6508 __ mov(edx, FieldOperand(eax, String::kLengthOffset)); | 6495 __ mov(edx, FieldOperand(eax, String::kLengthOffset)); |
| 6509 __ shr(edx, String::kShortLengthShift); | 6496 __ test(edx, Operand(edx)); |
| 6510 __ j(zero, &false_result); | 6497 __ j(zero, &false_result); |
| 6511 __ jmp(&true_result); | 6498 __ jmp(&true_result); |
| 6512 | 6499 |
| 6513 __ bind(¬_string); | 6500 __ bind(¬_string); |
| 6514 // HeapNumber => false iff +0, -0, or NaN. | 6501 // HeapNumber => false iff +0, -0, or NaN. |
| 6515 __ cmp(edx, Factory::heap_number_map()); | 6502 __ cmp(edx, Factory::heap_number_map()); |
| 6516 __ j(not_equal, &true_result); | 6503 __ j(not_equal, &true_result); |
| 6517 __ fldz(); | 6504 __ fldz(); |
| 6518 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); | 6505 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); |
| 6519 __ FCmp(); | 6506 __ FCmp(); |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8181 | 8168 |
| 8182 int CompareStub::MinorKey() { | 8169 int CompareStub::MinorKey() { |
| 8183 // Encode the two parameters in a unique 16 bit value. | 8170 // Encode the two parameters in a unique 16 bit value. |
| 8184 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 8171 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
| 8185 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 8172 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
| 8186 } | 8173 } |
| 8187 | 8174 |
| 8188 #undef __ | 8175 #undef __ |
| 8189 | 8176 |
| 8190 } } // namespace v8::internal | 8177 } } // namespace v8::internal |
| OLD | NEW |