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