| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 BinaryOpIC::GetName(operands_type_)); | 992 BinaryOpIC::GetName(operands_type_)); |
| 993 } | 993 } |
| 994 | 994 |
| 995 | 995 |
| 996 void BinaryOpStub::GenerateSmiCode( | 996 void BinaryOpStub::GenerateSmiCode( |
| 997 MacroAssembler* masm, | 997 MacroAssembler* masm, |
| 998 Label* slow, | 998 Label* slow, |
| 999 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) { | 999 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) { |
| 1000 | 1000 |
| 1001 // Arguments to BinaryOpStub are in rdx and rax. | 1001 // Arguments to BinaryOpStub are in rdx and rax. |
| 1002 Register left = rdx; | 1002 const Register left = rdx; |
| 1003 Register right = rax; | 1003 const Register right = rax; |
| 1004 | 1004 |
| 1005 // We only generate heapnumber answers for overflowing calculations | 1005 // We only generate heapnumber answers for overflowing calculations |
| 1006 // for the four basic arithmetic operations and logical right shift by 0. | 1006 // for the four basic arithmetic operations and logical right shift by 0. |
| 1007 bool generate_inline_heapnumber_results = | 1007 bool generate_inline_heapnumber_results = |
| 1008 (allow_heapnumber_results == ALLOW_HEAPNUMBER_RESULTS) && | 1008 (allow_heapnumber_results == ALLOW_HEAPNUMBER_RESULTS) && |
| 1009 (op_ == Token::ADD || op_ == Token::SUB || | 1009 (op_ == Token::ADD || op_ == Token::SUB || |
| 1010 op_ == Token::MUL || op_ == Token::DIV || op_ == Token::SHR); | 1010 op_ == Token::MUL || op_ == Token::DIV || op_ == Token::SHR); |
| 1011 | 1011 |
| 1012 // Smi check of both operands. If op is BIT_OR, the check is delayed | 1012 // Smi check of both operands. If op is BIT_OR, the check is delayed |
| 1013 // until after the OR operation. | 1013 // until after the OR operation. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1035 __ movq(rax, left); | 1035 __ movq(rax, left); |
| 1036 break; | 1036 break; |
| 1037 | 1037 |
| 1038 case Token::MUL: | 1038 case Token::MUL: |
| 1039 ASSERT(right.is(rax)); | 1039 ASSERT(right.is(rax)); |
| 1040 __ SmiMul(right, right, left, &use_fp_on_smis); // MUL is commutative. | 1040 __ SmiMul(right, right, left, &use_fp_on_smis); // MUL is commutative. |
| 1041 break; | 1041 break; |
| 1042 | 1042 |
| 1043 case Token::DIV: | 1043 case Token::DIV: |
| 1044 // SmiDiv will not accept left in rdx or right in rax. | 1044 // SmiDiv will not accept left in rdx or right in rax. |
| 1045 left = rcx; | |
| 1046 right = rbx; | |
| 1047 __ movq(rbx, rax); | 1045 __ movq(rbx, rax); |
| 1048 __ movq(rcx, rdx); | 1046 __ movq(rcx, rdx); |
| 1049 __ SmiDiv(rax, left, right, &use_fp_on_smis); | 1047 __ SmiDiv(rax, rcx, rbx, &use_fp_on_smis); |
| 1050 break; | 1048 break; |
| 1051 | 1049 |
| 1052 case Token::MOD: | 1050 case Token::MOD: |
| 1053 // SmiMod will not accept left in rdx or right in rax. | 1051 // SmiMod will not accept left in rdx or right in rax. |
| 1054 left = rcx; | |
| 1055 right = rbx; | |
| 1056 __ movq(rbx, rax); | 1052 __ movq(rbx, rax); |
| 1057 __ movq(rcx, rdx); | 1053 __ movq(rcx, rdx); |
| 1058 __ SmiMod(rax, left, right, &use_fp_on_smis); | 1054 __ SmiMod(rax, rcx, rbx, &use_fp_on_smis); |
| 1059 break; | 1055 break; |
| 1060 | 1056 |
| 1061 case Token::BIT_OR: { | 1057 case Token::BIT_OR: { |
| 1062 ASSERT(right.is(rax)); | 1058 ASSERT(right.is(rax)); |
| 1063 __ SmiOrIfSmis(right, right, left, ¬_smis); // BIT_OR is commutative. | 1059 __ SmiOrIfSmis(right, right, left, ¬_smis); // BIT_OR is commutative. |
| 1064 break; | 1060 break; |
| 1065 } | 1061 } |
| 1066 case Token::BIT_XOR: | 1062 case Token::BIT_XOR: |
| 1067 ASSERT(right.is(rax)); | 1063 ASSERT(right.is(rax)); |
| 1068 __ SmiXor(right, right, left); // BIT_XOR is commutative. | 1064 __ SmiXor(right, right, left); // BIT_XOR is commutative. |
| (...skipping 5266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6335 xmm0, | 6331 xmm0, |
| 6336 &slow_elements); | 6332 &slow_elements); |
| 6337 __ ret(0); | 6333 __ ret(0); |
| 6338 } | 6334 } |
| 6339 | 6335 |
| 6340 #undef __ | 6336 #undef __ |
| 6341 | 6337 |
| 6342 } } // namespace v8::internal | 6338 } } // namespace v8::internal |
| 6343 | 6339 |
| 6344 #endif // V8_TARGET_ARCH_X64 | 6340 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |