OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9812 Deoptimizer::SOFT); | 9812 Deoptimizer::SOFT); |
9813 combined_type = left_type = right_type = Type::Any(zone()); | 9813 combined_type = left_type = right_type = Type::Any(zone()); |
9814 } | 9814 } |
9815 | 9815 |
9816 Representation left_rep = Representation::FromType(left_type); | 9816 Representation left_rep = Representation::FromType(left_type); |
9817 Representation right_rep = Representation::FromType(right_type); | 9817 Representation right_rep = Representation::FromType(right_type); |
9818 Representation combined_rep = Representation::FromType(combined_type); | 9818 Representation combined_rep = Representation::FromType(combined_type); |
9819 | 9819 |
9820 if (combined_type->Is(Type::Receiver())) { | 9820 if (combined_type->Is(Type::Receiver())) { |
9821 if (Token::IsEqualityOp(op)) { | 9821 if (Token::IsEqualityOp(op)) { |
9822 // HCompareObjectEqAndBranch can only deal with object, so | |
9823 // exclude numbers. | |
9824 if ((left->IsConstant() && | |
9825 HConstant::cast(left)->HasNumberValue()) || | |
9826 (right->IsConstant() && | |
9827 HConstant::cast(right)->HasNumberValue())) { | |
9828 Add<HDeoptimize>("Type mismatch between feedback and constant", | |
9829 Deoptimizer::SOFT); | |
9830 // The caller expects a branch instruction, so make it happy. | |
9831 return New<HBranch>(graph()->GetConstantTrue()); | |
9832 } | |
9822 // Can we get away with map check and not instance type check? | 9833 // Can we get away with map check and not instance type check? |
9823 HValue* operand_to_check = | 9834 HValue* operand_to_check = |
9824 left->block()->block_id() < right->block()->block_id() ? left : right; | 9835 left->block()->block_id() < right->block()->block_id() ? left : right; |
9825 if (combined_type->IsClass()) { | 9836 if (combined_type->IsClass()) { |
9826 Handle<Map> map = combined_type->AsClass(); | 9837 Handle<Map> map = combined_type->AsClass(); |
9827 AddCheckMap(operand_to_check, map); | 9838 AddCheckMap(operand_to_check, map); |
9828 HCompareObjectEqAndBranch* result = | 9839 HCompareObjectEqAndBranch* result = |
9829 New<HCompareObjectEqAndBranch>(left, right); | 9840 New<HCompareObjectEqAndBranch>(left, right); |
9830 if (FLAG_hydrogen_track_positions) { | 9841 if (FLAG_hydrogen_track_positions) { |
9831 result->set_operand_position(zone(), 0, left_position); | 9842 result->set_operand_position(zone(), 0, left_position); |
(...skipping 26 matching lines...) Expand all Loading... | |
9858 return New<HBranch>(graph()->GetConstantTrue()); | 9869 return New<HBranch>(graph()->GetConstantTrue()); |
9859 } | 9870 } |
9860 BuildCheckHeapObject(left); | 9871 BuildCheckHeapObject(left); |
9861 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_INTERNALIZED_STRING); | 9872 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_INTERNALIZED_STRING); |
9862 BuildCheckHeapObject(right); | 9873 BuildCheckHeapObject(right); |
9863 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_INTERNALIZED_STRING); | 9874 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_INTERNALIZED_STRING); |
9864 HCompareObjectEqAndBranch* result = | 9875 HCompareObjectEqAndBranch* result = |
9865 New<HCompareObjectEqAndBranch>(left, right); | 9876 New<HCompareObjectEqAndBranch>(left, right); |
9866 return result; | 9877 return result; |
9867 } else if (combined_type->Is(Type::String())) { | 9878 } else if (combined_type->Is(Type::String())) { |
9868 // If we have a constant argument, it should be consistent with the type | |
9869 // feedback (otherwise we fail assertions in HCompareObjectEqAndBranch). | |
9870 if ((left->IsConstant() && | |
9871 !HConstant::cast(left)->HasStringValue()) || | |
9872 (right->IsConstant() && | |
9873 !HConstant::cast(right)->HasStringValue())) { | |
9874 Add<HDeoptimize>("Type mismatch between feedback and constant", | |
9875 Deoptimizer::SOFT); | |
9876 // The caller expects a branch instruction, so make it happy. | |
9877 return New<HBranch>(graph()->GetConstantTrue()); | |
9878 } | |
Jarin
2014/04/10 14:24:35
I have removed this because it does not use HCompa
| |
9879 BuildCheckHeapObject(left); | 9879 BuildCheckHeapObject(left); |
9880 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_STRING); | 9880 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_STRING); |
9881 BuildCheckHeapObject(right); | 9881 BuildCheckHeapObject(right); |
9882 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_STRING); | 9882 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_STRING); |
9883 HStringCompareAndBranch* result = | 9883 HStringCompareAndBranch* result = |
9884 New<HStringCompareAndBranch>(left, right, op); | 9884 New<HStringCompareAndBranch>(left, right, op); |
9885 return result; | 9885 return result; |
9886 } else { | 9886 } else { |
9887 if (combined_rep.IsTagged() || combined_rep.IsNone()) { | 9887 if (combined_rep.IsTagged() || combined_rep.IsNone()) { |
9888 HCompareGeneric* result = Add<HCompareGeneric>(left, right, op); | 9888 HCompareGeneric* result = Add<HCompareGeneric>(left, right, op); |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11524 if (ShouldProduceTraceOutput()) { | 11524 if (ShouldProduceTraceOutput()) { |
11525 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11525 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11526 } | 11526 } |
11527 | 11527 |
11528 #ifdef DEBUG | 11528 #ifdef DEBUG |
11529 graph_->Verify(false); // No full verify. | 11529 graph_->Verify(false); // No full verify. |
11530 #endif | 11530 #endif |
11531 } | 11531 } |
11532 | 11532 |
11533 } } // namespace v8::internal | 11533 } } // namespace v8::internal |
OLD | NEW |