| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 __ bind(¬in); | 819 __ bind(¬in); |
| 820 // The unmapped lookup expects that the parameter map is in a2. | 820 // The unmapped lookup expects that the parameter map is in a2. |
| 821 MemOperand unmapped_location = | 821 MemOperand unmapped_location = |
| 822 GenerateUnmappedArgumentsLookup(masm, a0, a2, a3, &slow); | 822 GenerateUnmappedArgumentsLookup(masm, a0, a2, a3, &slow); |
| 823 __ lw(a2, unmapped_location); | 823 __ lw(a2, unmapped_location); |
| 824 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); | 824 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); |
| 825 __ Branch(&slow, eq, a2, Operand(a3)); | 825 __ Branch(&slow, eq, a2, Operand(a3)); |
| 826 __ Ret(USE_DELAY_SLOT); | 826 __ Ret(USE_DELAY_SLOT); |
| 827 __ mov(v0, a2); | 827 __ mov(v0, a2); |
| 828 __ bind(&slow); | 828 __ bind(&slow); |
| 829 GenerateMiss(masm, MISS); | 829 GenerateMiss(masm); |
| 830 } | 830 } |
| 831 | 831 |
| 832 | 832 |
| 833 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 833 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
| 834 // ---------- S t a t e -------------- | 834 // ---------- S t a t e -------------- |
| 835 // -- a0 : value | 835 // -- a0 : value |
| 836 // -- a1 : key | 836 // -- a1 : key |
| 837 // -- a2 : receiver | 837 // -- a2 : receiver |
| 838 // -- lr : return address | 838 // -- lr : return address |
| 839 // ----------------------------------- | 839 // ----------------------------------- |
| (...skipping 14 matching lines...) Expand all Loading... |
| 854 MemOperand unmapped_location = | 854 MemOperand unmapped_location = |
| 855 GenerateUnmappedArgumentsLookup(masm, a1, a3, t0, &slow); | 855 GenerateUnmappedArgumentsLookup(masm, a1, a3, t0, &slow); |
| 856 __ sw(a0, unmapped_location); | 856 __ sw(a0, unmapped_location); |
| 857 __ mov(t5, a0); | 857 __ mov(t5, a0); |
| 858 ASSERT_EQ(unmapped_location.offset(), 0); | 858 ASSERT_EQ(unmapped_location.offset(), 0); |
| 859 __ RecordWrite(a3, unmapped_location.rm(), t5, | 859 __ RecordWrite(a3, unmapped_location.rm(), t5, |
| 860 kRAHasNotBeenSaved, kDontSaveFPRegs); | 860 kRAHasNotBeenSaved, kDontSaveFPRegs); |
| 861 __ Ret(USE_DELAY_SLOT); | 861 __ Ret(USE_DELAY_SLOT); |
| 862 __ mov(v0, a0); // (In delay slot) return the value stored in v0. | 862 __ mov(v0, a0); // (In delay slot) return the value stored in v0. |
| 863 __ bind(&slow); | 863 __ bind(&slow); |
| 864 GenerateMiss(masm, MISS); | 864 GenerateMiss(masm); |
| 865 } | 865 } |
| 866 | 866 |
| 867 | 867 |
| 868 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, | 868 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, |
| 869 int argc) { | 869 int argc) { |
| 870 // ----------- S t a t e ------------- | 870 // ----------- S t a t e ------------- |
| 871 // -- a2 : name | 871 // -- a2 : name |
| 872 // -- lr : return address | 872 // -- lr : return address |
| 873 // ----------------------------------- | 873 // ----------------------------------- |
| 874 Label slow, notin; | 874 Label slow, notin; |
| 875 // Load receiver. | 875 // Load receiver. |
| 876 __ lw(a1, MemOperand(sp, argc * kPointerSize)); | 876 __ lw(a1, MemOperand(sp, argc * kPointerSize)); |
| 877 MemOperand mapped_location = | 877 MemOperand mapped_location = |
| 878 GenerateMappedArgumentsLookup(masm, a1, a2, a3, t0, t1, ¬in, &slow); | 878 GenerateMappedArgumentsLookup(masm, a1, a2, a3, t0, t1, ¬in, &slow); |
| 879 __ lw(a1, mapped_location); | 879 __ lw(a1, mapped_location); |
| 880 GenerateFunctionTailCall(masm, argc, &slow, a3); | 880 GenerateFunctionTailCall(masm, argc, &slow, a3); |
| 881 __ bind(¬in); | 881 __ bind(¬in); |
| 882 // The unmapped lookup expects that the parameter map is in a3. | 882 // The unmapped lookup expects that the parameter map is in a3. |
| 883 MemOperand unmapped_location = | 883 MemOperand unmapped_location = |
| 884 GenerateUnmappedArgumentsLookup(masm, a2, a3, t0, &slow); | 884 GenerateUnmappedArgumentsLookup(masm, a2, a3, t0, &slow); |
| 885 __ lw(a1, unmapped_location); | 885 __ lw(a1, unmapped_location); |
| 886 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); | 886 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); |
| 887 __ Branch(&slow, eq, a1, Operand(a3)); | 887 __ Branch(&slow, eq, a1, Operand(a3)); |
| 888 GenerateFunctionTailCall(masm, argc, &slow, a3); | 888 GenerateFunctionTailCall(masm, argc, &slow, a3); |
| 889 __ bind(&slow); | 889 __ bind(&slow); |
| 890 GenerateMiss(masm, argc); | 890 GenerateMiss(masm, argc); |
| 891 } | 891 } |
| 892 | 892 |
| 893 | 893 |
| 894 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 894 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 895 // ---------- S t a t e -------------- | 895 // ---------- S t a t e -------------- |
| 896 // -- ra : return address | 896 // -- ra : return address |
| 897 // -- a0 : key | 897 // -- a0 : key |
| 898 // -- a1 : receiver | 898 // -- a1 : receiver |
| 899 // ----------------------------------- | 899 // ----------------------------------- |
| 900 Isolate* isolate = masm->isolate(); | 900 Isolate* isolate = masm->isolate(); |
| 901 | 901 |
| 902 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); | 902 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); |
| 903 | 903 |
| 904 __ Push(a1, a0); | 904 __ Push(a1, a0); |
| 905 | 905 |
| 906 // Perform tail call to the entry. | 906 // Perform tail call to the entry. |
| 907 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 907 ExternalReference ref = |
| 908 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), isolate) | 908 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); |
| 909 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); | |
| 910 | 909 |
| 911 __ TailCallExternalReference(ref, 2, 1); | 910 __ TailCallExternalReference(ref, 2, 1); |
| 912 } | 911 } |
| 913 | 912 |
| 914 | 913 |
| 915 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 914 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 916 // ---------- S t a t e -------------- | 915 // ---------- S t a t e -------------- |
| 917 // -- ra : return address | 916 // -- ra : return address |
| 918 // -- a0 : key | 917 // -- a0 : key |
| 919 // -- a1 : receiver | 918 // -- a1 : receiver |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 &miss, // When not a number. | 1123 &miss, // When not a number. |
| 1125 &miss, // When index out of range. | 1124 &miss, // When index out of range. |
| 1126 STRING_INDEX_IS_ARRAY_INDEX); | 1125 STRING_INDEX_IS_ARRAY_INDEX); |
| 1127 char_at_generator.GenerateFast(masm); | 1126 char_at_generator.GenerateFast(masm); |
| 1128 __ Ret(); | 1127 __ Ret(); |
| 1129 | 1128 |
| 1130 StubRuntimeCallHelper call_helper; | 1129 StubRuntimeCallHelper call_helper; |
| 1131 char_at_generator.GenerateSlow(masm, call_helper); | 1130 char_at_generator.GenerateSlow(masm, call_helper); |
| 1132 | 1131 |
| 1133 __ bind(&miss); | 1132 __ bind(&miss); |
| 1134 GenerateMiss(masm, MISS); | 1133 GenerateMiss(masm); |
| 1135 } | 1134 } |
| 1136 | 1135 |
| 1137 | 1136 |
| 1138 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | 1137 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 1139 StrictModeFlag strict_mode) { | 1138 StrictModeFlag strict_mode) { |
| 1140 // ---------- S t a t e -------------- | 1139 // ---------- S t a t e -------------- |
| 1141 // -- a0 : value | 1140 // -- a0 : value |
| 1142 // -- a1 : key | 1141 // -- a1 : key |
| 1143 // -- a2 : receiver | 1142 // -- a2 : receiver |
| 1144 // -- ra : return address | 1143 // -- ra : return address |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 Register elements_map = t2; | 1346 Register elements_map = t2; |
| 1348 Register elements = t3; // Elements array of the receiver. | 1347 Register elements = t3; // Elements array of the receiver. |
| 1349 // t0 and t1 are used as general scratch registers. | 1348 // t0 and t1 are used as general scratch registers. |
| 1350 | 1349 |
| 1351 // Check that the key is a smi. | 1350 // Check that the key is a smi. |
| 1352 __ JumpIfNotSmi(key, &slow); | 1351 __ JumpIfNotSmi(key, &slow); |
| 1353 // Check that the object isn't a smi. | 1352 // Check that the object isn't a smi. |
| 1354 __ JumpIfSmi(receiver, &slow); | 1353 __ JumpIfSmi(receiver, &slow); |
| 1355 // Get the map of the object. | 1354 // Get the map of the object. |
| 1356 __ lw(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 1355 __ lw(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 1357 // Check that the receiver does not require access checks. We need | 1356 // Check that the receiver does not require access checks and is not observed. |
| 1358 // to do this because this generic stub does not perform map checks. | 1357 // The generic stub does not perform map checks or handle observed objects. |
| 1359 __ lbu(t0, FieldMemOperand(receiver_map, Map::kBitFieldOffset)); | 1358 __ lbu(t0, FieldMemOperand(receiver_map, Map::kBitFieldOffset)); |
| 1360 __ And(t0, t0, Operand(1 << Map::kIsAccessCheckNeeded)); | 1359 __ And(t0, t0, Operand(1 << Map::kIsAccessCheckNeeded | |
| 1360 1 << Map::kIsObserved)); |
| 1361 __ Branch(&slow, ne, t0, Operand(zero_reg)); | 1361 __ Branch(&slow, ne, t0, Operand(zero_reg)); |
| 1362 // Check if the object is a JS array or not. | 1362 // Check if the object is a JS array or not. |
| 1363 __ lbu(t0, FieldMemOperand(receiver_map, Map::kInstanceTypeOffset)); | 1363 __ lbu(t0, FieldMemOperand(receiver_map, Map::kInstanceTypeOffset)); |
| 1364 __ Branch(&array, eq, t0, Operand(JS_ARRAY_TYPE)); | 1364 __ Branch(&array, eq, t0, Operand(JS_ARRAY_TYPE)); |
| 1365 // Check that the object is some kind of JSObject. | 1365 // Check that the object is some kind of JSObject. |
| 1366 __ Branch(&slow, lt, t0, Operand(FIRST_JS_OBJECT_TYPE)); | 1366 __ Branch(&slow, lt, t0, Operand(FIRST_JS_OBJECT_TYPE)); |
| 1367 | 1367 |
| 1368 // Object case: Check key against length in the elements array. | 1368 // Object case: Check key against length in the elements array. |
| 1369 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1369 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1370 // Check array bounds. Both the key and the length of FixedArray are smis. | 1370 // Check array bounds. Both the key and the length of FixedArray are smis. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 __ And(a3, a3, Operand(kSlowCaseBitFieldMask)); | 1445 __ And(a3, a3, Operand(kSlowCaseBitFieldMask)); |
| 1446 __ Branch(&slow, ne, a3, Operand(1 << Map::kHasIndexedInterceptor)); | 1446 __ Branch(&slow, ne, a3, Operand(1 << Map::kHasIndexedInterceptor)); |
| 1447 // Everything is fine, call runtime. | 1447 // Everything is fine, call runtime. |
| 1448 __ Push(a1, a0); // Receiver, key. | 1448 __ Push(a1, a0); // Receiver, key. |
| 1449 | 1449 |
| 1450 // Perform tail call to the entry. | 1450 // Perform tail call to the entry. |
| 1451 __ TailCallExternalReference(ExternalReference( | 1451 __ TailCallExternalReference(ExternalReference( |
| 1452 IC_Utility(kKeyedLoadPropertyWithInterceptor), masm->isolate()), 2, 1); | 1452 IC_Utility(kKeyedLoadPropertyWithInterceptor), masm->isolate()), 2, 1); |
| 1453 | 1453 |
| 1454 __ bind(&slow); | 1454 __ bind(&slow); |
| 1455 GenerateMiss(masm, MISS); | 1455 GenerateMiss(masm); |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 | 1458 |
| 1459 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 1459 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
| 1460 // ---------- S t a t e -------------- | 1460 // ---------- S t a t e -------------- |
| 1461 // -- a0 : value | 1461 // -- a0 : value |
| 1462 // -- a1 : key | 1462 // -- a1 : key |
| 1463 // -- a2 : receiver | 1463 // -- a2 : receiver |
| 1464 // -- ra : return address | 1464 // -- ra : return address |
| 1465 // ----------------------------------- | 1465 // ----------------------------------- |
| 1466 | 1466 |
| 1467 // Push receiver, key and value for runtime call. | 1467 // Push receiver, key and value for runtime call. |
| 1468 __ Push(a2, a1, a0); | 1468 __ Push(a2, a1, a0); |
| 1469 | 1469 |
| 1470 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 1470 ExternalReference ref = |
| 1471 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), | 1471 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
| 1472 masm->isolate()) | |
| 1473 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | |
| 1474 __ TailCallExternalReference(ref, 3, 1); | 1472 __ TailCallExternalReference(ref, 3, 1); |
| 1475 } | 1473 } |
| 1476 | 1474 |
| 1477 | 1475 |
| 1478 void StoreIC::GenerateSlow(MacroAssembler* masm) { | 1476 void StoreIC::GenerateSlow(MacroAssembler* masm) { |
| 1479 // ---------- S t a t e -------------- | 1477 // ---------- S t a t e -------------- |
| 1480 // -- a0 : value | 1478 // -- a0 : value |
| 1481 // -- a2 : key | 1479 // -- a2 : key |
| 1482 // -- a1 : receiver | 1480 // -- a1 : receiver |
| 1483 // -- ra : return address | 1481 // -- ra : return address |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 } else { | 1687 } else { |
| 1690 ASSERT(Assembler::IsBne(branch_instr)); | 1688 ASSERT(Assembler::IsBne(branch_instr)); |
| 1691 patcher.ChangeBranchCondition(eq); | 1689 patcher.ChangeBranchCondition(eq); |
| 1692 } | 1690 } |
| 1693 } | 1691 } |
| 1694 | 1692 |
| 1695 | 1693 |
| 1696 } } // namespace v8::internal | 1694 } } // namespace v8::internal |
| 1697 | 1695 |
| 1698 #endif // V8_TARGET_ARCH_MIPS | 1696 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |