OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 7362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7373 Register right_reg = right.reg(); | 7373 Register right_reg = right.reg(); |
7374 left.Unuse(); | 7374 left.Unuse(); |
7375 right.Unuse(); | 7375 right.Unuse(); |
7376 edx_reg.Unuse(); | 7376 edx_reg.Unuse(); |
7377 __ cmp(right_reg, 0); | 7377 __ cmp(right_reg, 0); |
7378 // Ensure divisor is positive: no chance of non-int32 or -0 result. | 7378 // Ensure divisor is positive: no chance of non-int32 or -0 result. |
7379 unsafe_bailout_->Branch(less_equal); | 7379 unsafe_bailout_->Branch(less_equal); |
7380 __ cdq(); // Sign-extend eax into edx:eax | 7380 __ cdq(); // Sign-extend eax into edx:eax |
7381 __ idiv(right_reg); | 7381 __ idiv(right_reg); |
7382 if (op == Token::MOD) { | 7382 if (op == Token::MOD) { |
| 7383 // Negative zero can arise as a negative divident with a zero result. |
| 7384 if (!node->no_negative_zero()) { |
| 7385 Label not_negative_zero; |
| 7386 __ test(edx, Operand(edx)); |
| 7387 __ j(not_zero, ¬_negative_zero); |
| 7388 __ test(eax, Operand(eax)); |
| 7389 unsafe_bailout_->Branch(negative); |
| 7390 __ bind(¬_negative_zero); |
| 7391 } |
7383 Result edx_result(edx, NumberInfo::Integer32()); | 7392 Result edx_result(edx, NumberInfo::Integer32()); |
7384 edx_result.set_untagged_int32(true); | 7393 edx_result.set_untagged_int32(true); |
7385 frame_->Push(&edx_result); | 7394 frame_->Push(&edx_result); |
7386 } else { | 7395 } else { |
7387 ASSERT(op == Token::DIV); | 7396 ASSERT(op == Token::DIV); |
7388 __ test(edx, Operand(edx)); | 7397 __ test(edx, Operand(edx)); |
7389 unsafe_bailout_->Branch(not_equal); | 7398 unsafe_bailout_->Branch(not_equal); |
7390 Result eax_result(eax, NumberInfo::Integer32()); | 7399 Result eax_result(eax, NumberInfo::Integer32()); |
7391 eax_result.set_untagged_int32(true); | 7400 eax_result.set_untagged_int32(true); |
7392 frame_->Push(&eax_result); | 7401 frame_->Push(&eax_result); |
(...skipping 5138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12531 | 12540 |
12532 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12541 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
12533 // tagged as a small integer. | 12542 // tagged as a small integer. |
12534 __ bind(&runtime); | 12543 __ bind(&runtime); |
12535 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12544 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
12536 } | 12545 } |
12537 | 12546 |
12538 #undef __ | 12547 #undef __ |
12539 | 12548 |
12540 } } // namespace v8::internal | 12549 } } // namespace v8::internal |
OLD | NEW |