| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 break; | 423 break; |
| 424 } | 424 } |
| 425 | 425 |
| 426 // For integer array types: | 426 // For integer array types: |
| 427 // eax: value | 427 // eax: value |
| 428 // For floating-point array type: | 428 // For floating-point array type: |
| 429 // FP(0): value | 429 // FP(0): value |
| 430 | 430 |
| 431 if (array_type == kExternalIntArray || | 431 if (array_type == kExternalIntArray || |
| 432 array_type == kExternalUnsignedIntArray) { | 432 array_type == kExternalUnsignedIntArray) { |
| 433 | |
| 434 // For the Int and UnsignedInt array types, we need to see whether | 433 // For the Int and UnsignedInt array types, we need to see whether |
| 435 // the value can be represented in a Smi. If not, we need to convert | 434 // the value can be represented in a Smi. If not, we need to convert |
| 436 // it to a HeapNumber. | 435 // it to a HeapNumber. |
| 437 Label box_int; | 436 Label box_int; |
| 438 if (array_type == kExternalIntArray) { | 437 if (array_type == kExternalIntArray) { |
| 439 // See Smi::IsValid for why this works. | 438 // See Smi::IsValid for why this works. |
| 440 __ mov(ebx, eax); | 439 __ mov(ebx, eax); |
| 441 __ add(Operand(ebx), Immediate(0x40000000)); | 440 __ add(Operand(ebx), Immediate(0x40000000)); |
| 442 __ cmp(ebx, 0x80000000); | 441 __ cmp(ebx, 0x80000000); |
| 443 __ j(above_equal, &box_int); | 442 __ j(above_equal, &box_int); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 __ mov(eax, edx); // Return the original value. | 747 __ mov(eax, edx); // Return the original value. |
| 749 __ ret(0); | 748 __ ret(0); |
| 750 } else { | 749 } else { |
| 751 // Need to perform float-to-int conversion. | 750 // Need to perform float-to-int conversion. |
| 752 // Test the top of the FP stack for NaN. | 751 // Test the top of the FP stack for NaN. |
| 753 Label is_nan; | 752 Label is_nan; |
| 754 __ fucomi(0); | 753 __ fucomi(0); |
| 755 __ j(parity_even, &is_nan); | 754 __ j(parity_even, &is_nan); |
| 756 | 755 |
| 757 if (array_type != kExternalUnsignedIntArray) { | 756 if (array_type != kExternalUnsignedIntArray) { |
| 758 __ push(eax); // Make room on stack | 757 __ push(eax); // Make room on stack |
| 759 __ fistp_s(Operand(esp, 0)); | 758 __ fistp_s(Operand(esp, 0)); |
| 760 __ pop(eax); | 759 __ pop(eax); |
| 761 } else { | 760 } else { |
| 762 // fistp stores values as signed integers. | 761 // fistp stores values as signed integers. |
| 763 // To represent the entire range, we need to store as a 64-bit | 762 // To represent the entire range, we need to store as a 64-bit |
| 764 // int and discard the high 32 bits. | 763 // int and discard the high 32 bits. |
| 765 __ push(eax); // Make room on stack | 764 __ push(eax); // Make room on stack |
| 766 __ push(eax); // Make room on stack | 765 __ push(eax); // Make room on stack |
| 767 __ fistp_d(Operand(esp, 0)); | 766 __ fistp_d(Operand(esp, 0)); |
| 768 __ pop(eax); | 767 __ pop(eax); |
| 769 __ mov(Operand(esp, 0), eax); | 768 __ mov(Operand(esp, 0), eax); |
| 770 __ pop(eax); | 769 __ pop(eax); |
| 771 } | 770 } |
| 772 // eax: untagged integer value | 771 // eax: untagged integer value |
| 773 switch (array_type) { | 772 switch (array_type) { |
| 774 case kExternalByteArray: | 773 case kExternalByteArray: |
| 775 case kExternalUnsignedByteArray: | 774 case kExternalUnsignedByteArray: |
| 776 __ mov_b(Operand(ecx, ebx, times_1, 0), eax); | 775 __ mov_b(Operand(ecx, ebx, times_1, 0), eax); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 | 1377 |
| 1379 // Do tail-call to runtime routine. | 1378 // Do tail-call to runtime routine. |
| 1380 __ TailCallRuntime( | 1379 __ TailCallRuntime( |
| 1381 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1380 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
| 1382 } | 1381 } |
| 1383 | 1382 |
| 1384 #undef __ | 1383 #undef __ |
| 1385 | 1384 |
| 1386 | 1385 |
| 1387 } } // namespace v8::internal | 1386 } } // namespace v8::internal |
| OLD | NEW |