| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // Check that the value is a smi. If a conversion is needed call into the | 417 // Check that the value is a smi. If a conversion is needed call into the |
| 418 // runtime to convert and clamp. | 418 // runtime to convert and clamp. |
| 419 __ test(eax, Immediate(kSmiTagMask)); | 419 __ test(eax, Immediate(kSmiTagMask)); |
| 420 __ j(not_zero, &slow); | 420 __ j(not_zero, &slow); |
| 421 __ sar(ebx, kSmiTagSize); // Untag the index. | 421 __ sar(ebx, kSmiTagSize); // Untag the index. |
| 422 __ cmp(ebx, FieldOperand(ecx, PixelArray::kLengthOffset)); | 422 __ cmp(ebx, FieldOperand(ecx, PixelArray::kLengthOffset)); |
| 423 __ j(above_equal, &slow); | 423 __ j(above_equal, &slow); |
| 424 __ mov(edx, eax); // Save the value. | 424 __ mov(edx, eax); // Save the value. |
| 425 __ sar(eax, kSmiTagSize); // Untag the value. | 425 __ sar(eax, kSmiTagSize); // Untag the value. |
| 426 { // Clamp the value to [0..255]. | 426 { // Clamp the value to [0..255]. |
| 427 Label done, check_255; | 427 Label done, is_negative; |
| 428 __ cmp(eax, 0); | 428 __ test(eax, Immediate(0xFFFFFF00)); |
| 429 __ j(greater_equal, &check_255); | 429 __ j(zero, &done); |
| 430 __ mov(eax, Immediate(0)); | 430 __ j(negative, &is_negative); |
| 431 __ mov(eax, Immediate(255)); |
| 431 __ jmp(&done); | 432 __ jmp(&done); |
| 432 __ bind(&check_255); | 433 __ bind(&is_negative); |
| 433 __ cmp(eax, 255); | 434 __ xor_(eax, Operand(eax)); // Clear eax. |
| 434 __ j(less_equal, &done); | |
| 435 __ mov(eax, Immediate(255)); | |
| 436 __ bind(&done); | 435 __ bind(&done); |
| 437 } | 436 } |
| 438 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); | 437 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); |
| 439 __ mov_b(Operand(ecx, ebx, times_1, 0), eax); | 438 __ mov_b(Operand(ecx, ebx, times_1, 0), eax); |
| 440 __ mov(eax, edx); // Return the original value. | 439 __ mov(eax, edx); // Return the original value. |
| 441 __ ret(0); | 440 __ ret(0); |
| 442 | 441 |
| 443 // Extra capacity case: Check if there is extra capacity to | 442 // Extra capacity case: Check if there is extra capacity to |
| 444 // perform the store and update the length. Used for adding one | 443 // perform the store and update the length. Used for adding one |
| 445 // element to the array by writing to array[array.length]. | 444 // element to the array by writing to array[array.length]. |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 | 1033 |
| 1035 // Do tail-call to runtime routine. | 1034 // Do tail-call to runtime routine. |
| 1036 __ TailCallRuntime( | 1035 __ TailCallRuntime( |
| 1037 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1036 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
| 1038 } | 1037 } |
| 1039 | 1038 |
| 1040 #undef __ | 1039 #undef __ |
| 1041 | 1040 |
| 1042 | 1041 |
| 1043 } } // namespace v8::internal | 1042 } } // namespace v8::internal |
| OLD | NEW |