OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 __ j(not_equal, &slow); | 481 __ j(not_equal, &slow); |
482 // Check that the value is a smi. If a conversion is needed call into the | 482 // Check that the value is a smi. If a conversion is needed call into the |
483 // runtime to convert and clamp. | 483 // runtime to convert and clamp. |
484 __ JumpIfNotSmi(rax, &slow); | 484 __ JumpIfNotSmi(rax, &slow); |
485 __ SmiToInteger32(rbx, rbx); | 485 __ SmiToInteger32(rbx, rbx); |
486 __ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset)); | 486 __ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset)); |
487 __ j(above_equal, &slow); | 487 __ j(above_equal, &slow); |
488 __ movq(rdx, rax); // Save the value. | 488 __ movq(rdx, rax); // Save the value. |
489 __ SmiToInteger32(rax, rax); | 489 __ SmiToInteger32(rax, rax); |
490 { // Clamp the value to [0..255]. | 490 { // Clamp the value to [0..255]. |
491 Label done, is_negative; | 491 Label done; |
492 __ testl(rax, Immediate(0xFFFFFF00)); | 492 __ testl(rax, Immediate(0xFFFFFF00)); |
493 __ j(zero, &done); | 493 __ j(zero, &done); |
494 __ setcc(negative, rax); // 1 if negative, 0 if positive. | 494 __ setcc(negative, rax); // 1 if negative, 0 if positive. |
495 __ decb(rax); // 0 if negative, 255 if positive. | 495 __ decb(rax); // 0 if negative, 255 if positive. |
496 __ bind(&done); | 496 __ bind(&done); |
497 } | 497 } |
498 __ movq(rcx, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); | 498 __ movq(rcx, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); |
499 __ movb(Operand(rcx, rbx, times_1, 0), rax); | 499 __ movb(Operand(rcx, rbx, times_1, 0), rax); |
500 __ movq(rax, rdx); // Return the original value. | 500 __ movq(rax, rdx); // Return the original value. |
501 __ ret(0); | 501 __ ret(0); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 | 1009 |
1010 // Cache miss: Jump to runtime. | 1010 // Cache miss: Jump to runtime. |
1011 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); | 1011 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); |
1012 } | 1012 } |
1013 | 1013 |
1014 | 1014 |
1015 #undef __ | 1015 #undef __ |
1016 | 1016 |
1017 | 1017 |
1018 } } // namespace v8::internal | 1018 } } // namespace v8::internal |
OLD | NEW |