| 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 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3727 // See the comment in objects.h. | 3727 // See the comment in objects.h. |
| 3728 ASSERT(kLongStringTag == 0); | 3728 ASSERT(kLongStringTag == 0); |
| 3729 ASSERT(kMediumStringTag + String::kLongLengthShift == | 3729 ASSERT(kMediumStringTag + String::kLongLengthShift == |
| 3730 String::kMediumLengthShift); | 3730 String::kMediumLengthShift); |
| 3731 ASSERT(kShortStringTag + String::kLongLengthShift == | 3731 ASSERT(kShortStringTag + String::kLongLengthShift == |
| 3732 String::kShortLengthShift); | 3732 String::kShortLengthShift); |
| 3733 __ and_(rcx, Immediate(kStringSizeMask)); | 3733 __ and_(rcx, Immediate(kStringSizeMask)); |
| 3734 __ addq(rcx, Immediate(String::kLongLengthShift)); | 3734 __ addq(rcx, Immediate(String::kLongLengthShift)); |
| 3735 // Fetch the length field into the temporary register. | 3735 // Fetch the length field into the temporary register. |
| 3736 __ movl(temp.reg(), FieldOperand(object.reg(), String::kLengthOffset)); | 3736 __ movl(temp.reg(), FieldOperand(object.reg(), String::kLengthOffset)); |
| 3737 __ shrl(temp.reg()); // The shift amount in ecx is implicit operand. | 3737 __ shrl_cl(temp.reg()); |
| 3738 // Check for index out of range. | 3738 // Check for index out of range. |
| 3739 __ cmpl(index.reg(), temp.reg()); | 3739 __ cmpl(index.reg(), temp.reg()); |
| 3740 __ j(greater_equal, &slow_case); | 3740 __ j(greater_equal, &slow_case); |
| 3741 // Reload the instance type (into the temp register this time).. | 3741 // Reload the instance type (into the temp register this time).. |
| 3742 __ movq(temp.reg(), FieldOperand(object.reg(), HeapObject::kMapOffset)); | 3742 __ movq(temp.reg(), FieldOperand(object.reg(), HeapObject::kMapOffset)); |
| 3743 __ movzxbl(temp.reg(), FieldOperand(temp.reg(), Map::kInstanceTypeOffset)); | 3743 __ movzxbl(temp.reg(), FieldOperand(temp.reg(), Map::kInstanceTypeOffset)); |
| 3744 | 3744 |
| 3745 // We need special handling for non-flat strings. | 3745 // We need special handling for non-flat strings. |
| 3746 ASSERT(kSeqStringTag == 0); | 3746 ASSERT(kSeqStringTag == 0); |
| 3747 __ testb(temp.reg(), Immediate(kStringRepresentationMask)); | 3747 __ testb(temp.reg(), Immediate(kStringRepresentationMask)); |
| (...skipping 3840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7588 __ j(parity_even, &operand_conversion_failure); | 7588 __ j(parity_even, &operand_conversion_failure); |
| 7589 } | 7589 } |
| 7590 | 7590 |
| 7591 // Get int32 operands and perform bitop. | 7591 // Get int32 operands and perform bitop. |
| 7592 __ pop(rcx); | 7592 __ pop(rcx); |
| 7593 __ pop(rax); | 7593 __ pop(rax); |
| 7594 switch (op_) { | 7594 switch (op_) { |
| 7595 case Token::BIT_OR: __ orl(rax, rcx); break; | 7595 case Token::BIT_OR: __ orl(rax, rcx); break; |
| 7596 case Token::BIT_AND: __ andl(rax, rcx); break; | 7596 case Token::BIT_AND: __ andl(rax, rcx); break; |
| 7597 case Token::BIT_XOR: __ xorl(rax, rcx); break; | 7597 case Token::BIT_XOR: __ xorl(rax, rcx); break; |
| 7598 case Token::SAR: __ sarl(rax); break; | 7598 case Token::SAR: __ sarl_cl(rax); break; |
| 7599 case Token::SHL: __ shll(rax); break; | 7599 case Token::SHL: __ shll_cl(rax); break; |
| 7600 case Token::SHR: __ shrl(rax); break; | 7600 case Token::SHR: __ shrl_cl(rax); break; |
| 7601 default: UNREACHABLE(); | 7601 default: UNREACHABLE(); |
| 7602 } | 7602 } |
| 7603 if (op_ == Token::SHR) { | 7603 if (op_ == Token::SHR) { |
| 7604 // Check if result is non-negative. This can only happen for a shift | 7604 // Check if result is non-negative. This can only happen for a shift |
| 7605 // by zero, which also doesn't update the sign flag. | 7605 // by zero, which also doesn't update the sign flag. |
| 7606 __ testl(rax, rax); | 7606 __ testl(rax, rax); |
| 7607 __ j(negative, &non_smi_result); | 7607 __ j(negative, &non_smi_result); |
| 7608 } | 7608 } |
| 7609 __ JumpIfNotValidSmiValue(rax, &non_smi_result); | 7609 __ JumpIfNotValidSmiValue(rax, &non_smi_result); |
| 7610 // Tag smi result, if possible, and return. | 7610 // Tag smi result, if possible, and return. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7835 masm.GetCode(&desc); | 7835 masm.GetCode(&desc); |
| 7836 // Call the function from C++. | 7836 // Call the function from C++. |
| 7837 return FUNCTION_CAST<ModuloFunction>(buffer); | 7837 return FUNCTION_CAST<ModuloFunction>(buffer); |
| 7838 } | 7838 } |
| 7839 | 7839 |
| 7840 #endif | 7840 #endif |
| 7841 | 7841 |
| 7842 #undef __ | 7842 #undef __ |
| 7843 | 7843 |
| 7844 } } // namespace v8::internal | 7844 } } // namespace v8::internal |
| OLD | NEW |