OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 __ mov(r3, r0); | 880 __ mov(r3, r0); |
881 __ Push(r3, r2); | 881 __ Push(r3, r2); |
882 | 882 |
883 // Perform tail call to the entry. | 883 // Perform tail call to the entry. |
884 ExternalReference ref = | 884 ExternalReference ref = |
885 ExternalReference(IC_Utility(kLoadIC_Miss), isolate); | 885 ExternalReference(IC_Utility(kLoadIC_Miss), isolate); |
886 __ TailCallExternalReference(ref, 2, 1); | 886 __ TailCallExternalReference(ref, 2, 1); |
887 } | 887 } |
888 | 888 |
889 | 889 |
| 890 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, |
| 891 Register object, |
| 892 Register key, |
| 893 Register scratch1, |
| 894 Register scratch2, |
| 895 Register scratch3, |
| 896 Label* unmapped_case, |
| 897 Label* slow_case) { |
| 898 Heap* heap = masm->isolate()->heap(); |
| 899 |
| 900 // Check that the receiver isn't a smi. |
| 901 __ JumpIfSmi(object, slow_case); |
| 902 |
| 903 // Check that the key is a positive smi. |
| 904 __ tst(key, Operand(0x8000001)); |
| 905 __ b(ne, slow_case); |
| 906 |
| 907 // Load the elements into scratch1 and check its map. |
| 908 Handle<Map> arguments_map(heap->non_strict_arguments_elements_map()); |
| 909 __ ldr(scratch1, FieldMemOperand(object, JSObject::kElementsOffset)); |
| 910 __ CheckMap(scratch1, scratch2, arguments_map, slow_case, DONT_DO_SMI_CHECK); |
| 911 |
| 912 // Check if element is in the range of mapped arguments. If not, jump |
| 913 // to the unmapped lookup with the parameter map in scratch1. |
| 914 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); |
| 915 __ sub(scratch2, scratch2, Operand(Smi::FromInt(2))); |
| 916 __ cmp(key, Operand(scratch2)); |
| 917 __ b(cs, unmapped_case); |
| 918 |
| 919 // Load element index and check whether it is the hole. |
| 920 const int kOffset = |
| 921 FixedArray::kHeaderSize + 2 * kPointerSize - kHeapObjectTag; |
| 922 |
| 923 __ mov(scratch3, Operand(kPointerSize >> 1)); |
| 924 __ mul(scratch3, key, scratch3); |
| 925 __ add(scratch3, scratch3, Operand(kOffset)); |
| 926 |
| 927 __ ldr(scratch2, MemOperand(scratch1, scratch3)); |
| 928 __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex); |
| 929 __ cmp(scratch2, scratch3); |
| 930 __ b(eq, unmapped_case); |
| 931 |
| 932 // Load value from context and return it. We can reuse scratch1 because |
| 933 // we do not jump to the unmapped lookup (which requires the parameter |
| 934 // map in scratch1). |
| 935 __ ldr(scratch1, FieldMemOperand(scratch1, FixedArray::kHeaderSize)); |
| 936 __ mov(scratch3, Operand(kPointerSize >> 1)); |
| 937 __ mul(scratch3, scratch2, scratch3); |
| 938 __ add(scratch3, scratch3, Operand(Context::kHeaderSize - kHeapObjectTag)); |
| 939 return MemOperand(scratch1, scratch3); |
| 940 } |
| 941 |
| 942 |
| 943 static MemOperand GenerateUnmappedArgumentsLookup(MacroAssembler* masm, |
| 944 Register key, |
| 945 Register parameter_map, |
| 946 Register scratch, |
| 947 Label* slow_case) { |
| 948 // Element is in arguments backing store, which is referenced by the |
| 949 // second element of the parameter_map. The parameter_map register |
| 950 // must be loaded with the parameter map of the arguments object and is |
| 951 // overwritten. |
| 952 const int kBackingStoreOffset = FixedArray::kHeaderSize + kPointerSize; |
| 953 Register backing_store = parameter_map; |
| 954 __ ldr(backing_store, FieldMemOperand(parameter_map, kBackingStoreOffset)); |
| 955 __ ldr(scratch, FieldMemOperand(backing_store, FixedArray::kLengthOffset)); |
| 956 __ cmp(key, Operand(scratch)); |
| 957 __ b(cs, slow_case); |
| 958 __ mov(scratch, Operand(kPointerSize >> 1)); |
| 959 __ mul(scratch, key, scratch); |
| 960 __ add(scratch, |
| 961 scratch, |
| 962 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 963 return MemOperand(backing_store, scratch); |
| 964 } |
| 965 |
| 966 |
| 967 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
| 968 // ---------- S t a t e -------------- |
| 969 // -- lr : return address |
| 970 // -- r0 : key |
| 971 // -- r1 : receiver |
| 972 // ----------------------------------- |
| 973 Label slow, notin; |
| 974 MemOperand mapped_location = |
| 975 GenerateMappedArgumentsLookup(masm, r1, r0, r2, r3, r4, ¬in, &slow); |
| 976 __ ldr(r0, mapped_location); |
| 977 __ Ret(); |
| 978 __ bind(¬in); |
| 979 // The unmapped lookup expects that the parameter map is in r2. |
| 980 MemOperand unmapped_location = |
| 981 GenerateUnmappedArgumentsLookup(masm, r0, r2, r3, &slow); |
| 982 __ ldr(r2, unmapped_location); |
| 983 __ LoadRoot(r3, Heap::kTheHoleValueRootIndex); |
| 984 __ cmp(r2, r3); |
| 985 __ b(eq, &slow); |
| 986 __ mov(r0, r2); |
| 987 __ Ret(); |
| 988 __ bind(&slow); |
| 989 GenerateMiss(masm, false); |
| 990 } |
| 991 |
| 992 |
| 993 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
| 994 // ---------- S t a t e -------------- |
| 995 // -- r0 : value |
| 996 // -- r1 : key |
| 997 // -- r2 : receiver |
| 998 // -- lr : return address |
| 999 // ----------------------------------- |
| 1000 Label slow, notin; |
| 1001 MemOperand mapped_location = |
| 1002 GenerateMappedArgumentsLookup(masm, r2, r1, r3, r4, r5, ¬in, &slow); |
| 1003 __ str(r0, mapped_location); |
| 1004 __ Ret(); |
| 1005 __ bind(¬in); |
| 1006 // The unmapped lookup expects that the parameter map is in r3. |
| 1007 MemOperand unmapped_location = |
| 1008 GenerateUnmappedArgumentsLookup(masm, r1, r3, r4, &slow); |
| 1009 __ str(r0, unmapped_location); |
| 1010 __ Ret(); |
| 1011 __ bind(&slow); |
| 1012 GenerateMiss(masm, false); |
| 1013 } |
| 1014 |
| 1015 |
| 1016 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, |
| 1017 int argc) { |
| 1018 // ----------- S t a t e ------------- |
| 1019 // -- r2 : name |
| 1020 // -- lr : return address |
| 1021 // ----------------------------------- |
| 1022 Label slow, notin; |
| 1023 // Load receiver. |
| 1024 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
| 1025 MemOperand mapped_location = |
| 1026 GenerateMappedArgumentsLookup(masm, r1, r2, r3, r4, r5, ¬in, &slow); |
| 1027 __ ldr(r1, mapped_location); |
| 1028 GenerateFunctionTailCall(masm, argc, &slow, r3); |
| 1029 __ bind(¬in); |
| 1030 // The unmapped lookup expects that the parameter map is in r3. |
| 1031 MemOperand unmapped_location = |
| 1032 GenerateUnmappedArgumentsLookup(masm, r2, r3, r4, &slow); |
| 1033 __ ldr(r1, unmapped_location); |
| 1034 __ LoadRoot(r3, Heap::kTheHoleValueRootIndex); |
| 1035 __ cmp(r1, r3); |
| 1036 __ b(eq, &slow); |
| 1037 GenerateFunctionTailCall(masm, argc, &slow, r3); |
| 1038 __ bind(&slow); |
| 1039 GenerateMiss(masm, argc); |
| 1040 } |
| 1041 |
| 1042 |
| 1043 Object* KeyedLoadIC_Miss(Arguments args); |
| 1044 |
| 1045 |
890 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) { | 1046 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) { |
891 // ---------- S t a t e -------------- | 1047 // ---------- S t a t e -------------- |
892 // -- lr : return address | 1048 // -- lr : return address |
893 // -- r0 : key | 1049 // -- r0 : key |
894 // -- r1 : receiver | 1050 // -- r1 : receiver |
895 // ----------------------------------- | 1051 // ----------------------------------- |
896 Isolate* isolate = masm->isolate(); | 1052 Isolate* isolate = masm->isolate(); |
897 | 1053 |
898 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r3, r4); | 1054 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r3, r4); |
899 | 1055 |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 Register reg = Assembler::GetRn(instr_at_patch); | 1711 Register reg = Assembler::GetRn(instr_at_patch); |
1556 patcher.masm()->tst(reg, Operand(kSmiTagMask)); | 1712 patcher.masm()->tst(reg, Operand(kSmiTagMask)); |
1557 patcher.EmitCondition(eq); | 1713 patcher.EmitCondition(eq); |
1558 } | 1714 } |
1559 } | 1715 } |
1560 | 1716 |
1561 | 1717 |
1562 } } // namespace v8::internal | 1718 } } // namespace v8::internal |
1563 | 1719 |
1564 #endif // V8_TARGET_ARCH_ARM | 1720 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |