| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 | 1168 |
| 1169 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 1169 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
| 1170 // ---------- S t a t e -------------- | 1170 // ---------- S t a t e -------------- |
| 1171 // -- lr : return address | 1171 // -- lr : return address |
| 1172 // -- r0 : key | 1172 // -- r0 : key |
| 1173 // -- r1 : receiver | 1173 // -- r1 : receiver |
| 1174 // ----------------------------------- | 1174 // ----------------------------------- |
| 1175 Label slow, check_string, index_smi, index_string, property_array_property; | 1175 Label slow, check_string, index_smi, index_string, property_array_property; |
| 1176 Label check_pixel_array, probe_dictionary, check_number_dictionary; | 1176 Label probe_dictionary, check_number_dictionary; |
| 1177 | 1177 |
| 1178 Register key = r0; | 1178 Register key = r0; |
| 1179 Register receiver = r1; | 1179 Register receiver = r1; |
| 1180 | 1180 |
| 1181 // Check that the key is a smi. | 1181 // Check that the key is a smi. |
| 1182 __ JumpIfNotSmi(key, &check_string); | 1182 __ JumpIfNotSmi(key, &check_string); |
| 1183 __ bind(&index_smi); | 1183 __ bind(&index_smi); |
| 1184 // Now the key is known to be a smi. This place is also jumped to from below | 1184 // Now the key is known to be a smi. This place is also jumped to from below |
| 1185 // where a numeric string is converted to a smi. | 1185 // where a numeric string is converted to a smi. |
| 1186 | 1186 |
| 1187 GenerateKeyedLoadReceiverCheck( | 1187 GenerateKeyedLoadReceiverCheck( |
| 1188 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow); | 1188 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow); |
| 1189 | 1189 |
| 1190 // Check the "has fast elements" bit in the receiver's map which is | 1190 // Check the "has fast elements" bit in the receiver's map which is |
| 1191 // now in r2. | 1191 // now in r2. |
| 1192 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset)); | 1192 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset)); |
| 1193 __ tst(r3, Operand(1 << Map::kHasFastElements)); | 1193 __ tst(r3, Operand(1 << Map::kHasFastElements)); |
| 1194 __ b(eq, &check_pixel_array); | 1194 __ b(eq, &check_number_dictionary); |
| 1195 | 1195 |
| 1196 GenerateFastArrayLoad( | 1196 GenerateFastArrayLoad( |
| 1197 masm, receiver, key, r4, r3, r2, r0, NULL, &slow); | 1197 masm, receiver, key, r4, r3, r2, r0, NULL, &slow); |
| 1198 __ IncrementCounter(COUNTERS->keyed_load_generic_smi(), 1, r2, r3); | 1198 __ IncrementCounter(COUNTERS->keyed_load_generic_smi(), 1, r2, r3); |
| 1199 __ Ret(); | 1199 __ Ret(); |
| 1200 | 1200 |
| 1201 // Check whether the elements is a pixel array. | 1201 __ bind(&check_number_dictionary); |
| 1202 // r0: key | 1202 __ ldr(r4, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1203 // r1: receiver | 1203 __ ldr(r3, FieldMemOperand(r4, JSObject::kMapOffset)); |
| 1204 __ bind(&check_pixel_array); | |
| 1205 | 1204 |
| 1206 GenerateFastPixelArrayLoad(masm, | |
| 1207 r1, | |
| 1208 r0, | |
| 1209 r3, | |
| 1210 r4, | |
| 1211 r2, | |
| 1212 r5, | |
| 1213 r0, | |
| 1214 &check_number_dictionary, | |
| 1215 NULL, | |
| 1216 &slow); | |
| 1217 | |
| 1218 __ bind(&check_number_dictionary); | |
| 1219 // Check whether the elements is a number dictionary. | 1205 // Check whether the elements is a number dictionary. |
| 1220 // r0: key | 1206 // r0: key |
| 1221 // r3: elements map | 1207 // r3: elements map |
| 1222 // r4: elements | 1208 // r4: elements |
| 1223 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | 1209 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); |
| 1224 __ cmp(r3, ip); | 1210 __ cmp(r3, ip); |
| 1225 __ b(ne, &slow); | 1211 __ b(ne, &slow); |
| 1226 __ mov(r2, Operand(r0, ASR, kSmiTagSize)); | 1212 __ mov(r2, Operand(r0, ASR, kSmiTagSize)); |
| 1227 GenerateNumberDictionaryLoad(masm, &slow, r4, r0, r0, r2, r3, r5); | 1213 GenerateNumberDictionaryLoad(masm, &slow, r4, r0, r0, r2, r3, r5); |
| 1228 __ Ret(); | 1214 __ Ret(); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 | 1410 |
| 1425 | 1411 |
| 1426 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 1412 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 1427 StrictModeFlag strict_mode) { | 1413 StrictModeFlag strict_mode) { |
| 1428 // ---------- S t a t e -------------- | 1414 // ---------- S t a t e -------------- |
| 1429 // -- r0 : value | 1415 // -- r0 : value |
| 1430 // -- r1 : key | 1416 // -- r1 : key |
| 1431 // -- r2 : receiver | 1417 // -- r2 : receiver |
| 1432 // -- lr : return address | 1418 // -- lr : return address |
| 1433 // ----------------------------------- | 1419 // ----------------------------------- |
| 1434 Label slow, fast, array, extra, check_pixel_array; | 1420 Label slow, fast, array, extra; |
| 1435 | 1421 |
| 1436 // Register usage. | 1422 // Register usage. |
| 1437 Register value = r0; | 1423 Register value = r0; |
| 1438 Register key = r1; | 1424 Register key = r1; |
| 1439 Register receiver = r2; | 1425 Register receiver = r2; |
| 1440 Register elements = r3; // Elements array of the receiver. | 1426 Register elements = r3; // Elements array of the receiver. |
| 1441 // r4 and r5 are used as general scratch registers. | 1427 // r4 and r5 are used as general scratch registers. |
| 1442 | 1428 |
| 1443 // Check that the key is a smi. | 1429 // Check that the key is a smi. |
| 1444 __ tst(key, Operand(kSmiTagMask)); | 1430 __ tst(key, Operand(kSmiTagMask)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1460 // Check that the object is some kind of JS object. | 1446 // Check that the object is some kind of JS object. |
| 1461 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); | 1447 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); |
| 1462 __ b(lt, &slow); | 1448 __ b(lt, &slow); |
| 1463 | 1449 |
| 1464 // Object case: Check key against length in the elements array. | 1450 // Object case: Check key against length in the elements array. |
| 1465 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1451 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1466 // Check that the object is in fast mode and writable. | 1452 // Check that the object is in fast mode and writable. |
| 1467 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset)); | 1453 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset)); |
| 1468 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 1454 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
| 1469 __ cmp(r4, ip); | 1455 __ cmp(r4, ip); |
| 1470 __ b(ne, &check_pixel_array); | 1456 __ b(ne, &slow); |
| 1471 // Check array bounds. Both the key and the length of FixedArray are smis. | 1457 // Check array bounds. Both the key and the length of FixedArray are smis. |
| 1472 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1458 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 1473 __ cmp(key, Operand(ip)); | 1459 __ cmp(key, Operand(ip)); |
| 1474 __ b(lo, &fast); | 1460 __ b(lo, &fast); |
| 1475 | 1461 |
| 1476 // Slow case, handle jump to runtime. | 1462 // Slow case, handle jump to runtime. |
| 1477 __ bind(&slow); | 1463 __ bind(&slow); |
| 1478 // Entry registers are intact. | 1464 // Entry registers are intact. |
| 1479 // r0: value. | 1465 // r0: value. |
| 1480 // r1: key. | 1466 // r1: key. |
| 1481 // r2: receiver. | 1467 // r2: receiver. |
| 1482 GenerateRuntimeSetProperty(masm, strict_mode); | 1468 GenerateRuntimeSetProperty(masm, strict_mode); |
| 1483 | 1469 |
| 1484 // Check whether the elements is a pixel array. | |
| 1485 // r4: elements map. | |
| 1486 __ bind(&check_pixel_array); | |
| 1487 GenerateFastPixelArrayStore(masm, | |
| 1488 r2, | |
| 1489 r1, | |
| 1490 r0, | |
| 1491 elements, | |
| 1492 r4, | |
| 1493 r5, | |
| 1494 r6, | |
| 1495 false, | |
| 1496 false, | |
| 1497 NULL, | |
| 1498 &slow, | |
| 1499 &slow, | |
| 1500 &slow); | |
| 1501 | |
| 1502 // Extra capacity case: Check if there is extra capacity to | 1470 // Extra capacity case: Check if there is extra capacity to |
| 1503 // perform the store and update the length. Used for adding one | 1471 // perform the store and update the length. Used for adding one |
| 1504 // element to the array by writing to array[array.length]. | 1472 // element to the array by writing to array[array.length]. |
| 1505 __ bind(&extra); | 1473 __ bind(&extra); |
| 1506 // Condition code from comparing key and array length is still available. | 1474 // Condition code from comparing key and array length is still available. |
| 1507 __ b(ne, &slow); // Only support writing to writing to array[array.length]. | 1475 __ b(ne, &slow); // Only support writing to writing to array[array.length]. |
| 1508 // Check for room in the elements backing store. | 1476 // Check for room in the elements backing store. |
| 1509 // Both the key and the length of FixedArray are smis. | 1477 // Both the key and the length of FixedArray are smis. |
| 1510 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1478 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 1511 __ cmp(key, Operand(ip)); | 1479 __ cmp(key, Operand(ip)); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 Register reg = Assembler::GetRn(instr_at_patch); | 1763 Register reg = Assembler::GetRn(instr_at_patch); |
| 1796 patcher.masm()->tst(reg, Operand(kSmiTagMask)); | 1764 patcher.masm()->tst(reg, Operand(kSmiTagMask)); |
| 1797 patcher.EmitCondition(eq); | 1765 patcher.EmitCondition(eq); |
| 1798 } | 1766 } |
| 1799 } | 1767 } |
| 1800 | 1768 |
| 1801 | 1769 |
| 1802 } } // namespace v8::internal | 1770 } } // namespace v8::internal |
| 1803 | 1771 |
| 1804 #endif // V8_TARGET_ARCH_ARM | 1772 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |