| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 cow_checker.Else(); | 1638 cow_checker.Else(); |
| 1639 | 1639 |
| 1640 environment()->Push(elements); | 1640 environment()->Push(elements); |
| 1641 | 1641 |
| 1642 cow_checker.End(); | 1642 cow_checker.End(); |
| 1643 | 1643 |
| 1644 return environment()->Pop(); | 1644 return environment()->Pop(); |
| 1645 } | 1645 } |
| 1646 | 1646 |
| 1647 | 1647 |
| 1648 void HGraphBuilder::BuildTransitionElementsKind(HValue* object, | |
| 1649 HValue* map, | |
| 1650 ElementsKind from_kind, | |
| 1651 ElementsKind to_kind, | |
| 1652 bool is_jsarray) { | |
| 1653 DCHECK(!IsFastHoleyElementsKind(from_kind) || | |
| 1654 IsFastHoleyElementsKind(to_kind)); | |
| 1655 | |
| 1656 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { | |
| 1657 Add<HTrapAllocationMemento>(object); | |
| 1658 } | |
| 1659 | |
| 1660 if (!IsSimpleMapChangeTransition(from_kind, to_kind)) { | |
| 1661 HInstruction* elements = AddLoadElements(object); | |
| 1662 | |
| 1663 HInstruction* empty_fixed_array = Add<HConstant>( | |
| 1664 isolate()->factory()->empty_fixed_array()); | |
| 1665 | |
| 1666 IfBuilder if_builder(this); | |
| 1667 | |
| 1668 if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array); | |
| 1669 | |
| 1670 if_builder.Then(); | |
| 1671 | |
| 1672 HInstruction* elements_length = AddLoadFixedArrayLength(elements); | |
| 1673 | |
| 1674 HInstruction* array_length = | |
| 1675 is_jsarray | |
| 1676 ? Add<HLoadNamedField>(object, nullptr, | |
| 1677 HObjectAccess::ForArrayLength(from_kind)) | |
| 1678 : elements_length; | |
| 1679 | |
| 1680 BuildGrowElementsCapacity(object, elements, from_kind, to_kind, | |
| 1681 array_length, elements_length); | |
| 1682 | |
| 1683 if_builder.End(); | |
| 1684 } | |
| 1685 | |
| 1686 Add<HStoreNamedField>(object, HObjectAccess::ForMap(), map); | |
| 1687 } | |
| 1688 | |
| 1689 | |
| 1690 void HGraphBuilder::BuildJSObjectCheck(HValue* receiver, | 1648 void HGraphBuilder::BuildJSObjectCheck(HValue* receiver, |
| 1691 int bit_field_mask) { | 1649 int bit_field_mask) { |
| 1692 // Check that the object isn't a smi. | 1650 // Check that the object isn't a smi. |
| 1693 Add<HCheckHeapObject>(receiver); | 1651 Add<HCheckHeapObject>(receiver); |
| 1694 | 1652 |
| 1695 // Get the map of the receiver. | 1653 // Get the map of the receiver. |
| 1696 HValue* map = | 1654 HValue* map = |
| 1697 Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap()); | 1655 Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap()); |
| 1698 | 1656 |
| 1699 // Check the instance type and if an access check is needed, this can be | 1657 // Check the instance type and if an access check is needed, this can be |
| (...skipping 11685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13385 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13343 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13386 } | 13344 } |
| 13387 | 13345 |
| 13388 #ifdef DEBUG | 13346 #ifdef DEBUG |
| 13389 graph_->Verify(false); // No full verify. | 13347 graph_->Verify(false); // No full verify. |
| 13390 #endif | 13348 #endif |
| 13391 } | 13349 } |
| 13392 | 13350 |
| 13393 } // namespace internal | 13351 } // namespace internal |
| 13394 } // namespace v8 | 13352 } // namespace v8 |
| OLD | NEW |