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 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 } | 2551 } |
2552 | 2552 |
2553 | 2553 |
2554 void HStringCompareAndBranch::PrintDataTo(StringStream* stream) { | 2554 void HStringCompareAndBranch::PrintDataTo(StringStream* stream) { |
2555 stream->Add(Token::Name(token())); | 2555 stream->Add(Token::Name(token())); |
2556 stream->Add(" "); | 2556 stream->Add(" "); |
2557 HControlInstruction::PrintDataTo(stream); | 2557 HControlInstruction::PrintDataTo(stream); |
2558 } | 2558 } |
2559 | 2559 |
2560 | 2560 |
2561 void HCompareIDAndBranch::AddInformativeDefinitions() { | 2561 void HCompareNumericAndBranch::AddInformativeDefinitions() { |
2562 NumericRelation r = NumericRelation::FromToken(token()); | 2562 NumericRelation r = NumericRelation::FromToken(token()); |
2563 if (r.IsNone()) return; | 2563 if (r.IsNone()) return; |
2564 | 2564 |
2565 HNumericConstraint::AddToGraph(left(), r, right(), SuccessorAt(0)->first()); | 2565 HNumericConstraint::AddToGraph(left(), r, right(), SuccessorAt(0)->first()); |
2566 HNumericConstraint::AddToGraph( | 2566 HNumericConstraint::AddToGraph( |
2567 left(), r.Negated(), right(), SuccessorAt(1)->first()); | 2567 left(), r.Negated(), right(), SuccessorAt(1)->first()); |
2568 } | 2568 } |
2569 | 2569 |
2570 | 2570 |
2571 void HCompareIDAndBranch::PrintDataTo(StringStream* stream) { | 2571 void HCompareNumericAndBranch::PrintDataTo(StringStream* stream) { |
2572 stream->Add(Token::Name(token())); | 2572 stream->Add(Token::Name(token())); |
2573 stream->Add(" "); | 2573 stream->Add(" "); |
2574 left()->PrintNameTo(stream); | 2574 left()->PrintNameTo(stream); |
2575 stream->Add(" "); | 2575 stream->Add(" "); |
2576 right()->PrintNameTo(stream); | 2576 right()->PrintNameTo(stream); |
2577 HControlInstruction::PrintDataTo(stream); | 2577 HControlInstruction::PrintDataTo(stream); |
2578 } | 2578 } |
2579 | 2579 |
2580 | 2580 |
2581 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { | 2581 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { |
2582 left()->PrintNameTo(stream); | 2582 left()->PrintNameTo(stream); |
2583 stream->Add(" "); | 2583 stream->Add(" "); |
2584 right()->PrintNameTo(stream); | 2584 right()->PrintNameTo(stream); |
2585 HControlInstruction::PrintDataTo(stream); | 2585 HControlInstruction::PrintDataTo(stream); |
2586 } | 2586 } |
2587 | 2587 |
2588 | 2588 |
2589 void HGoto::PrintDataTo(StringStream* stream) { | 2589 void HGoto::PrintDataTo(StringStream* stream) { |
2590 stream->Add("B%d", SuccessorAt(0)->block_id()); | 2590 stream->Add("B%d", SuccessorAt(0)->block_id()); |
2591 } | 2591 } |
2592 | 2592 |
2593 | 2593 |
2594 void HCompareIDAndBranch::InferRepresentation( | 2594 void HCompareNumericAndBranch::InferRepresentation( |
2595 HInferRepresentationPhase* h_infer) { | 2595 HInferRepresentationPhase* h_infer) { |
2596 Representation left_rep = left()->representation(); | 2596 Representation left_rep = left()->representation(); |
2597 Representation right_rep = right()->representation(); | 2597 Representation right_rep = right()->representation(); |
2598 Representation observed_left = observed_input_representation(0); | 2598 Representation observed_left = observed_input_representation(0); |
2599 Representation observed_right = observed_input_representation(1); | 2599 Representation observed_right = observed_input_representation(1); |
2600 | 2600 |
2601 Representation rep = Representation::None(); | 2601 Representation rep = Representation::None(); |
2602 rep = rep.generalize(observed_left); | 2602 rep = rep.generalize(observed_left); |
2603 rep = rep.generalize(observed_right); | 2603 rep = rep.generalize(observed_right); |
2604 if (rep.IsNone() || rep.IsSmiOrInteger32()) { | 2604 if (rep.IsNone() || rep.IsSmiOrInteger32()) { |
2605 if (!left_rep.IsTagged()) rep = rep.generalize(left_rep); | 2605 if (!left_rep.IsTagged()) rep = rep.generalize(left_rep); |
2606 if (!right_rep.IsTagged()) rep = rep.generalize(right_rep); | 2606 if (!right_rep.IsTagged()) rep = rep.generalize(right_rep); |
2607 } else { | 2607 } else { |
2608 rep = Representation::Double(); | 2608 rep = Representation::Double(); |
2609 } | 2609 } |
2610 | 2610 |
2611 if (rep.IsDouble()) { | 2611 if (rep.IsDouble()) { |
2612 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === | 2612 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === |
2613 // and !=) have special handling of undefined, e.g. undefined == undefined | 2613 // and !=) have special handling of undefined, e.g. undefined == undefined |
2614 // is 'true'. Relational comparisons have a different semantic, first | 2614 // is 'true'. Relational comparisons have a different semantic, first |
2615 // calling ToPrimitive() on their arguments. The standard Crankshaft | 2615 // calling ToPrimitive() on their arguments. The standard Crankshaft |
2616 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs | 2616 // tagged-to-double conversion to ensure the HCompareNumericAndBranch's |
2617 // are doubles caused 'undefined' to be converted to NaN. That's compatible | 2617 // inputs are doubles caused 'undefined' to be converted to NaN. That's |
2618 // out-of-the box with ordered relational comparisons (<, >, <=, | 2618 // compatible out-of-the box with ordered relational comparisons (<, >, <=, |
2619 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), | 2619 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), |
2620 // it is not consistent with the spec. For example, it would cause undefined | 2620 // it is not consistent with the spec. For example, it would cause undefined |
2621 // == undefined (should be true) to be evaluated as NaN == NaN | 2621 // == undefined (should be true) to be evaluated as NaN == NaN |
2622 // (false). Therefore, any comparisons other than ordered relational | 2622 // (false). Therefore, any comparisons other than ordered relational |
2623 // comparisons must cause a deopt when one of their arguments is undefined. | 2623 // comparisons must cause a deopt when one of their arguments is undefined. |
2624 // See also v8:1434 | 2624 // See also v8:1434 |
2625 if (Token::IsOrderedRelationalCompareOp(token_)) { | 2625 if (Token::IsOrderedRelationalCompareOp(token_)) { |
2626 SetFlag(kAllowUndefinedAsNaN); | 2626 SetFlag(kAllowUndefinedAsNaN); |
2627 } | 2627 } |
2628 } | 2628 } |
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3916 case kBackingStore: | 3916 case kBackingStore: |
3917 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3917 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3918 stream->Add("[backing-store]"); | 3918 stream->Add("[backing-store]"); |
3919 break; | 3919 break; |
3920 } | 3920 } |
3921 | 3921 |
3922 stream->Add("@%d", offset()); | 3922 stream->Add("@%d", offset()); |
3923 } | 3923 } |
3924 | 3924 |
3925 } } // namespace v8::internal | 3925 } } // namespace v8::internal |
OLD | NEW |