OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 923 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
924 &miss, // When not a string. | 924 &miss, // When not a string. |
925 &miss, // When not a number. | 925 &miss, // When not a number. |
926 &miss, // When index out of range. | 926 &miss, // When index out of range. |
927 STRING_INDEX_IS_ARRAY_INDEX, | 927 STRING_INDEX_IS_ARRAY_INDEX, |
928 RECEIVER_IS_STRING); | 928 RECEIVER_IS_STRING); |
929 char_at_generator.GenerateFast(masm); | 929 char_at_generator.GenerateFast(masm); |
930 __ ret(0); | 930 __ ret(0); |
931 | 931 |
932 StubRuntimeCallHelper call_helper; | 932 StubRuntimeCallHelper call_helper; |
933 char_at_generator.GenerateSlow(masm, call_helper); | 933 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
934 | 934 |
935 __ bind(&miss); | 935 __ bind(&miss); |
936 PropertyAccessCompiler::TailCallBuiltin( | 936 PropertyAccessCompiler::TailCallBuiltin( |
937 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 937 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
938 } | 938 } |
939 | 939 |
940 | 940 |
941 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { | 941 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
942 // rsp[0] : return address | 942 // rsp[0] : return address |
943 // rsp[8] : number of parameters | 943 // rsp[8] : number of parameters |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 | 2892 |
2893 StringCharLoadGenerator::Generate( | 2893 StringCharLoadGenerator::Generate( |
2894 masm, object_, index_, result_, &call_runtime_); | 2894 masm, object_, index_, result_, &call_runtime_); |
2895 | 2895 |
2896 __ Integer32ToSmi(result_, result_); | 2896 __ Integer32ToSmi(result_, result_); |
2897 __ bind(&exit_); | 2897 __ bind(&exit_); |
2898 } | 2898 } |
2899 | 2899 |
2900 | 2900 |
2901 void StringCharCodeAtGenerator::GenerateSlow( | 2901 void StringCharCodeAtGenerator::GenerateSlow( |
2902 MacroAssembler* masm, | 2902 MacroAssembler* masm, EmbedMode embed_mode, |
2903 const RuntimeCallHelper& call_helper) { | 2903 const RuntimeCallHelper& call_helper) { |
2904 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 2904 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
2905 | 2905 |
2906 Factory* factory = masm->isolate()->factory(); | 2906 Factory* factory = masm->isolate()->factory(); |
2907 // Index is not a smi. | 2907 // Index is not a smi. |
2908 __ bind(&index_not_smi_); | 2908 __ bind(&index_not_smi_); |
2909 // If index is a heap number, try converting it to an integer. | 2909 // If index is a heap number, try converting it to an integer. |
2910 __ CheckMap(index_, | 2910 __ CheckMap(index_, |
2911 factory->heap_number_map(), | 2911 factory->heap_number_map(), |
2912 index_not_number_, | 2912 index_not_number_, |
2913 DONT_DO_SMI_CHECK); | 2913 DONT_DO_SMI_CHECK); |
2914 call_helper.BeforeCall(masm); | 2914 call_helper.BeforeCall(masm); |
| 2915 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 2916 __ Push(VectorLoadICDescriptor::VectorRegister()); |
| 2917 __ Push(VectorLoadICDescriptor::SlotRegister()); |
| 2918 } |
2915 __ Push(object_); | 2919 __ Push(object_); |
2916 __ Push(index_); // Consumed by runtime conversion function. | 2920 __ Push(index_); // Consumed by runtime conversion function. |
2917 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2921 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
2918 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 2922 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
2919 } else { | 2923 } else { |
2920 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 2924 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
2921 // NumberToSmi discards numbers that are not exact integers. | 2925 // NumberToSmi discards numbers that are not exact integers. |
2922 __ CallRuntime(Runtime::kNumberToSmi, 1); | 2926 __ CallRuntime(Runtime::kNumberToSmi, 1); |
2923 } | 2927 } |
2924 if (!index_.is(rax)) { | 2928 if (!index_.is(rax)) { |
2925 // Save the conversion result before the pop instructions below | 2929 // Save the conversion result before the pop instructions below |
2926 // have a chance to overwrite it. | 2930 // have a chance to overwrite it. |
2927 __ movp(index_, rax); | 2931 __ movp(index_, rax); |
2928 } | 2932 } |
2929 __ Pop(object_); | 2933 __ Pop(object_); |
| 2934 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 2935 __ Pop(VectorLoadICDescriptor::SlotRegister()); |
| 2936 __ Pop(VectorLoadICDescriptor::VectorRegister()); |
| 2937 } |
2930 // Reload the instance type. | 2938 // Reload the instance type. |
2931 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 2939 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
2932 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 2940 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
2933 call_helper.AfterCall(masm); | 2941 call_helper.AfterCall(masm); |
2934 // If index is still not a smi, it must be out of range. | 2942 // If index is still not a smi, it must be out of range. |
2935 __ JumpIfNotSmi(index_, index_out_of_range_); | 2943 __ JumpIfNotSmi(index_, index_out_of_range_); |
2936 // Otherwise, return to the fast path. | 2944 // Otherwise, return to the fast path. |
2937 __ jmp(&got_smi_index_); | 2945 __ jmp(&got_smi_index_); |
2938 | 2946 |
2939 // Call runtime. We get here when the receiver is a string and the | 2947 // Call runtime. We get here when the receiver is a string and the |
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4511 | 4519 |
4512 __ SmiToInteger32(integer_slot, slot); | 4520 __ SmiToInteger32(integer_slot, slot); |
4513 __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size, | 4521 __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size, |
4514 FixedArray::kHeaderSize)); | 4522 FixedArray::kHeaderSize)); |
4515 | 4523 |
4516 // Is it a weak cell? | 4524 // Is it a weak cell? |
4517 Label try_array; | 4525 Label try_array; |
4518 Label not_array, smi_key, key_okay, miss; | 4526 Label not_array, smi_key, key_okay, miss; |
4519 __ CompareRoot(FieldOperand(feedback, 0), Heap::kWeakCellMapRootIndex); | 4527 __ CompareRoot(FieldOperand(feedback, 0), Heap::kWeakCellMapRootIndex); |
4520 __ j(not_equal, &try_array); | 4528 __ j(not_equal, &try_array); |
4521 __ JumpIfNotSmi(key, &miss); | |
4522 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, | 4529 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, |
4523 integer_slot, &miss); | 4530 integer_slot, &miss); |
4524 | 4531 |
4525 __ bind(&try_array); | 4532 __ bind(&try_array); |
4526 // Is it a fixed array? | 4533 // Is it a fixed array? |
4527 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | 4534 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); |
4528 __ j(not_equal, ¬_array); | 4535 __ j(not_equal, ¬_array); |
| 4536 |
4529 // We have a polymorphic element handler. | 4537 // We have a polymorphic element handler. |
4530 __ JumpIfNotSmi(key, &miss); | |
4531 | |
4532 Label polymorphic, try_poly_name; | 4538 Label polymorphic, try_poly_name; |
4533 __ bind(&polymorphic); | 4539 __ bind(&polymorphic); |
4534 HandleArrayCases(masm, receiver, key, vector, slot, feedback, integer_slot, | 4540 HandleArrayCases(masm, receiver, key, vector, slot, feedback, integer_slot, |
4535 r9, r11, r15, true, &miss); | 4541 r9, r11, r15, true, &miss); |
4536 | 4542 |
4537 __ bind(¬_array); | 4543 __ bind(¬_array); |
4538 // Is it generic? | 4544 // Is it generic? |
4539 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | 4545 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
4540 __ j(not_equal, &try_poly_name); | 4546 __ j(not_equal, &try_poly_name); |
4541 Handle<Code> megamorphic_stub = | 4547 Handle<Code> megamorphic_stub = |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5354 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, | 5360 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, |
5355 kStackSpace, nullptr, return_value_operand, NULL); | 5361 kStackSpace, nullptr, return_value_operand, NULL); |
5356 } | 5362 } |
5357 | 5363 |
5358 | 5364 |
5359 #undef __ | 5365 #undef __ |
5360 | 5366 |
5361 } } // namespace v8::internal | 5367 } } // namespace v8::internal |
5362 | 5368 |
5363 #endif // V8_TARGET_ARCH_X64 | 5369 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |