| 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 5665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5676 HBasicBlock* return_left = graph()->CreateBasicBlock(); | 5676 HBasicBlock* return_left = graph()->CreateBasicBlock(); |
| 5677 HBasicBlock* return_right = graph()->CreateBasicBlock(); | 5677 HBasicBlock* return_right = graph()->CreateBasicBlock(); |
| 5678 | 5678 |
| 5679 compare->SetSuccessorAt(0, return_left); | 5679 compare->SetSuccessorAt(0, return_left); |
| 5680 compare->SetSuccessorAt(1, return_right); | 5680 compare->SetSuccessorAt(1, return_right); |
| 5681 current_block()->Finish(compare); | 5681 current_block()->Finish(compare); |
| 5682 | 5682 |
| 5683 set_current_block(return_left); | 5683 set_current_block(return_left); |
| 5684 Push(left); | 5684 Push(left); |
| 5685 set_current_block(return_right); | 5685 set_current_block(return_right); |
| 5686 Push(right); | 5686 // The branch above always returns the right operand if either of |
| 5687 // them is NaN, but the spec requires that max/min(NaN, X) = NaN. |
| 5688 // We add another branch that checks if the left operand is NaN or not. |
| 5689 if (left_operand->representation().IsDouble()) { |
| 5690 // If left_operand != left_operand then it is NaN. |
| 5691 HCompareIDAndBranch* compare_nan = new(zone()) HCompareIDAndBranch( |
| 5692 left_operand, left_operand, Token::EQ); |
| 5693 compare_nan->SetInputRepresentation(left_operand->representation()); |
| 5694 HBasicBlock* left_is_number = graph()->CreateBasicBlock(); |
| 5695 HBasicBlock* left_is_nan = graph()->CreateBasicBlock(); |
| 5696 compare_nan->SetSuccessorAt(0, left_is_number); |
| 5697 compare_nan->SetSuccessorAt(1, left_is_nan); |
| 5698 current_block()->Finish(compare_nan); |
| 5699 set_current_block(left_is_nan); |
| 5700 Push(left); |
| 5701 set_current_block(left_is_number); |
| 5702 Push(right); |
| 5703 return_right = CreateJoin(left_is_number, left_is_nan, expr->id()); |
| 5704 } else { |
| 5705 Push(right); |
| 5706 } |
| 5687 | 5707 |
| 5688 HBasicBlock* join = CreateJoin(return_left, return_right, expr->id()); | 5708 HBasicBlock* join = CreateJoin(return_left, return_right, expr->id()); |
| 5689 set_current_block(join); | 5709 set_current_block(join); |
| 5690 ast_context()->ReturnValue(Pop()); | 5710 ast_context()->ReturnValue(Pop()); |
| 5691 return true; | 5711 return true; |
| 5692 } | 5712 } |
| 5693 break; | 5713 break; |
| 5694 default: | 5714 default: |
| 5695 // Not yet supported for inlining. | 5715 // Not yet supported for inlining. |
| 5696 break; | 5716 break; |
| (...skipping 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8169 } | 8189 } |
| 8170 } | 8190 } |
| 8171 | 8191 |
| 8172 #ifdef DEBUG | 8192 #ifdef DEBUG |
| 8173 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 8193 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 8174 if (allocator_ != NULL) allocator_->Verify(); | 8194 if (allocator_ != NULL) allocator_->Verify(); |
| 8175 #endif | 8195 #endif |
| 8176 } | 8196 } |
| 8177 | 8197 |
| 8178 } } // namespace v8::internal | 8198 } } // namespace v8::internal |
| OLD | NEW |