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 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 | 2919 |
2922 Factory* factory = masm->isolate()->factory(); | 2920 Factory* factory = masm->isolate()->factory(); |
2923 // Index is not a smi. | 2921 // Index is not a smi. |
2924 __ bind(&index_not_smi_); | 2922 __ bind(&index_not_smi_); |
2925 // If index is a heap number, try converting it to an integer. | 2923 // If index is a heap number, try converting it to an integer. |
2926 __ CheckMap(index_, | 2924 __ CheckMap(index_, |
2927 factory->heap_number_map(), | 2925 factory->heap_number_map(), |
2928 index_not_number_, | 2926 index_not_number_, |
2929 DONT_DO_SMI_CHECK); | 2927 DONT_DO_SMI_CHECK); |
2930 call_helper.BeforeCall(masm); | 2928 call_helper.BeforeCall(masm); |
2931 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | 2929 if (embed_mode == PART_OF_IC_HANDLER) { |
2932 __ Push(VectorLoadICDescriptor::VectorRegister()); | 2930 __ Push(VectorLoadICDescriptor::VectorRegister()); |
2933 __ Push(VectorLoadICDescriptor::SlotRegister()); | 2931 __ Push(VectorLoadICDescriptor::SlotRegister()); |
2934 } | 2932 } |
2935 __ Push(object_); | 2933 __ Push(object_); |
2936 __ Push(index_); // Consumed by runtime conversion function. | 2934 __ Push(index_); // Consumed by runtime conversion function. |
2937 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2935 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
2938 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 2936 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
2939 } else { | 2937 } else { |
2940 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 2938 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
2941 // NumberToSmi discards numbers that are not exact integers. | 2939 // NumberToSmi discards numbers that are not exact integers. |
2942 __ CallRuntime(Runtime::kNumberToSmi, 1); | 2940 __ CallRuntime(Runtime::kNumberToSmi, 1); |
2943 } | 2941 } |
2944 if (!index_.is(rax)) { | 2942 if (!index_.is(rax)) { |
2945 // Save the conversion result before the pop instructions below | 2943 // Save the conversion result before the pop instructions below |
2946 // have a chance to overwrite it. | 2944 // have a chance to overwrite it. |
2947 __ movp(index_, rax); | 2945 __ movp(index_, rax); |
2948 } | 2946 } |
2949 __ Pop(object_); | 2947 __ Pop(object_); |
2950 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { | 2948 if (embed_mode == PART_OF_IC_HANDLER) { |
2951 __ Pop(VectorLoadICDescriptor::SlotRegister()); | 2949 __ Pop(VectorLoadICDescriptor::SlotRegister()); |
2952 __ Pop(VectorLoadICDescriptor::VectorRegister()); | 2950 __ Pop(VectorLoadICDescriptor::VectorRegister()); |
2953 } | 2951 } |
2954 // Reload the instance type. | 2952 // Reload the instance type. |
2955 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 2953 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
2956 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 2954 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
2957 call_helper.AfterCall(masm); | 2955 call_helper.AfterCall(masm); |
2958 // If index is still not a smi, it must be out of range. | 2956 // If index is still not a smi, it must be out of range. |
2959 __ JumpIfNotSmi(index_, index_out_of_range_); | 2957 __ JumpIfNotSmi(index_, index_out_of_range_); |
2960 // Otherwise, return to the fast path. | 2958 // Otherwise, return to the fast path. |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5362 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, | 5360 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, |
5363 kStackSpace, nullptr, return_value_operand, NULL); | 5361 kStackSpace, nullptr, return_value_operand, NULL); |
5364 } | 5362 } |
5365 | 5363 |
5366 | 5364 |
5367 #undef __ | 5365 #undef __ |
5368 | 5366 |
5369 } } // namespace v8::internal | 5367 } } // namespace v8::internal |
5370 | 5368 |
5371 #endif // V8_TARGET_ARCH_X64 | 5369 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |