| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // to a 64-bit int manually. | 452 // to a 64-bit int manually. |
| 453 __ push(Immediate(0)); | 453 __ push(Immediate(0)); |
| 454 __ push(eax); | 454 __ push(eax); |
| 455 __ fild_d(Operand(esp, 0)); | 455 __ fild_d(Operand(esp, 0)); |
| 456 __ pop(eax); | 456 __ pop(eax); |
| 457 __ pop(eax); | 457 __ pop(eax); |
| 458 } | 458 } |
| 459 // FP(0): value | 459 // FP(0): value |
| 460 __ AllocateHeapNumber(eax, ebx, ecx, &failed_allocation); | 460 __ AllocateHeapNumber(eax, ebx, ecx, &failed_allocation); |
| 461 // Set the value. | 461 // Set the value. |
| 462 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); | 462 __ GenerateHeapNumberValueAddress(ebx, eax); |
| 463 __ fstp_d(Operand(ebx, 0)); |
| 463 __ ret(0); | 464 __ ret(0); |
| 464 } else if (array_type == kExternalFloatArray) { | 465 } else if (array_type == kExternalFloatArray) { |
| 465 // For the floating-point array type, we need to always allocate a | 466 // For the floating-point array type, we need to always allocate a |
| 466 // HeapNumber. | 467 // HeapNumber. |
| 467 __ AllocateHeapNumber(eax, ebx, ecx, &failed_allocation); | 468 __ AllocateHeapNumber(eax, ebx, ecx, &failed_allocation); |
| 468 // Set the value. | 469 // Set the value. |
| 469 __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); | 470 __ GenerateHeapNumberValueAddress(ebx, eax); |
| 471 __ fstp_d(Operand(ebx, 0)); |
| 470 __ ret(0); | 472 __ ret(0); |
| 471 } else { | 473 } else { |
| 472 __ shl(eax, kSmiTagSize); | 474 __ shl(eax, kSmiTagSize); |
| 473 __ ret(0); | 475 __ ret(0); |
| 474 } | 476 } |
| 475 | 477 |
| 476 // If we fail allocation of the HeapNumber, we still have a value on | 478 // If we fail allocation of the HeapNumber, we still have a value on |
| 477 // top of the FPU stack. Remove it. | 479 // top of the FPU stack. Remove it. |
| 478 __ bind(&failed_allocation); | 480 __ bind(&failed_allocation); |
| 479 __ ffree(); | 481 __ ffree(); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 __ ret(0); | 716 __ ret(0); |
| 715 | 717 |
| 716 __ bind(&check_heap_number); | 718 __ bind(&check_heap_number); |
| 717 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), | 719 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
| 718 Immediate(Factory::heap_number_map())); | 720 Immediate(Factory::heap_number_map())); |
| 719 __ j(not_equal, &slow); | 721 __ j(not_equal, &slow); |
| 720 | 722 |
| 721 // The WebGL specification leaves the behavior of storing NaN and | 723 // The WebGL specification leaves the behavior of storing NaN and |
| 722 // +/-Infinity into integer arrays basically undefined. For more | 724 // +/-Infinity into integer arrays basically undefined. For more |
| 723 // reproducible behavior, convert these to zero. | 725 // reproducible behavior, convert these to zero. |
| 724 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); | 726 __ GenerateHeapNumberValueAddress(edx, eax); |
| 727 __ fld_d(Operand(edx, 0)); |
| 725 __ mov(edx, eax); // Save the value. | 728 __ mov(edx, eax); // Save the value. |
| 726 __ mov(ecx, FieldOperand(ecx, ExternalArray::kExternalPointerOffset)); | 729 __ mov(ecx, FieldOperand(ecx, ExternalArray::kExternalPointerOffset)); |
| 727 // ebx: untagged index | 730 // ebx: untagged index |
| 728 // ecx: base pointer of external storage | 731 // ecx: base pointer of external storage |
| 729 // top of FPU stack: value | 732 // top of FPU stack: value |
| 730 if (array_type == kExternalFloatArray) { | 733 if (array_type == kExternalFloatArray) { |
| 731 __ fstp_s(Operand(ecx, ebx, times_4, 0)); | 734 __ fstp_s(Operand(ecx, ebx, times_4, 0)); |
| 732 __ mov(eax, edx); // Return the original value. | 735 __ mov(eax, edx); // Return the original value. |
| 733 __ ret(0); | 736 __ ret(0); |
| 734 } else { | 737 } else { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 765 break; | 768 break; |
| 766 case kExternalIntArray: | 769 case kExternalIntArray: |
| 767 case kExternalUnsignedIntArray: { | 770 case kExternalUnsignedIntArray: { |
| 768 // We also need to explicitly check for +/-Infinity. These are | 771 // We also need to explicitly check for +/-Infinity. These are |
| 769 // converted to MIN_INT, but we need to be careful not to | 772 // converted to MIN_INT, but we need to be careful not to |
| 770 // confuse with legal uses of MIN_INT. | 773 // confuse with legal uses of MIN_INT. |
| 771 Label not_infinity; | 774 Label not_infinity; |
| 772 // This test would apparently detect both NaN and Infinity, | 775 // This test would apparently detect both NaN and Infinity, |
| 773 // but we've already checked for NaN using the FPU hardware | 776 // but we've already checked for NaN using the FPU hardware |
| 774 // above. | 777 // above. |
| 775 __ mov_w(edi, FieldOperand(edx, HeapNumber::kValueOffset + 6)); | 778 __ GenerateHeapNumberValueAddress(edi, edx); |
| 779 __ mov_w(edi, Operand(edi, 6)); |
| 776 __ and_(edi, 0x7FF0); | 780 __ and_(edi, 0x7FF0); |
| 777 __ cmp(edi, 0x7FF0); | 781 __ cmp(edi, 0x7FF0); |
| 778 __ j(not_equal, ¬_infinity); | 782 __ j(not_equal, ¬_infinity); |
| 779 __ mov(eax, 0); | 783 __ mov(eax, 0); |
| 780 __ bind(¬_infinity); | 784 __ bind(¬_infinity); |
| 781 __ mov(Operand(ecx, ebx, times_4, 0), eax); | 785 __ mov(Operand(ecx, ebx, times_4, 0), eax); |
| 782 break; | 786 break; |
| 783 } | 787 } |
| 784 default: | 788 default: |
| 785 UNREACHABLE(); | 789 UNREACHABLE(); |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 | 1366 |
| 1363 // Do tail-call to runtime routine. | 1367 // Do tail-call to runtime routine. |
| 1364 __ TailCallRuntime( | 1368 __ TailCallRuntime( |
| 1365 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1369 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
| 1366 } | 1370 } |
| 1367 | 1371 |
| 1368 #undef __ | 1372 #undef __ |
| 1369 | 1373 |
| 1370 | 1374 |
| 1371 } } // namespace v8::internal | 1375 } } // namespace v8::internal |
| OLD | NEW |