| 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 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 | 2544 |
| 2545 // Calculate the entry in the number string cache. The hash value in the | 2545 // Calculate the entry in the number string cache. The hash value in the |
| 2546 // number string cache for smis is just the smi value, and the hash for | 2546 // number string cache for smis is just the smi value, and the hash for |
| 2547 // doubles is the xor of the upper and lower words. See | 2547 // doubles is the xor of the upper and lower words. See |
| 2548 // Heap::GetNumberStringCache. | 2548 // Heap::GetNumberStringCache. |
| 2549 Label is_smi; | 2549 Label is_smi; |
| 2550 Label load_result_from_cache; | 2550 Label load_result_from_cache; |
| 2551 Factory* factory = masm->isolate()->factory(); | 2551 Factory* factory = masm->isolate()->factory(); |
| 2552 if (!object_is_smi) { | 2552 if (!object_is_smi) { |
| 2553 __ JumpIfSmi(object, &is_smi); | 2553 __ JumpIfSmi(object, &is_smi); |
| 2554 __ CheckMap(object, factory->heap_number_map(), not_found, true); | 2554 __ CheckMap(object, |
| 2555 factory->heap_number_map(), |
| 2556 not_found, |
| 2557 DONT_DO_SMI_CHECK); |
| 2555 | 2558 |
| 2556 STATIC_ASSERT(8 == kDoubleSize); | 2559 STATIC_ASSERT(8 == kDoubleSize); |
| 2557 __ movl(scratch, FieldOperand(object, HeapNumber::kValueOffset + 4)); | 2560 __ movl(scratch, FieldOperand(object, HeapNumber::kValueOffset + 4)); |
| 2558 __ xor_(scratch, FieldOperand(object, HeapNumber::kValueOffset)); | 2561 __ xor_(scratch, FieldOperand(object, HeapNumber::kValueOffset)); |
| 2559 GenerateConvertHashCodeToIndex(masm, scratch, mask); | 2562 GenerateConvertHashCodeToIndex(masm, scratch, mask); |
| 2560 | 2563 |
| 2561 Register index = scratch; | 2564 Register index = scratch; |
| 2562 Register probe = mask; | 2565 Register probe = mask; |
| 2563 __ movq(probe, | 2566 __ movq(probe, |
| 2564 FieldOperand(number_string_cache, | 2567 FieldOperand(number_string_cache, |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3674 | 3677 |
| 3675 | 3678 |
| 3676 void StringCharCodeAtGenerator::GenerateSlow( | 3679 void StringCharCodeAtGenerator::GenerateSlow( |
| 3677 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { | 3680 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { |
| 3678 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); | 3681 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); |
| 3679 | 3682 |
| 3680 Factory* factory = masm->isolate()->factory(); | 3683 Factory* factory = masm->isolate()->factory(); |
| 3681 // Index is not a smi. | 3684 // Index is not a smi. |
| 3682 __ bind(&index_not_smi_); | 3685 __ bind(&index_not_smi_); |
| 3683 // If index is a heap number, try converting it to an integer. | 3686 // If index is a heap number, try converting it to an integer. |
| 3684 __ CheckMap(index_, factory->heap_number_map(), index_not_number_, true); | 3687 __ CheckMap(index_, |
| 3688 factory->heap_number_map(), |
| 3689 index_not_number_, |
| 3690 DONT_DO_SMI_CHECK); |
| 3685 call_helper.BeforeCall(masm); | 3691 call_helper.BeforeCall(masm); |
| 3686 __ push(object_); | 3692 __ push(object_); |
| 3687 __ push(index_); | 3693 __ push(index_); |
| 3688 __ push(index_); // Consumed by runtime conversion function. | 3694 __ push(index_); // Consumed by runtime conversion function. |
| 3689 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3695 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
| 3690 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3696 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
| 3691 } else { | 3697 } else { |
| 3692 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3698 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
| 3693 // NumberToSmi discards numbers that are not exact integers. | 3699 // NumberToSmi discards numbers that are not exact integers. |
| 3694 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3700 __ CallRuntime(Runtime::kNumberToSmi, 1); |
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5101 __ Drop(1); | 5107 __ Drop(1); |
| 5102 __ ret(2 * kPointerSize); | 5108 __ ret(2 * kPointerSize); |
| 5103 } | 5109 } |
| 5104 | 5110 |
| 5105 | 5111 |
| 5106 #undef __ | 5112 #undef __ |
| 5107 | 5113 |
| 5108 } } // namespace v8::internal | 5114 } } // namespace v8::internal |
| 5109 | 5115 |
| 5110 #endif // V8_TARGET_ARCH_X64 | 5116 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |