| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), | 414 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), |
| 415 Immediate(Factory::pixel_array_map())); | 415 Immediate(Factory::pixel_array_map())); |
| 416 __ j(not_equal, &slow); | 416 __ j(not_equal, &slow); |
| 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 __ sar(eax, kSmiTagSize); // Untag the value. | 425 __ sar(eax, kSmiTagSize); // Untag the value. |
| 425 { // Clamp the value to [0..255]. | 426 { // Clamp the value to [0..255]. |
| 426 Label done, check_255; | 427 Label done, check_255; |
| 427 __ cmp(eax, 0); | 428 __ cmp(eax, 0); |
| 428 __ j(greater_equal, &check_255); | 429 __ j(greater_equal, &check_255); |
| 429 __ mov(eax, Immediate(0)); | 430 __ mov(eax, Immediate(0)); |
| 430 __ jmp(&done); | 431 __ jmp(&done); |
| 431 __ bind(&check_255); | 432 __ bind(&check_255); |
| 432 __ cmp(eax, 255); | 433 __ cmp(eax, 255); |
| 433 __ j(less_equal, &done); | 434 __ j(less_equal, &done); |
| 434 __ mov(eax, Immediate(255)); | 435 __ mov(eax, Immediate(255)); |
| 435 __ bind(&done); | 436 __ bind(&done); |
| 436 } | 437 } |
| 437 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); | 438 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); |
| 438 __ mov_b(Operand(ecx, ebx, times_1, 0), eax); | 439 __ mov_b(Operand(ecx, ebx, times_1, 0), eax); |
| 440 __ mov(eax, edx); // Return the original value. |
| 439 __ ret(0); | 441 __ ret(0); |
| 440 | 442 |
| 441 // Extra capacity case: Check if there is extra capacity to | 443 // Extra capacity case: Check if there is extra capacity to |
| 442 // perform the store and update the length. Used for adding one | 444 // perform the store and update the length. Used for adding one |
| 443 // element to the array by writing to array[array.length]. | 445 // element to the array by writing to array[array.length]. |
| 444 __ bind(&extra); | 446 __ bind(&extra); |
| 445 // eax: value | 447 // eax: value |
| 446 // edx: JSArray | 448 // edx: JSArray |
| 447 // ecx: FixedArray | 449 // ecx: FixedArray |
| 448 // ebx: index (as a smi) | 450 // ebx: index (as a smi) |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 | 1034 |
| 1033 // Do tail-call to runtime routine. | 1035 // Do tail-call to runtime routine. |
| 1034 __ TailCallRuntime( | 1036 __ TailCallRuntime( |
| 1035 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1037 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
| 1036 } | 1038 } |
| 1037 | 1039 |
| 1038 #undef __ | 1040 #undef __ |
| 1039 | 1041 |
| 1040 | 1042 |
| 1041 } } // namespace v8::internal | 1043 } } // namespace v8::internal |
| OLD | NEW |