OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 723 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
724 &miss, // When not a string. | 724 &miss, // When not a string. |
725 &miss, // When not a number. | 725 &miss, // When not a number. |
726 &miss, // When index out of range. | 726 &miss, // When index out of range. |
727 STRING_INDEX_IS_ARRAY_INDEX, | 727 STRING_INDEX_IS_ARRAY_INDEX, |
728 RECEIVER_IS_STRING); | 728 RECEIVER_IS_STRING); |
729 char_at_generator.GenerateFast(masm); | 729 char_at_generator.GenerateFast(masm); |
730 __ ret(0); | 730 __ ret(0); |
731 | 731 |
732 StubRuntimeCallHelper call_helper; | 732 StubRuntimeCallHelper call_helper; |
733 char_at_generator.GenerateSlow(masm, call_helper); | 733 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
734 | 734 |
735 __ bind(&miss); | 735 __ bind(&miss); |
736 PropertyAccessCompiler::TailCallBuiltin( | 736 PropertyAccessCompiler::TailCallBuiltin( |
737 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 737 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
738 } | 738 } |
739 | 739 |
740 | 740 |
741 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 741 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
742 CHECK(!has_new_target()); | 742 CHECK(!has_new_target()); |
743 // The key is in edx and the parameter count is in eax. | 743 // The key is in edx and the parameter count is in eax. |
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2929 Factory* factory = masm->isolate()->factory(); | 2929 Factory* factory = masm->isolate()->factory(); |
2930 StringCharLoadGenerator::Generate( | 2930 StringCharLoadGenerator::Generate( |
2931 masm, factory, object_, index_, result_, &call_runtime_); | 2931 masm, factory, object_, index_, result_, &call_runtime_); |
2932 | 2932 |
2933 __ SmiTag(result_); | 2933 __ SmiTag(result_); |
2934 __ bind(&exit_); | 2934 __ bind(&exit_); |
2935 } | 2935 } |
2936 | 2936 |
2937 | 2937 |
2938 void StringCharCodeAtGenerator::GenerateSlow( | 2938 void StringCharCodeAtGenerator::GenerateSlow( |
2939 MacroAssembler* masm, | 2939 MacroAssembler* masm, EmbedMode embed_mode, |
2940 const RuntimeCallHelper& call_helper) { | 2940 const RuntimeCallHelper& call_helper) { |
2941 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 2941 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
2942 | 2942 |
2943 // Index is not a smi. | 2943 // Index is not a smi. |
2944 __ bind(&index_not_smi_); | 2944 __ bind(&index_not_smi_); |
2945 // If index is a heap number, try converting it to an integer. | 2945 // If index is a heap number, try converting it to an integer. |
2946 __ CheckMap(index_, | 2946 __ CheckMap(index_, |
2947 masm->isolate()->factory()->heap_number_map(), | 2947 masm->isolate()->factory()->heap_number_map(), |
2948 index_not_number_, | 2948 index_not_number_, |
2949 DONT_DO_SMI_CHECK); | 2949 DONT_DO_SMI_CHECK); |
2950 call_helper.BeforeCall(masm); | 2950 call_helper.BeforeCall(masm); |
| 2951 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 2952 __ push(VectorLoadICDescriptor::VectorRegister()); |
| 2953 __ push(VectorLoadICDescriptor::SlotRegister()); |
| 2954 } |
2951 __ push(object_); | 2955 __ push(object_); |
2952 __ push(index_); // Consumed by runtime conversion function. | 2956 __ push(index_); // Consumed by runtime conversion function. |
2953 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2957 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
2954 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 2958 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
2955 } else { | 2959 } else { |
2956 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 2960 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
2957 // NumberToSmi discards numbers that are not exact integers. | 2961 // NumberToSmi discards numbers that are not exact integers. |
2958 __ CallRuntime(Runtime::kNumberToSmi, 1); | 2962 __ CallRuntime(Runtime::kNumberToSmi, 1); |
2959 } | 2963 } |
2960 if (!index_.is(eax)) { | 2964 if (!index_.is(eax)) { |
2961 // Save the conversion result before the pop instructions below | 2965 // Save the conversion result before the pop instructions below |
2962 // have a chance to overwrite it. | 2966 // have a chance to overwrite it. |
2963 __ mov(index_, eax); | 2967 __ mov(index_, eax); |
2964 } | 2968 } |
2965 __ pop(object_); | 2969 __ pop(object_); |
| 2970 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 2971 __ pop(VectorLoadICDescriptor::SlotRegister()); |
| 2972 __ pop(VectorLoadICDescriptor::VectorRegister()); |
| 2973 } |
2966 // Reload the instance type. | 2974 // Reload the instance type. |
2967 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 2975 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
2968 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 2976 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
2969 call_helper.AfterCall(masm); | 2977 call_helper.AfterCall(masm); |
2970 // If index is still not a smi, it must be out of range. | 2978 // If index is still not a smi, it must be out of range. |
2971 STATIC_ASSERT(kSmiTag == 0); | 2979 STATIC_ASSERT(kSmiTag == 0); |
2972 __ JumpIfNotSmi(index_, index_out_of_range_); | 2980 __ JumpIfNotSmi(index_, index_out_of_range_); |
2973 // Otherwise, return to the fast path. | 2981 // Otherwise, return to the fast path. |
2974 __ jmp(&got_smi_index_); | 2982 __ jmp(&got_smi_index_); |
2975 | 2983 |
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4582 Register vector = VectorLoadICDescriptor::VectorRegister(); // ebx | 4590 Register vector = VectorLoadICDescriptor::VectorRegister(); // ebx |
4583 Register slot = VectorLoadICDescriptor::SlotRegister(); // eax | 4591 Register slot = VectorLoadICDescriptor::SlotRegister(); // eax |
4584 Register feedback = edi; | 4592 Register feedback = edi; |
4585 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, | 4593 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, |
4586 FixedArray::kHeaderSize)); | 4594 FixedArray::kHeaderSize)); |
4587 // Is it a weak cell? | 4595 // Is it a weak cell? |
4588 Label try_array; | 4596 Label try_array; |
4589 Label not_array, smi_key, key_okay, miss; | 4597 Label not_array, smi_key, key_okay, miss; |
4590 __ CompareRoot(FieldOperand(feedback, 0), Heap::kWeakCellMapRootIndex); | 4598 __ CompareRoot(FieldOperand(feedback, 0), Heap::kWeakCellMapRootIndex); |
4591 __ j(not_equal, &try_array); | 4599 __ j(not_equal, &try_array); |
4592 __ JumpIfNotSmi(key, &miss); | |
4593 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, &miss); | 4600 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, &miss); |
4594 | 4601 |
4595 __ bind(&try_array); | 4602 __ bind(&try_array); |
4596 // Is it a fixed array? | 4603 // Is it a fixed array? |
4597 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | 4604 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); |
4598 __ j(not_equal, ¬_array); | 4605 __ j(not_equal, ¬_array); |
| 4606 |
4599 // We have a polymorphic element handler. | 4607 // We have a polymorphic element handler. |
4600 __ JumpIfNotSmi(key, &miss); | |
4601 | |
4602 Label polymorphic, try_poly_name; | 4608 Label polymorphic, try_poly_name; |
4603 __ bind(&polymorphic); | 4609 __ bind(&polymorphic); |
4604 HandleArrayCases(masm, receiver, key, vector, slot, feedback, true, &miss); | 4610 HandleArrayCases(masm, receiver, key, vector, slot, feedback, true, &miss); |
4605 | 4611 |
4606 __ bind(¬_array); | 4612 __ bind(¬_array); |
4607 // Is it generic? | 4613 // Is it generic? |
4608 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | 4614 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
4609 __ j(not_equal, &try_poly_name); | 4615 __ j(not_equal, &try_poly_name); |
4610 Handle<Code> megamorphic_stub = | 4616 Handle<Code> megamorphic_stub = |
4611 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate()); | 4617 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate()); |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5399 ApiParameterOperand(2), kStackSpace, nullptr, | 5405 ApiParameterOperand(2), kStackSpace, nullptr, |
5400 Operand(ebp, 7 * kPointerSize), NULL); | 5406 Operand(ebp, 7 * kPointerSize), NULL); |
5401 } | 5407 } |
5402 | 5408 |
5403 | 5409 |
5404 #undef __ | 5410 #undef __ |
5405 | 5411 |
5406 } } // namespace v8::internal | 5412 } } // namespace v8::internal |
5407 | 5413 |
5408 #endif // V8_TARGET_ARCH_IA32 | 5414 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |