| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3494 __ j(not_equal, &check_heap_number); | 3494 __ j(not_equal, &check_heap_number); |
| 3495 | 3495 |
| 3496 // smi case | 3496 // smi case |
| 3497 __ mov(ecx, eax); // Preserve the value in eax. Key is no longer needed. | 3497 __ mov(ecx, eax); // Preserve the value in eax. Key is no longer needed. |
| 3498 __ SmiUntag(ecx); | 3498 __ SmiUntag(ecx); |
| 3499 __ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset)); | 3499 __ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset)); |
| 3500 // ecx: base pointer of external storage | 3500 // ecx: base pointer of external storage |
| 3501 switch (array_type) { | 3501 switch (array_type) { |
| 3502 case kExternalPixelArray: | 3502 case kExternalPixelArray: |
| 3503 { // Clamp the value to [0..255]. | 3503 { // Clamp the value to [0..255]. |
| 3504 NearLabel done; | 3504 Label done; |
| 3505 __ test(ecx, Immediate(0xFFFFFF00)); | 3505 __ test(ecx, Immediate(0xFFFFFF00)); |
| 3506 __ j(zero, &done); | 3506 __ j(zero, &done, Label::kNear); |
| 3507 __ setcc(negative, ecx); // 1 if negative, 0 if positive. | 3507 __ setcc(negative, ecx); // 1 if negative, 0 if positive. |
| 3508 __ dec_b(ecx); // 0 if negative, 255 if positive. | 3508 __ dec_b(ecx); // 0 if negative, 255 if positive. |
| 3509 __ bind(&done); | 3509 __ bind(&done); |
| 3510 } | 3510 } |
| 3511 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); | 3511 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); |
| 3512 break; | 3512 break; |
| 3513 case kExternalByteArray: | 3513 case kExternalByteArray: |
| 3514 case kExternalUnsignedByteArray: | 3514 case kExternalUnsignedByteArray: |
| 3515 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); | 3515 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); |
| 3516 break; | 3516 break; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3577 if (CpuFeatures::IsSupported(SSE2)) { | 3577 if (CpuFeatures::IsSupported(SSE2)) { |
| 3578 if (array_type != kExternalIntArray && | 3578 if (array_type != kExternalIntArray && |
| 3579 array_type != kExternalUnsignedIntArray) { | 3579 array_type != kExternalUnsignedIntArray) { |
| 3580 ASSERT(CpuFeatures::IsSupported(SSE2)); | 3580 ASSERT(CpuFeatures::IsSupported(SSE2)); |
| 3581 CpuFeatures::Scope scope(SSE2); | 3581 CpuFeatures::Scope scope(SSE2); |
| 3582 __ cvttsd2si(ecx, FieldOperand(eax, HeapNumber::kValueOffset)); | 3582 __ cvttsd2si(ecx, FieldOperand(eax, HeapNumber::kValueOffset)); |
| 3583 // ecx: untagged integer value | 3583 // ecx: untagged integer value |
| 3584 switch (array_type) { | 3584 switch (array_type) { |
| 3585 case kExternalPixelArray: | 3585 case kExternalPixelArray: |
| 3586 { // Clamp the value to [0..255]. | 3586 { // Clamp the value to [0..255]. |
| 3587 NearLabel done; | 3587 Label done; |
| 3588 __ test(ecx, Immediate(0xFFFFFF00)); | 3588 __ test(ecx, Immediate(0xFFFFFF00)); |
| 3589 __ j(zero, &done); | 3589 __ j(zero, &done, Label::kNear); |
| 3590 __ setcc(negative, ecx); // 1 if negative, 0 if positive. | 3590 __ setcc(negative, ecx); // 1 if negative, 0 if positive. |
| 3591 __ dec_b(ecx); // 0 if negative, 255 if positive. | 3591 __ dec_b(ecx); // 0 if negative, 255 if positive. |
| 3592 __ bind(&done); | 3592 __ bind(&done); |
| 3593 } | 3593 } |
| 3594 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); | 3594 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); |
| 3595 break; | 3595 break; |
| 3596 case kExternalByteArray: | 3596 case kExternalByteArray: |
| 3597 case kExternalUnsignedByteArray: | 3597 case kExternalUnsignedByteArray: |
| 3598 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); | 3598 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); |
| 3599 break; | 3599 break; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3665 | 3665 |
| 3666 return GetCode(flags); | 3666 return GetCode(flags); |
| 3667 } | 3667 } |
| 3668 | 3668 |
| 3669 | 3669 |
| 3670 #undef __ | 3670 #undef __ |
| 3671 | 3671 |
| 3672 } } // namespace v8::internal | 3672 } } // namespace v8::internal |
| 3673 | 3673 |
| 3674 #endif // V8_TARGET_ARCH_IA32 | 3674 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |