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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 404 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
405 &miss, // When not a string. | 405 &miss, // When not a string. |
406 &miss, // When not a number. | 406 &miss, // When not a number. |
407 &miss, // When index out of range. | 407 &miss, // When index out of range. |
408 STRING_INDEX_IS_ARRAY_INDEX, | 408 STRING_INDEX_IS_ARRAY_INDEX, |
409 RECEIVER_IS_STRING); | 409 RECEIVER_IS_STRING); |
410 char_at_generator.GenerateFast(masm); | 410 char_at_generator.GenerateFast(masm); |
411 __ ret(0); | 411 __ ret(0); |
412 | 412 |
413 StubRuntimeCallHelper call_helper; | 413 StubRuntimeCallHelper call_helper; |
414 char_at_generator.GenerateSlow(masm, call_helper); | 414 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
415 | 415 |
416 __ bind(&miss); | 416 __ bind(&miss); |
417 PropertyAccessCompiler::TailCallBuiltin( | 417 PropertyAccessCompiler::TailCallBuiltin( |
418 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 418 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
419 } | 419 } |
420 | 420 |
421 | 421 |
422 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 422 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
423 CHECK(!has_new_target()); | 423 CHECK(!has_new_target()); |
424 // The key is in edx and the parameter count is in eax. | 424 // The key is in edx and the parameter count is in eax. |
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 Factory* factory = masm->isolate()->factory(); | 2619 Factory* factory = masm->isolate()->factory(); |
2620 StringCharLoadGenerator::Generate( | 2620 StringCharLoadGenerator::Generate( |
2621 masm, factory, object_, index_, result_, &call_runtime_); | 2621 masm, factory, object_, index_, result_, &call_runtime_); |
2622 | 2622 |
2623 __ SmiTag(result_); | 2623 __ SmiTag(result_); |
2624 __ bind(&exit_); | 2624 __ bind(&exit_); |
2625 } | 2625 } |
2626 | 2626 |
2627 | 2627 |
2628 void StringCharCodeAtGenerator::GenerateSlow( | 2628 void StringCharCodeAtGenerator::GenerateSlow( |
2629 MacroAssembler* masm, | 2629 MacroAssembler* masm, EmbedMode embed_mode, |
2630 const RuntimeCallHelper& call_helper) { | 2630 const RuntimeCallHelper& call_helper) { |
2631 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); | 2631 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
2632 | 2632 |
2633 // Index is not a smi. | 2633 // Index is not a smi. |
2634 __ bind(&index_not_smi_); | 2634 __ bind(&index_not_smi_); |
2635 // If index is a heap number, try converting it to an integer. | 2635 // If index is a heap number, try converting it to an integer. |
2636 __ CheckMap(index_, | 2636 __ CheckMap(index_, |
2637 masm->isolate()->factory()->heap_number_map(), | 2637 masm->isolate()->factory()->heap_number_map(), |
2638 index_not_number_, | 2638 index_not_number_, |
2639 DONT_DO_SMI_CHECK); | 2639 DONT_DO_SMI_CHECK); |
2640 call_helper.BeforeCall(masm); | 2640 call_helper.BeforeCall(masm); |
| 2641 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 2642 __ push(VectorLoadICDescriptor::VectorRegister()); |
| 2643 __ push(VectorLoadICDescriptor::SlotRegister()); |
| 2644 } |
2641 __ push(object_); | 2645 __ push(object_); |
2642 __ push(index_); // Consumed by runtime conversion function. | 2646 __ push(index_); // Consumed by runtime conversion function. |
2643 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2647 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
2644 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 2648 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
2645 } else { | 2649 } else { |
2646 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 2650 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
2647 // NumberToSmi discards numbers that are not exact integers. | 2651 // NumberToSmi discards numbers that are not exact integers. |
2648 __ CallRuntime(Runtime::kNumberToSmi, 1); | 2652 __ CallRuntime(Runtime::kNumberToSmi, 1); |
2649 } | 2653 } |
2650 if (!index_.is(eax)) { | 2654 if (!index_.is(eax)) { |
2651 // Save the conversion result before the pop instructions below | 2655 // Save the conversion result before the pop instructions below |
2652 // have a chance to overwrite it. | 2656 // have a chance to overwrite it. |
2653 __ mov(index_, eax); | 2657 __ mov(index_, eax); |
2654 } | 2658 } |
2655 __ pop(object_); | 2659 __ pop(object_); |
| 2660 if (FLAG_vector_ics && embed_mode == PART_OF_IC_HANDLER) { |
| 2661 __ pop(VectorLoadICDescriptor::SlotRegister()); |
| 2662 __ pop(VectorLoadICDescriptor::VectorRegister()); |
| 2663 } |
2656 // Reload the instance type. | 2664 // Reload the instance type. |
2657 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 2665 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
2658 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 2666 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
2659 call_helper.AfterCall(masm); | 2667 call_helper.AfterCall(masm); |
2660 // If index is still not a smi, it must be out of range. | 2668 // If index is still not a smi, it must be out of range. |
2661 STATIC_ASSERT(kSmiTag == 0); | 2669 STATIC_ASSERT(kSmiTag == 0); |
2662 __ JumpIfNotSmi(index_, index_out_of_range_); | 2670 __ JumpIfNotSmi(index_, index_out_of_range_); |
2663 // Otherwise, return to the fast path. | 2671 // Otherwise, return to the fast path. |
2664 __ jmp(&got_smi_index_); | 2672 __ jmp(&got_smi_index_); |
2665 | 2673 |
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4242 Register vector = VectorLoadICDescriptor::VectorRegister(); // ebx | 4250 Register vector = VectorLoadICDescriptor::VectorRegister(); // ebx |
4243 Register slot = VectorLoadICDescriptor::SlotRegister(); // eax | 4251 Register slot = VectorLoadICDescriptor::SlotRegister(); // eax |
4244 Register feedback = edi; | 4252 Register feedback = edi; |
4245 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, | 4253 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, |
4246 FixedArray::kHeaderSize)); | 4254 FixedArray::kHeaderSize)); |
4247 // Is it a weak cell? | 4255 // Is it a weak cell? |
4248 Label try_array; | 4256 Label try_array; |
4249 Label not_array, smi_key, key_okay, miss; | 4257 Label not_array, smi_key, key_okay, miss; |
4250 __ CompareRoot(FieldOperand(feedback, 0), Heap::kWeakCellMapRootIndex); | 4258 __ CompareRoot(FieldOperand(feedback, 0), Heap::kWeakCellMapRootIndex); |
4251 __ j(not_equal, &try_array); | 4259 __ j(not_equal, &try_array); |
4252 __ JumpIfNotSmi(key, &miss); | |
4253 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, &miss); | 4260 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, &miss); |
4254 | 4261 |
4255 __ bind(&try_array); | 4262 __ bind(&try_array); |
4256 // Is it a fixed array? | 4263 // Is it a fixed array? |
4257 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | 4264 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); |
4258 __ j(not_equal, ¬_array); | 4265 __ j(not_equal, ¬_array); |
| 4266 |
4259 // We have a polymorphic element handler. | 4267 // We have a polymorphic element handler. |
4260 __ JumpIfNotSmi(key, &miss); | |
4261 | |
4262 Label polymorphic, try_poly_name; | 4268 Label polymorphic, try_poly_name; |
4263 __ bind(&polymorphic); | 4269 __ bind(&polymorphic); |
4264 HandleArrayCases(masm, receiver, key, vector, slot, feedback, true, &miss); | 4270 HandleArrayCases(masm, receiver, key, vector, slot, feedback, true, &miss); |
4265 | 4271 |
4266 __ bind(¬_array); | 4272 __ bind(¬_array); |
4267 // Is it generic? | 4273 // Is it generic? |
4268 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | 4274 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
4269 __ j(not_equal, &try_poly_name); | 4275 __ j(not_equal, &try_poly_name); |
4270 Handle<Code> megamorphic_stub = | 4276 Handle<Code> megamorphic_stub = |
4271 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate()); | 4277 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate()); |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5059 ApiParameterOperand(2), kStackSpace, nullptr, | 5065 ApiParameterOperand(2), kStackSpace, nullptr, |
5060 Operand(ebp, 7 * kPointerSize), NULL); | 5066 Operand(ebp, 7 * kPointerSize), NULL); |
5061 } | 5067 } |
5062 | 5068 |
5063 | 5069 |
5064 #undef __ | 5070 #undef __ |
5065 | 5071 |
5066 } } // namespace v8::internal | 5072 } } // namespace v8::internal |
5067 | 5073 |
5068 #endif // V8_TARGET_ARCH_X87 | 5074 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |