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 9175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9186 int left_position, | 9186 int left_position, |
9187 int right_position, | 9187 int right_position, |
9188 BailoutId bailout_id) { | 9188 BailoutId bailout_id) { |
9189 Representation left_rep = Representation::FromType(left_type); | 9189 Representation left_rep = Representation::FromType(left_type); |
9190 Representation right_rep = Representation::FromType(right_type); | 9190 Representation right_rep = Representation::FromType(right_type); |
9191 Representation combined_rep = Representation::FromType(combined_type); | 9191 Representation combined_rep = Representation::FromType(combined_type); |
9192 | 9192 |
9193 if (combined_type->Is(Type::Receiver())) { | 9193 if (combined_type->Is(Type::Receiver())) { |
9194 if (Token::IsEqualityOp(op)) { | 9194 if (Token::IsEqualityOp(op)) { |
9195 // Can we get away with map check and not instance type check? | 9195 // Can we get away with map check and not instance type check? |
| 9196 HValue* operand_to_check = |
| 9197 left->block()->block_id() < right->block()->block_id() ? left : right; |
9196 if (combined_type->IsClass()) { | 9198 if (combined_type->IsClass()) { |
9197 Handle<Map> map = combined_type->AsClass(); | 9199 Handle<Map> map = combined_type->AsClass(); |
9198 AddCheckMap(left, map); | 9200 AddCheckMap(operand_to_check, map); |
9199 AddCheckMap(right, map); | |
9200 HCompareObjectEqAndBranch* result = | 9201 HCompareObjectEqAndBranch* result = |
9201 New<HCompareObjectEqAndBranch>(left, right); | 9202 New<HCompareObjectEqAndBranch>(left, right); |
9202 if (FLAG_emit_opt_code_positions) { | 9203 if (FLAG_emit_opt_code_positions) { |
9203 result->set_operand_position(zone(), 0, left_position); | 9204 result->set_operand_position(zone(), 0, left_position); |
9204 result->set_operand_position(zone(), 1, right_position); | 9205 result->set_operand_position(zone(), 1, right_position); |
9205 } | 9206 } |
9206 return result; | 9207 return result; |
9207 } else { | 9208 } else { |
9208 BuildCheckHeapObject(left); | 9209 BuildCheckHeapObject(operand_to_check); |
9209 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_SPEC_OBJECT); | 9210 Add<HCheckInstanceType>(operand_to_check, |
9210 BuildCheckHeapObject(right); | 9211 HCheckInstanceType::IS_SPEC_OBJECT); |
9211 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_SPEC_OBJECT); | |
9212 HCompareObjectEqAndBranch* result = | 9212 HCompareObjectEqAndBranch* result = |
9213 New<HCompareObjectEqAndBranch>(left, right); | 9213 New<HCompareObjectEqAndBranch>(left, right); |
9214 return result; | 9214 return result; |
9215 } | 9215 } |
9216 } else { | 9216 } else { |
9217 Bailout(kUnsupportedNonPrimitiveCompare); | 9217 Bailout(kUnsupportedNonPrimitiveCompare); |
9218 return NULL; | 9218 return NULL; |
9219 } | 9219 } |
9220 } else if (combined_type->Is(Type::InternalizedString()) && | 9220 } else if (combined_type->Is(Type::InternalizedString()) && |
9221 Token::IsEqualityOp(op)) { | 9221 Token::IsEqualityOp(op)) { |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10777 if (ShouldProduceTraceOutput()) { | 10777 if (ShouldProduceTraceOutput()) { |
10778 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10778 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10779 } | 10779 } |
10780 | 10780 |
10781 #ifdef DEBUG | 10781 #ifdef DEBUG |
10782 graph_->Verify(false); // No full verify. | 10782 graph_->Verify(false); // No full verify. |
10783 #endif | 10783 #endif |
10784 } | 10784 } |
10785 | 10785 |
10786 } } // namespace v8::internal | 10786 } } // namespace v8::internal |
OLD | NEW |