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 10904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10915 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { | 10915 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { |
10916 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); | 10916 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); |
10917 | 10917 |
10918 // Index is not a smi. | 10918 // Index is not a smi. |
10919 __ bind(&index_not_smi_); | 10919 __ bind(&index_not_smi_); |
10920 // If index is a heap number, try converting it to an integer. | 10920 // If index is a heap number, try converting it to an integer. |
10921 __ CheckMap(index_, Factory::heap_number_map(), index_not_number_, true); | 10921 __ CheckMap(index_, Factory::heap_number_map(), index_not_number_, true); |
10922 call_helper.BeforeCall(masm); | 10922 call_helper.BeforeCall(masm); |
10923 __ push(object_); | 10923 __ push(object_); |
10924 __ push(index_); | 10924 __ push(index_); |
10925 __ push(result_); | |
10926 __ push(index_); // Consumed by runtime conversion function. | 10925 __ push(index_); // Consumed by runtime conversion function. |
10927 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 10926 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
10928 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 10927 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
10929 } else { | 10928 } else { |
10930 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 10929 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
10931 // NumberToSmi discards numbers that are not exact integers. | 10930 // NumberToSmi discards numbers that are not exact integers. |
10932 __ CallRuntime(Runtime::kNumberToSmi, 1); | 10931 __ CallRuntime(Runtime::kNumberToSmi, 1); |
10933 } | 10932 } |
10934 if (!scratch_.is(rax)) { | 10933 if (!scratch_.is(rax)) { |
10935 // Save the conversion result before the pop instructions below | 10934 // Save the conversion result before the pop instructions below |
10936 // have a chance to overwrite it. | 10935 // have a chance to overwrite it. |
10937 __ movq(scratch_, rax); | 10936 __ movq(scratch_, rax); |
10938 } | 10937 } |
10939 __ pop(result_); | |
10940 __ pop(index_); | 10938 __ pop(index_); |
10941 __ pop(object_); | 10939 __ pop(object_); |
| 10940 // Reload the instance type. |
| 10941 __ movq(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
| 10942 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
10942 call_helper.AfterCall(masm); | 10943 call_helper.AfterCall(masm); |
10943 // If index is still not a smi, it must be out of range. | 10944 // If index is still not a smi, it must be out of range. |
10944 __ JumpIfNotSmi(scratch_, index_out_of_range_); | 10945 __ JumpIfNotSmi(scratch_, index_out_of_range_); |
10945 // Otherwise, return to the fast path. | 10946 // Otherwise, return to the fast path. |
10946 __ jmp(&got_smi_index_); | 10947 __ jmp(&got_smi_index_); |
10947 | 10948 |
10948 // Call runtime. We get here when the receiver is a string and the | 10949 // Call runtime. We get here when the receiver is a string and the |
10949 // index is a number, but the code of getting the actual character | 10950 // index is a number, but the code of getting the actual character |
10950 // is too complex (e.g., when the string needs to be flattened). | 10951 // is too complex (e.g., when the string needs to be flattened). |
10951 __ bind(&call_runtime_); | 10952 __ bind(&call_runtime_); |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11856 } | 11857 } |
11857 | 11858 |
11858 #endif | 11859 #endif |
11859 | 11860 |
11860 | 11861 |
11861 #undef __ | 11862 #undef __ |
11862 | 11863 |
11863 } } // namespace v8::internal | 11864 } } // namespace v8::internal |
11864 | 11865 |
11865 #endif // V8_TARGET_ARCH_X64 | 11866 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |