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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 __ ret(0); | 520 __ ret(0); |
521 } | 521 } |
522 } | 522 } |
523 | 523 |
524 | 524 |
525 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 525 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
526 Label miss; | 526 Label miss; |
527 Register receiver = LoadDescriptor::ReceiverRegister(); | 527 Register receiver = LoadDescriptor::ReceiverRegister(); |
528 // Ensure that the vector and slot registers won't be clobbered before | 528 // Ensure that the vector and slot registers won't be clobbered before |
529 // calling the miss handler. | 529 // calling the miss handler. |
530 DCHECK(!FLAG_vector_ics || | 530 DCHECK(!AreAliased(r8, r9, VectorLoadICDescriptor::VectorRegister(), |
531 !AreAliased(r8, r9, VectorLoadICDescriptor::VectorRegister(), | |
532 VectorLoadICDescriptor::SlotRegister())); | 531 VectorLoadICDescriptor::SlotRegister())); |
533 | 532 |
534 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, | 533 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, |
535 r9, &miss); | 534 r9, &miss); |
536 __ bind(&miss); | 535 __ bind(&miss); |
537 PropertyAccessCompiler::TailCallBuiltin( | 536 PropertyAccessCompiler::TailCallBuiltin( |
538 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 537 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
539 } | 538 } |
540 | 539 |
541 | 540 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 | 905 |
907 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { | 906 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { |
908 // Return address is on the stack. | 907 // Return address is on the stack. |
909 Label miss; | 908 Label miss; |
910 | 909 |
911 Register receiver = LoadDescriptor::ReceiverRegister(); | 910 Register receiver = LoadDescriptor::ReceiverRegister(); |
912 Register index = LoadDescriptor::NameRegister(); | 911 Register index = LoadDescriptor::NameRegister(); |
913 Register scratch = rdi; | 912 Register scratch = rdi; |
914 Register result = rax; | 913 Register result = rax; |
915 DCHECK(!scratch.is(receiver) && !scratch.is(index)); | 914 DCHECK(!scratch.is(receiver) && !scratch.is(index)); |
916 DCHECK(!FLAG_vector_ics || | 915 DCHECK(!scratch.is(VectorLoadICDescriptor::VectorRegister()) && |
917 (!scratch.is(VectorLoadICDescriptor::VectorRegister()) && | 916 result.is(VectorLoadICDescriptor::SlotRegister())); |
918 result.is(VectorLoadICDescriptor::SlotRegister()))); | |
919 | 917 |
920 // StringCharAtGenerator doesn't use the result register until it's passed | 918 // StringCharAtGenerator doesn't use the result register until it's passed |
921 // the different miss possibilities. If it did, we would have a conflict | 919 // the different miss possibilities. If it did, we would have a conflict |
922 // when FLAG_vector_ics is true. | 920 // when FLAG_vector_ics is true. |
923 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 921 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
924 &miss, // When not a string. | 922 &miss, // When not a string. |
925 &miss, // When not a number. | 923 &miss, // When not a number. |
926 &miss, // When index out of range. | 924 &miss, // When index out of range. |
927 STRING_INDEX_IS_ARRAY_INDEX, | 925 STRING_INDEX_IS_ARRAY_INDEX, |
928 RECEIVER_IS_STRING); | 926 RECEIVER_IS_STRING); |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2934 | 2932 |
2935 Factory* factory = masm->isolate()->factory(); | 2933 Factory* factory = masm->isolate()->factory(); |
2936 // Index is not a smi. | 2934 // Index is not a smi. |
2937 __ bind(&index_not_smi_); | 2935 __ bind(&index_not_smi_); |
2938 // If index is a heap number, try converting it to an integer. | 2936 // If index is a heap number, try converting it to an integer. |
2939 __ CheckMap(index_, | 2937 __ CheckMap(index_, |
2940 factory->heap_number_map(), | 2938 factory->heap_number_map(), |
2941 index_not_number_, | 2939 index_not_number_, |
2942 DONT_DO_SMI_CHECK); | 2940 DONT_DO_SMI_CHECK); |
2943 call_helper.BeforeCall(masm); | 2941 call_helper.BeforeCall(masm); |
2944 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | 2942 if (embed_mode == PART_OF_IC_HANDLER) { |
2945 __ Push(VectorLoadICDescriptor::VectorRegister()); | 2943 __ Push(VectorLoadICDescriptor::VectorRegister()); |
2946 __ Push(VectorLoadICDescriptor::SlotRegister()); | 2944 __ Push(VectorLoadICDescriptor::SlotRegister()); |
2947 } | 2945 } |
2948 __ Push(object_); | 2946 __ Push(object_); |
2949 __ Push(index_); // Consumed by runtime conversion function. | 2947 __ Push(index_); // Consumed by runtime conversion function. |
2950 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2948 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
2951 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 2949 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
2952 } else { | 2950 } else { |
2953 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 2951 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
2954 // NumberToSmi discards numbers that are not exact integers. | 2952 // NumberToSmi discards numbers that are not exact integers. |
2955 __ CallRuntime(Runtime::kNumberToSmi, 1); | 2953 __ CallRuntime(Runtime::kNumberToSmi, 1); |
2956 } | 2954 } |
2957 if (!index_.is(rax)) { | 2955 if (!index_.is(rax)) { |
2958 // Save the conversion result before the pop instructions below | 2956 // Save the conversion result before the pop instructions below |
2959 // have a chance to overwrite it. | 2957 // have a chance to overwrite it. |
2960 __ movp(index_, rax); | 2958 __ movp(index_, rax); |
2961 } | 2959 } |
2962 __ Pop(object_); | 2960 __ Pop(object_); |
2963 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | 2961 if (embed_mode == PART_OF_IC_HANDLER) { |
2964 __ Pop(VectorLoadICDescriptor::SlotRegister()); | 2962 __ Pop(VectorLoadICDescriptor::SlotRegister()); |
2965 __ Pop(VectorLoadICDescriptor::VectorRegister()); | 2963 __ Pop(VectorLoadICDescriptor::VectorRegister()); |
2966 } | 2964 } |
2967 // Reload the instance type. | 2965 // Reload the instance type. |
2968 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 2966 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
2969 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 2967 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
2970 call_helper.AfterCall(masm); | 2968 call_helper.AfterCall(masm); |
2971 // If index is still not a smi, it must be out of range. | 2969 // If index is still not a smi, it must be out of range. |
2972 __ JumpIfNotSmi(index_, index_out_of_range_); | 2970 __ JumpIfNotSmi(index_, index_out_of_range_); |
2973 // Otherwise, return to the fast path. | 2971 // Otherwise, return to the fast path. |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5375 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, | 5373 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, |
5376 kStackSpace, nullptr, return_value_operand, NULL); | 5374 kStackSpace, nullptr, return_value_operand, NULL); |
5377 } | 5375 } |
5378 | 5376 |
5379 | 5377 |
5380 #undef __ | 5378 #undef __ |
5381 | 5379 |
5382 } } // namespace v8::internal | 5380 } } // namespace v8::internal |
5383 | 5381 |
5384 #endif // V8_TARGET_ARCH_X64 | 5382 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |