| 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/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 __ mov(unmapped_location, value); | 502 __ mov(unmapped_location, value); |
| 503 __ lea(edi, unmapped_location); | 503 __ lea(edi, unmapped_location); |
| 504 __ mov(edx, value); | 504 __ mov(edx, value); |
| 505 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); | 505 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); |
| 506 __ Ret(); | 506 __ Ret(); |
| 507 __ bind(&slow); | 507 __ bind(&slow); |
| 508 GenerateMiss(masm); | 508 GenerateMiss(masm); |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 static void KeyedStoreGenerateGenericHelper( | 512 static void KeyedStoreGenerateMegamorphicHelper( |
| 513 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 513 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
| 514 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) { | 514 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) { |
| 515 Label transition_smi_elements; | 515 Label transition_smi_elements; |
| 516 Label finish_object_store, non_double_value, transition_double_elements; | 516 Label finish_object_store, non_double_value, transition_double_elements; |
| 517 Label fast_double_without_map_check; | 517 Label fast_double_without_map_check; |
| 518 Register receiver = StoreDescriptor::ReceiverRegister(); | 518 Register receiver = StoreDescriptor::ReceiverRegister(); |
| 519 Register key = StoreDescriptor::NameRegister(); | 519 Register key = StoreDescriptor::NameRegister(); |
| 520 Register value = StoreDescriptor::ValueRegister(); | 520 Register value = StoreDescriptor::ValueRegister(); |
| 521 DCHECK(receiver.is(edx)); | 521 DCHECK(receiver.is(edx)); |
| 522 DCHECK(key.is(ecx)); | 522 DCHECK(key.is(ecx)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, | 640 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, |
| 641 ebx, edi, slow); | 641 ebx, edi, slow); |
| 642 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 642 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
| 643 ElementsTransitionGenerator::GenerateDoubleToObject(masm, receiver, key, | 643 ElementsTransitionGenerator::GenerateDoubleToObject(masm, receiver, key, |
| 644 value, ebx, mode, slow); | 644 value, ebx, mode, slow); |
| 645 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); | 645 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); |
| 646 __ jmp(&finish_object_store); | 646 __ jmp(&finish_object_store); |
| 647 } | 647 } |
| 648 | 648 |
| 649 | 649 |
| 650 void KeyedStoreIC::GenerateGeneric( | 650 void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, |
| 651 MacroAssembler* masm, StrictMode strict_mode, | 651 StrictMode strict_mode) { |
| 652 KeyedStoreStubCacheRequirement handler_requirement) { | |
| 653 // Return address is on the stack. | 652 // Return address is on the stack. |
| 654 Label slow, fast_object, fast_object_grow; | 653 Label slow, fast_object, fast_object_grow; |
| 655 Label fast_double, fast_double_grow; | 654 Label fast_double, fast_double_grow; |
| 656 Label array, extra, check_if_double_array, maybe_name_key, miss; | 655 Label array, extra, check_if_double_array, maybe_name_key, miss; |
| 657 Register receiver = StoreDescriptor::ReceiverRegister(); | 656 Register receiver = StoreDescriptor::ReceiverRegister(); |
| 658 Register key = StoreDescriptor::NameRegister(); | 657 Register key = StoreDescriptor::NameRegister(); |
| 659 DCHECK(receiver.is(edx)); | 658 DCHECK(receiver.is(edx)); |
| 660 DCHECK(key.is(ecx)); | 659 DCHECK(key.is(ecx)); |
| 661 | 660 |
| 662 // Check that the object isn't a smi. | 661 // Check that the object isn't a smi. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 691 | 690 |
| 692 __ bind(&maybe_name_key); | 691 __ bind(&maybe_name_key); |
| 693 __ mov(ebx, FieldOperand(key, HeapObject::kMapOffset)); | 692 __ mov(ebx, FieldOperand(key, HeapObject::kMapOffset)); |
| 694 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 693 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
| 695 __ JumpIfNotUniqueNameInstanceType(ebx, &slow); | 694 __ JumpIfNotUniqueNameInstanceType(ebx, &slow); |
| 696 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 695 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
| 697 Code::ComputeHandlerFlags(Code::STORE_IC)); | 696 Code::ComputeHandlerFlags(Code::STORE_IC)); |
| 698 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, | 697 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, |
| 699 key, ebx, no_reg); | 698 key, ebx, no_reg); |
| 700 // Cache miss. | 699 // Cache miss. |
| 701 if (handler_requirement == kCallRuntimeOnMissingHandler) { | 700 __ jmp(&miss); |
| 702 __ jmp(&slow); | |
| 703 } else { | |
| 704 DCHECK(handler_requirement == kMissOnMissingHandler); | |
| 705 __ jmp(&miss); | |
| 706 } | |
| 707 | 701 |
| 708 // Extra capacity case: Check if there is extra capacity to | 702 // Extra capacity case: Check if there is extra capacity to |
| 709 // perform the store and update the length. Used for adding one | 703 // perform the store and update the length. Used for adding one |
| 710 // element to the array by writing to array[array.length]. | 704 // element to the array by writing to array[array.length]. |
| 711 __ bind(&extra); | 705 __ bind(&extra); |
| 712 // receiver is a JSArray. | 706 // receiver is a JSArray. |
| 713 // key is a smi. | 707 // key is a smi. |
| 714 // ebx: receiver->elements, a FixedArray | 708 // ebx: receiver->elements, a FixedArray |
| 715 // edi: receiver map | 709 // edi: receiver map |
| 716 // flags: compare (key, receiver.length()) | 710 // flags: compare (key, receiver.length()) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 735 // receiver is a JSArray. | 729 // receiver is a JSArray. |
| 736 // key is a smi. | 730 // key is a smi. |
| 737 // edi: receiver map | 731 // edi: receiver map |
| 738 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); | 732 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); |
| 739 | 733 |
| 740 // Check the key against the length in the array and fall through to the | 734 // Check the key against the length in the array and fall through to the |
| 741 // common store code. | 735 // common store code. |
| 742 __ cmp(key, FieldOperand(receiver, JSArray::kLengthOffset)); // Compare smis. | 736 __ cmp(key, FieldOperand(receiver, JSArray::kLengthOffset)); // Compare smis. |
| 743 __ j(above_equal, &extra); | 737 __ j(above_equal, &extra); |
| 744 | 738 |
| 745 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow, | 739 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object, &fast_double, &slow, |
| 746 kCheckMap, kDontIncrementLength); | 740 kCheckMap, kDontIncrementLength); |
| 747 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 741 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow, |
| 748 &slow, kDontCheckMap, kIncrementLength); | 742 &fast_double_grow, &slow, kDontCheckMap, |
| 743 kIncrementLength); |
| 749 | 744 |
| 750 if (handler_requirement == kMissOnMissingHandler) { | 745 __ bind(&miss); |
| 751 __ bind(&miss); | 746 GenerateMiss(masm); |
| 752 GenerateMiss(masm); | |
| 753 } | |
| 754 } | 747 } |
| 755 | 748 |
| 756 | 749 |
| 757 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 750 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
| 758 Register dictionary = eax; | 751 Register dictionary = eax; |
| 759 DCHECK(!dictionary.is(LoadDescriptor::ReceiverRegister())); | 752 DCHECK(!dictionary.is(LoadDescriptor::ReceiverRegister())); |
| 760 DCHECK(!dictionary.is(LoadDescriptor::NameRegister())); | 753 DCHECK(!dictionary.is(LoadDescriptor::NameRegister())); |
| 761 | 754 |
| 762 Label slow; | 755 Label slow; |
| 763 | 756 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 Condition cc = | 966 Condition cc = |
| 974 (check == ENABLE_INLINED_SMI_CHECK) | 967 (check == ENABLE_INLINED_SMI_CHECK) |
| 975 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 968 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 976 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 969 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 977 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 970 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 978 } | 971 } |
| 979 } | 972 } |
| 980 } // namespace v8::internal | 973 } // namespace v8::internal |
| 981 | 974 |
| 982 #endif // V8_TARGET_ARCH_X87 | 975 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |