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