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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 __ push(edx); | 1442 __ push(edx); |
1443 __ push(ecx); | 1443 __ push(ecx); |
1444 __ push(eax); | 1444 __ push(eax); |
1445 __ push(ebx); | 1445 __ push(ebx); |
1446 | 1446 |
1447 // Perform tail call to the entry. | 1447 // Perform tail call to the entry. |
1448 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); | 1448 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); |
1449 } | 1449 } |
1450 | 1450 |
1451 | 1451 |
| 1452 void StoreIC::GenerateArrayLength(MacroAssembler* masm) { |
| 1453 // ----------- S t a t e ------------- |
| 1454 // -- eax : value |
| 1455 // -- ecx : name |
| 1456 // -- edx : receiver |
| 1457 // -- esp[0] : return address |
| 1458 // ----------------------------------- |
| 1459 // |
| 1460 // This accepts as a receiver anything JSObject::SetElementsLength accepts |
| 1461 // (currently anything except for external and pixel arrays which means |
| 1462 // anything with elements of FixedArray type.), but currently is restricted |
| 1463 // to JSArray. |
| 1464 // Value must be a number, but only smis are accepted as the most common case. |
| 1465 |
| 1466 Label miss; |
| 1467 |
| 1468 Register receiver = edx; |
| 1469 Register value = eax; |
| 1470 Register scratch = ebx; |
| 1471 |
| 1472 // Check that the receiver isn't a smi. |
| 1473 __ test(receiver, Immediate(kSmiTagMask)); |
| 1474 __ j(zero, &miss, not_taken); |
| 1475 |
| 1476 // Check that the object is a JS array. |
| 1477 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch); |
| 1478 __ j(not_equal, &miss, not_taken); |
| 1479 |
| 1480 // Check that elements are FixedArray. |
| 1481 __ mov(scratch, FieldOperand(receiver, JSArray::kElementsOffset)); |
| 1482 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch); |
| 1483 __ j(not_equal, &miss, not_taken); |
| 1484 |
| 1485 // Check that value is a smi. |
| 1486 __ test(value, Immediate(kSmiTagMask)); |
| 1487 __ j(not_zero, &miss, not_taken); |
| 1488 |
| 1489 // Prepare tail call to StoreIC_ArrayLength. |
| 1490 __ pop(scratch); |
| 1491 __ push(receiver); |
| 1492 __ push(value); |
| 1493 __ push(scratch); // return address |
| 1494 |
| 1495 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_ArrayLength)), 2, 1); |
| 1496 |
| 1497 __ bind(&miss); |
| 1498 |
| 1499 GenerateMiss(masm); |
| 1500 } |
| 1501 |
| 1502 |
1452 // Defined in ic.cc. | 1503 // Defined in ic.cc. |
1453 Object* KeyedStoreIC_Miss(Arguments args); | 1504 Object* KeyedStoreIC_Miss(Arguments args); |
1454 | 1505 |
1455 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { | 1506 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { |
1456 // ----------- S t a t e ------------- | 1507 // ----------- S t a t e ------------- |
1457 // -- eax : value | 1508 // -- eax : value |
1458 // -- esp[0] : return address | 1509 // -- esp[0] : return address |
1459 // -- esp[4] : key | 1510 // -- esp[4] : key |
1460 // -- esp[8] : receiver | 1511 // -- esp[8] : receiver |
1461 // ----------------------------------- | 1512 // ----------------------------------- |
(...skipping 24 matching lines...) Expand all Loading... |
1486 __ push(ecx); | 1537 __ push(ecx); |
1487 | 1538 |
1488 // Do tail-call to runtime routine. | 1539 // Do tail-call to runtime routine. |
1489 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1); | 1540 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1); |
1490 } | 1541 } |
1491 | 1542 |
1492 #undef __ | 1543 #undef __ |
1493 | 1544 |
1494 | 1545 |
1495 } } // namespace v8::internal | 1546 } } // namespace v8::internal |
OLD | NEW |