| 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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 __ push(edx); | 1404 __ push(edx); |
| 1405 __ push(ecx); | 1405 __ push(ecx); |
| 1406 __ push(eax); | 1406 __ push(eax); |
| 1407 __ push(ebx); | 1407 __ push(ebx); |
| 1408 | 1408 |
| 1409 // Perform tail call to the entry. | 1409 // Perform tail call to the entry. |
| 1410 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); | 1410 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 | 1413 |
| 1414 void StoreIC::GenerateArrayLength(MacroAssembler* masm) { | |
| 1415 // ----------- S t a t e ------------- | |
| 1416 // -- eax : value | |
| 1417 // -- ecx : name | |
| 1418 // -- edx : receiver | |
| 1419 // -- esp[0] : return address | |
| 1420 // ----------------------------------- | |
| 1421 // | |
| 1422 // This accepts as a receiver anything JSObject::SetElementsLength accepts | |
| 1423 // (currently anything except for external and pixel arrays which means | |
| 1424 // anything with elements of FixedArray type.), but currently is restricted | |
| 1425 // to JSArray. | |
| 1426 // Value must be a number, but only smis are accepted as the most common case. | |
| 1427 | |
| 1428 Label miss; | |
| 1429 | |
| 1430 Register receiver = edx; | |
| 1431 Register value = eax; | |
| 1432 Register scratch = ebx; | |
| 1433 | |
| 1434 // Check that the receiver isn't a smi. | |
| 1435 __ test(receiver, Immediate(kSmiTagMask)); | |
| 1436 __ j(zero, &miss, not_taken); | |
| 1437 | |
| 1438 // Check that the object is a JS array. | |
| 1439 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch); | |
| 1440 __ j(not_equal, &miss, not_taken); | |
| 1441 | |
| 1442 // Check that elements are FixedArray. | |
| 1443 __ mov(scratch, FieldOperand(receiver, JSArray::kElementsOffset)); | |
| 1444 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch); | |
| 1445 __ j(not_equal, &miss, not_taken); | |
| 1446 | |
| 1447 // Check that value is a smi. | |
| 1448 __ test(value, Immediate(kSmiTagMask)); | |
| 1449 __ j(not_zero, &miss, not_taken); | |
| 1450 | |
| 1451 // Prepare tail call to StoreIC_ArrayLength. | |
| 1452 __ pop(scratch); | |
| 1453 __ push(receiver); | |
| 1454 __ push(value); | |
| 1455 __ push(scratch); // return address | |
| 1456 | |
| 1457 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_ArrayLength)), 2, 1); | |
| 1458 | |
| 1459 __ bind(&miss); | |
| 1460 | |
| 1461 GenerateMiss(masm); | |
| 1462 } | |
| 1463 | |
| 1464 | |
| 1465 // Defined in ic.cc. | 1414 // Defined in ic.cc. |
| 1466 Object* KeyedStoreIC_Miss(Arguments args); | 1415 Object* KeyedStoreIC_Miss(Arguments args); |
| 1467 | 1416 |
| 1468 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { | 1417 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { |
| 1469 // ----------- S t a t e ------------- | 1418 // ----------- S t a t e ------------- |
| 1470 // -- eax : value | 1419 // -- eax : value |
| 1471 // -- esp[0] : return address | 1420 // -- esp[0] : return address |
| 1472 // -- esp[4] : key | 1421 // -- esp[4] : key |
| 1473 // -- esp[8] : receiver | 1422 // -- esp[8] : receiver |
| 1474 // ----------------------------------- | 1423 // ----------------------------------- |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1499 __ push(ecx); | 1448 __ push(ecx); |
| 1500 | 1449 |
| 1501 // Do tail-call to runtime routine. | 1450 // Do tail-call to runtime routine. |
| 1502 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1); | 1451 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1); |
| 1503 } | 1452 } |
| 1504 | 1453 |
| 1505 #undef __ | 1454 #undef __ |
| 1506 | 1455 |
| 1507 | 1456 |
| 1508 } } // namespace v8::internal | 1457 } } // namespace v8::internal |
| OLD | NEW |