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 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 bool HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, | 1532 bool HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, |
1533 HValue* dominator) { | 1533 HValue* dominator) { |
1534 ASSERT(side_effect == kMaps); | 1534 ASSERT(side_effect == kMaps); |
1535 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once | 1535 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once |
1536 // type information is rich enough we should generalize this to any HType | 1536 // type information is rich enough we should generalize this to any HType |
1537 // for which the map is known. | 1537 // for which the map is known. |
1538 if (HasNoUses() && dominator->IsStoreNamedField()) { | 1538 if (HasNoUses() && dominator->IsStoreNamedField()) { |
1539 HStoreNamedField* store = HStoreNamedField::cast(dominator); | 1539 HStoreNamedField* store = HStoreNamedField::cast(dominator); |
1540 if (!store->has_transition() || store->object() != value()) return false; | 1540 if (!store->has_transition() || store->object() != value()) return false; |
1541 HConstant* transition = HConstant::cast(store->transition()); | 1541 HConstant* transition = HConstant::cast(store->transition()); |
1542 if (map_set_.Contains(transition->GetUnique())) { | 1542 if (map_set_.Contains(Unique<Map>::cast(transition->GetUnique()))) { |
1543 DeleteAndReplaceWith(NULL); | 1543 DeleteAndReplaceWith(NULL); |
1544 return true; | 1544 return true; |
1545 } | 1545 } |
1546 } | 1546 } |
1547 return false; | 1547 return false; |
1548 } | 1548 } |
1549 | 1549 |
1550 | 1550 |
1551 void HCheckMaps::PrintDataTo(StringStream* stream) { | 1551 void HCheckMaps::PrintDataTo(StringStream* stream) { |
1552 value()->PrintNameTo(stream); | 1552 value()->PrintNameTo(stream); |
1553 stream->Add(" [%p", *map_set_.at(0).handle()); | 1553 stream->Add(" [%p", *map_set_.at(0).handle()); |
1554 for (int i = 1; i < map_set_.size(); ++i) { | 1554 for (int i = 1; i < map_set_.size(); ++i) { |
1555 stream->Add(",%p", *map_set_.at(i).handle()); | 1555 stream->Add(",%p", *map_set_.at(i).handle()); |
1556 } | 1556 } |
1557 stream->Add("]%s", CanOmitMapChecks() ? "(omitted)" : ""); | 1557 stream->Add("]%s", CanOmitMapChecks() ? "(omitted)" : ""); |
1558 } | 1558 } |
1559 | 1559 |
1560 | 1560 |
1561 void HCheckValue::PrintDataTo(StringStream* stream) { | 1561 void HCheckValue::PrintDataTo(StringStream* stream) { |
1562 value()->PrintNameTo(stream); | 1562 value()->PrintNameTo(stream); |
1563 stream->Add(" "); | 1563 stream->Add(" "); |
1564 object().handle()->ShortPrint(stream); | 1564 object().handle()->ShortPrint(stream); |
1565 } | 1565 } |
1566 | 1566 |
1567 | 1567 |
1568 HValue* HCheckValue::Canonicalize() { | 1568 HValue* HCheckValue::Canonicalize() { |
1569 return (value()->IsConstant() && | 1569 return (value()->IsConstant() && |
1570 HConstant::cast(value())->GetUnique() == object_) | 1570 HConstant::cast(value())->EqualsUnique(object_)) ? NULL : this; |
1571 ? NULL | |
1572 : this; | |
1573 } | 1571 } |
1574 | 1572 |
1575 | 1573 |
1576 const char* HCheckInstanceType::GetCheckName() { | 1574 const char* HCheckInstanceType::GetCheckName() { |
1577 switch (check_) { | 1575 switch (check_) { |
1578 case IS_SPEC_OBJECT: return "object"; | 1576 case IS_SPEC_OBJECT: return "object"; |
1579 case IS_JS_ARRAY: return "array"; | 1577 case IS_JS_ARRAY: return "array"; |
1580 case IS_STRING: return "string"; | 1578 case IS_STRING: return "string"; |
1581 case IS_INTERNALIZED_STRING: return "internalized_string"; | 1579 case IS_INTERNALIZED_STRING: return "internalized_string"; |
1582 } | 1580 } |
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4523 break; | 4521 break; |
4524 case kExternalMemory: | 4522 case kExternalMemory: |
4525 stream->Add("[external-memory]"); | 4523 stream->Add("[external-memory]"); |
4526 break; | 4524 break; |
4527 } | 4525 } |
4528 | 4526 |
4529 stream->Add("@%d", offset()); | 4527 stream->Add("@%d", offset()); |
4530 } | 4528 } |
4531 | 4529 |
4532 } } // namespace v8::internal | 4530 } } // namespace v8::internal |
OLD | NEW |