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 12620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12631 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { | 12631 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { |
12632 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); | 12632 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); |
12633 | 12633 |
12634 // Index is not a smi. | 12634 // Index is not a smi. |
12635 __ bind(&index_not_smi_); | 12635 __ bind(&index_not_smi_); |
12636 // If index is a heap number, try converting it to an integer. | 12636 // If index is a heap number, try converting it to an integer. |
12637 __ CheckMap(index_, Factory::heap_number_map(), index_not_number_, true); | 12637 __ CheckMap(index_, Factory::heap_number_map(), index_not_number_, true); |
12638 call_helper.BeforeCall(masm); | 12638 call_helper.BeforeCall(masm); |
12639 __ push(object_); | 12639 __ push(object_); |
12640 __ push(index_); | 12640 __ push(index_); |
12641 __ push(result_); | |
12642 __ push(index_); // Consumed by runtime conversion function. | 12641 __ push(index_); // Consumed by runtime conversion function. |
12643 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 12642 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
12644 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 12643 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
12645 } else { | 12644 } else { |
12646 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 12645 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
12647 // NumberToSmi discards numbers that are not exact integers. | 12646 // NumberToSmi discards numbers that are not exact integers. |
12648 __ CallRuntime(Runtime::kNumberToSmi, 1); | 12647 __ CallRuntime(Runtime::kNumberToSmi, 1); |
12649 } | 12648 } |
12650 if (!scratch_.is(eax)) { | 12649 if (!scratch_.is(eax)) { |
12651 // Save the conversion result before the pop instructions below | 12650 // Save the conversion result before the pop instructions below |
12652 // have a chance to overwrite it. | 12651 // have a chance to overwrite it. |
12653 __ mov(scratch_, eax); | 12652 __ mov(scratch_, eax); |
12654 } | 12653 } |
12655 __ pop(result_); | |
12656 __ pop(index_); | 12654 __ pop(index_); |
12657 __ pop(object_); | 12655 __ pop(object_); |
| 12656 // Reload the instance type. |
| 12657 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
| 12658 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
12658 call_helper.AfterCall(masm); | 12659 call_helper.AfterCall(masm); |
12659 // If index is still not a smi, it must be out of range. | 12660 // If index is still not a smi, it must be out of range. |
12660 ASSERT(kSmiTag == 0); | 12661 ASSERT(kSmiTag == 0); |
12661 __ test(scratch_, Immediate(kSmiTagMask)); | 12662 __ test(scratch_, Immediate(kSmiTagMask)); |
12662 __ j(not_zero, index_out_of_range_); | 12663 __ j(not_zero, index_out_of_range_); |
12663 // Otherwise, return to the fast path. | 12664 // Otherwise, return to the fast path. |
12664 __ jmp(&got_smi_index_); | 12665 __ jmp(&got_smi_index_); |
12665 | 12666 |
12666 // Call runtime. We get here when the receiver is a string and the | 12667 // Call runtime. We get here when the receiver is a string and the |
12667 // index is a number, but the code of getting the actual character | 12668 // index is a number, but the code of getting the actual character |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13488 // tagged as a small integer. | 13489 // tagged as a small integer. |
13489 __ bind(&runtime); | 13490 __ bind(&runtime); |
13490 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 13491 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
13491 } | 13492 } |
13492 | 13493 |
13493 #undef __ | 13494 #undef __ |
13494 | 13495 |
13495 } } // namespace v8::internal | 13496 } } // namespace v8::internal |
13496 | 13497 |
13497 #endif // V8_TARGET_ARCH_IA32 | 13498 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |