| 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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 | 946 |
| 947 HArgumentsObject* arguments_object_; | 947 HArgumentsObject* arguments_object_; |
| 948 HArgumentsElements* arguments_elements_; | 948 HArgumentsElements* arguments_elements_; |
| 949 | 949 |
| 950 FunctionState* outer_; | 950 FunctionState* outer_; |
| 951 }; | 951 }; |
| 952 | 952 |
| 953 | 953 |
| 954 class HIfContinuation V8_FINAL { | 954 class HIfContinuation V8_FINAL { |
| 955 public: | 955 public: |
| 956 HIfContinuation() : continuation_captured_(false) {} | 956 HIfContinuation() |
| 957 : continuation_captured_(false), |
| 958 true_branch_(NULL), |
| 959 false_branch_(NULL) {} |
| 957 HIfContinuation(HBasicBlock* true_branch, | 960 HIfContinuation(HBasicBlock* true_branch, |
| 958 HBasicBlock* false_branch) | 961 HBasicBlock* false_branch) |
| 959 : continuation_captured_(true), true_branch_(true_branch), | 962 : continuation_captured_(true), true_branch_(true_branch), |
| 960 false_branch_(false_branch) {} | 963 false_branch_(false_branch) {} |
| 961 ~HIfContinuation() { ASSERT(!continuation_captured_); } | 964 ~HIfContinuation() { ASSERT(!continuation_captured_); } |
| 962 | 965 |
| 963 void Capture(HBasicBlock* true_branch, | 966 void Capture(HBasicBlock* true_branch, |
| 964 HBasicBlock* false_branch) { | 967 HBasicBlock* false_branch) { |
| 965 ASSERT(!continuation_captured_); | 968 ASSERT(!continuation_captured_); |
| 966 true_branch_ = true_branch; | 969 true_branch_ = true_branch; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 HValue* length); | 1272 HValue* length); |
| 1270 | 1273 |
| 1271 void BuildTransitionElementsKind(HValue* object, | 1274 void BuildTransitionElementsKind(HValue* object, |
| 1272 HValue* map, | 1275 HValue* map, |
| 1273 ElementsKind from_kind, | 1276 ElementsKind from_kind, |
| 1274 ElementsKind to_kind, | 1277 ElementsKind to_kind, |
| 1275 bool is_jsarray); | 1278 bool is_jsarray); |
| 1276 | 1279 |
| 1277 HValue* BuildNumberToString(HValue* object, Handle<Type> type); | 1280 HValue* BuildNumberToString(HValue* object, Handle<Type> type); |
| 1278 | 1281 |
| 1282 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, |
| 1283 HValue* key); |
| 1284 |
| 1279 // Computes the size for a sequential string of the given length and encoding. | 1285 // Computes the size for a sequential string of the given length and encoding. |
| 1280 HValue* BuildSeqStringSizeFor(HValue* length, | 1286 HValue* BuildSeqStringSizeFor(HValue* length, |
| 1281 String::Encoding encoding); | 1287 String::Encoding encoding); |
| 1282 // Copies characters from one sequential string to another. | 1288 // Copies characters from one sequential string to another. |
| 1283 void BuildCopySeqStringChars(HValue* src, | 1289 void BuildCopySeqStringChars(HValue* src, |
| 1284 HValue* src_offset, | 1290 HValue* src_offset, |
| 1285 String::Encoding src_encoding, | 1291 String::Encoding src_encoding, |
| 1286 HValue* dst, | 1292 HValue* dst, |
| 1287 HValue* dst_offset, | 1293 HValue* dst_offset, |
| 1288 String::Encoding dst_encoding, | 1294 String::Encoding dst_encoding, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 // // continues after else code of if_whatever or if_something. | 1492 // // continues after else code of if_whatever or if_something. |
| 1487 // ... | 1493 // ... |
| 1488 // if_finally.End(); | 1494 // if_finally.End(); |
| 1489 void JoinContinuation(HIfContinuation* continuation); | 1495 void JoinContinuation(HIfContinuation* continuation); |
| 1490 | 1496 |
| 1491 void Then(); | 1497 void Then(); |
| 1492 void Else(); | 1498 void Else(); |
| 1493 void End(); | 1499 void End(); |
| 1494 | 1500 |
| 1495 void Deopt(const char* reason); | 1501 void Deopt(const char* reason); |
| 1502 void ThenDeopt(const char* reason) { |
| 1503 Then(); |
| 1504 Deopt(reason); |
| 1505 } |
| 1496 void ElseDeopt(const char* reason) { | 1506 void ElseDeopt(const char* reason) { |
| 1497 Else(); | 1507 Else(); |
| 1498 Deopt(reason); | 1508 Deopt(reason); |
| 1499 } | 1509 } |
| 1500 | 1510 |
| 1501 void Return(HValue* value); | 1511 void Return(HValue* value); |
| 1502 | 1512 |
| 1503 private: | 1513 private: |
| 1504 HControlInstruction* AddCompare(HControlInstruction* compare); | 1514 HControlInstruction* AddCompare(HControlInstruction* compare); |
| 1505 | 1515 |
| 1506 HGraphBuilder* builder() const { return builder_; } | 1516 HGraphBuilder* builder() const { return builder_; } |
| 1507 | 1517 |
| 1518 void AddMergeAtJoinBlock(bool deopt); |
| 1519 |
| 1520 void Finish(); |
| 1521 void Finish(HBasicBlock** then_continuation, |
| 1522 HBasicBlock** else_continuation); |
| 1523 |
| 1524 class MergeAtJoinBlock : public ZoneObject { |
| 1525 public: |
| 1526 MergeAtJoinBlock(HBasicBlock* block, |
| 1527 bool deopt, |
| 1528 MergeAtJoinBlock* next) |
| 1529 : block_(block), |
| 1530 deopt_(deopt), |
| 1531 next_(next) {} |
| 1532 HBasicBlock* block_; |
| 1533 bool deopt_; |
| 1534 MergeAtJoinBlock* next_; |
| 1535 }; |
| 1536 |
| 1508 HGraphBuilder* builder_; | 1537 HGraphBuilder* builder_; |
| 1509 bool finished_ : 1; | 1538 bool finished_ : 1; |
| 1510 bool deopt_then_ : 1; | |
| 1511 bool deopt_else_ : 1; | |
| 1512 bool did_then_ : 1; | 1539 bool did_then_ : 1; |
| 1513 bool did_else_ : 1; | 1540 bool did_else_ : 1; |
| 1541 bool did_else_if_ : 1; |
| 1514 bool did_and_ : 1; | 1542 bool did_and_ : 1; |
| 1515 bool did_or_ : 1; | 1543 bool did_or_ : 1; |
| 1516 bool captured_ : 1; | 1544 bool captured_ : 1; |
| 1517 bool needs_compare_ : 1; | 1545 bool needs_compare_ : 1; |
| 1546 bool pending_merge_block_ : 1; |
| 1518 HBasicBlock* first_true_block_; | 1547 HBasicBlock* first_true_block_; |
| 1519 HBasicBlock* last_true_block_; | |
| 1520 HBasicBlock* first_false_block_; | 1548 HBasicBlock* first_false_block_; |
| 1521 HBasicBlock* split_edge_merge_block_; | 1549 HBasicBlock* split_edge_merge_block_; |
| 1522 HBasicBlock* merge_block_; | 1550 MergeAtJoinBlock* merge_at_join_blocks_; |
| 1551 int normal_merge_at_join_block_count_; |
| 1552 int deopt_merge_at_join_block_count_; |
| 1523 }; | 1553 }; |
| 1524 | 1554 |
| 1525 class LoopBuilder V8_FINAL { | 1555 class LoopBuilder V8_FINAL { |
| 1526 public: | 1556 public: |
| 1527 enum Direction { | 1557 enum Direction { |
| 1528 kPreIncrement, | 1558 kPreIncrement, |
| 1529 kPostIncrement, | 1559 kPostIncrement, |
| 1530 kPreDecrement, | 1560 kPreDecrement, |
| 1531 kPostDecrement | 1561 kPostDecrement |
| 1532 }; | 1562 }; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 class JSArrayBuilder V8_FINAL { | 1606 class JSArrayBuilder V8_FINAL { |
| 1577 public: | 1607 public: |
| 1578 JSArrayBuilder(HGraphBuilder* builder, | 1608 JSArrayBuilder(HGraphBuilder* builder, |
| 1579 ElementsKind kind, | 1609 ElementsKind kind, |
| 1580 HValue* allocation_site_payload, | 1610 HValue* allocation_site_payload, |
| 1581 HValue* constructor_function, | 1611 HValue* constructor_function, |
| 1582 AllocationSiteOverrideMode override_mode); | 1612 AllocationSiteOverrideMode override_mode); |
| 1583 | 1613 |
| 1584 JSArrayBuilder(HGraphBuilder* builder, | 1614 JSArrayBuilder(HGraphBuilder* builder, |
| 1585 ElementsKind kind, | 1615 ElementsKind kind, |
| 1586 HValue* constructor_function); | 1616 HValue* constructor_function = NULL); |
| 1617 |
| 1618 enum FillMode { |
| 1619 DONT_FILL_WITH_HOLE, |
| 1620 FILL_WITH_HOLE |
| 1621 }; |
| 1622 |
| 1623 ElementsKind kind() { return kind_; } |
| 1587 | 1624 |
| 1588 HValue* AllocateEmptyArray(); | 1625 HValue* AllocateEmptyArray(); |
| 1589 HValue* AllocateArray(HValue* capacity, HValue* length_field, | 1626 HValue* AllocateArray(HValue* capacity, HValue* length_field, |
| 1590 bool fill_with_hole); | 1627 FillMode fill_mode = FILL_WITH_HOLE); |
| 1591 HValue* GetElementsLocation() { return elements_location_; } | 1628 HValue* GetElementsLocation() { return elements_location_; } |
| 1629 HValue* EmitMapCode(); |
| 1592 | 1630 |
| 1593 private: | 1631 private: |
| 1594 Zone* zone() const { return builder_->zone(); } | 1632 Zone* zone() const { return builder_->zone(); } |
| 1595 int elements_size() const { | 1633 int elements_size() const { |
| 1596 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; | 1634 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; |
| 1597 } | 1635 } |
| 1598 HGraphBuilder* builder() { return builder_; } | 1636 HGraphBuilder* builder() { return builder_; } |
| 1599 HGraph* graph() { return builder_->graph(); } | 1637 HGraph* graph() { return builder_->graph(); } |
| 1600 int initial_capacity() { | 1638 int initial_capacity() { |
| 1601 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); | 1639 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); |
| 1602 return JSArray::kPreallocatedArrayElements; | 1640 return JSArray::kPreallocatedArrayElements; |
| 1603 } | 1641 } |
| 1604 | 1642 |
| 1605 HValue* EmitMapCode(); | |
| 1606 HValue* EmitInternalMapCode(); | 1643 HValue* EmitInternalMapCode(); |
| 1607 HValue* EstablishEmptyArrayAllocationSize(); | 1644 HValue* EstablishEmptyArrayAllocationSize(); |
| 1608 HValue* EstablishAllocationSize(HValue* length_node); | 1645 HValue* EstablishAllocationSize(HValue* length_node); |
| 1609 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity, | 1646 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity, |
| 1610 HValue* length_field, bool fill_with_hole); | 1647 HValue* length_field, |
| 1648 FillMode fill_mode = FILL_WITH_HOLE); |
| 1611 | 1649 |
| 1612 HGraphBuilder* builder_; | 1650 HGraphBuilder* builder_; |
| 1613 ElementsKind kind_; | 1651 ElementsKind kind_; |
| 1614 AllocationSiteMode mode_; | 1652 AllocationSiteMode mode_; |
| 1615 HValue* allocation_site_payload_; | 1653 HValue* allocation_site_payload_; |
| 1616 HValue* constructor_function_; | 1654 HValue* constructor_function_; |
| 1617 HInnerAllocatedObject* elements_location_; | 1655 HInnerAllocatedObject* elements_location_; |
| 1618 }; | 1656 }; |
| 1619 | 1657 |
| 1658 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder, |
| 1659 HValue* length_argument); |
| 1660 |
| 1620 HValue* BuildAllocateElements(ElementsKind kind, | 1661 HValue* BuildAllocateElements(ElementsKind kind, |
| 1621 HValue* capacity); | 1662 HValue* capacity); |
| 1622 | 1663 |
| 1623 void BuildInitializeElementsHeader(HValue* elements, | 1664 void BuildInitializeElementsHeader(HValue* elements, |
| 1624 ElementsKind kind, | 1665 ElementsKind kind, |
| 1625 HValue* capacity); | 1666 HValue* capacity); |
| 1626 | 1667 |
| 1627 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, | 1668 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, |
| 1628 HValue* capacity); | 1669 HValue* capacity); |
| 1629 | 1670 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1656 ElementsKind to_elements_kind, | 1697 ElementsKind to_elements_kind, |
| 1657 HValue* length, | 1698 HValue* length, |
| 1658 HValue* capacity); | 1699 HValue* capacity); |
| 1659 | 1700 |
| 1660 HValue* BuildCloneShallowArray(HValue* boilerplate, | 1701 HValue* BuildCloneShallowArray(HValue* boilerplate, |
| 1661 HValue* allocation_site, | 1702 HValue* allocation_site, |
| 1662 AllocationSiteMode mode, | 1703 AllocationSiteMode mode, |
| 1663 ElementsKind kind, | 1704 ElementsKind kind, |
| 1664 int length); | 1705 int length); |
| 1665 | 1706 |
| 1707 HValue* BuildElementIndexHash(HValue* index); |
| 1708 |
| 1666 void BuildCompareNil( | 1709 void BuildCompareNil( |
| 1667 HValue* value, | 1710 HValue* value, |
| 1668 Handle<Type> type, | 1711 Handle<Type> type, |
| 1669 HIfContinuation* continuation); | 1712 HIfContinuation* continuation); |
| 1670 | 1713 |
| 1671 HValue* BuildCreateAllocationMemento(HValue* previous_object, | 1714 HValue* BuildCreateAllocationMemento(HValue* previous_object, |
| 1672 int previous_object_size, | 1715 int previous_object_size, |
| 1673 HValue* payload); | 1716 HValue* payload); |
| 1674 | 1717 |
| 1675 HInstruction* BuildConstantMapCheck(Handle<JSObject> constant, | 1718 HInstruction* BuildConstantMapCheck(Handle<JSObject> constant, |
| 1676 CompilationInfo* info); | 1719 CompilationInfo* info); |
| 1677 HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype, | 1720 HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype, |
| 1678 Handle<JSObject> holder); | 1721 Handle<JSObject> holder); |
| 1679 | 1722 |
| 1680 HInstruction* BuildGetNativeContext(); | 1723 HInstruction* BuildGetNativeContext(); |
| 1681 HInstruction* BuildGetArrayFunction(); | 1724 HInstruction* BuildGetArrayFunction(); |
| 1682 | 1725 |
| 1683 protected: | 1726 protected: |
| 1684 void SetSourcePosition(int position) { | 1727 void SetSourcePosition(int position) { |
| 1685 ASSERT(position != RelocInfo::kNoPosition); | 1728 ASSERT(position != RelocInfo::kNoPosition); |
| 1686 position_ = position; | 1729 position_ = position; |
| 1687 } | 1730 } |
| 1688 | 1731 |
| 1689 private: | 1732 private: |
| 1690 HGraphBuilder(); | 1733 HGraphBuilder(); |
| 1691 | 1734 |
| 1735 HValue* BuildUncheckedDictionaryElementLoadHelper( |
| 1736 HValue* elements, |
| 1737 HValue* key, |
| 1738 HValue* hash, |
| 1739 HValue* mask, |
| 1740 int current_probe); |
| 1741 |
| 1692 void PadEnvironmentForContinuation(HBasicBlock* from, | 1742 void PadEnvironmentForContinuation(HBasicBlock* from, |
| 1693 HBasicBlock* continuation); | 1743 HBasicBlock* continuation); |
| 1694 | 1744 |
| 1695 CompilationInfo* info_; | 1745 CompilationInfo* info_; |
| 1696 HGraph* graph_; | 1746 HGraph* graph_; |
| 1697 HBasicBlock* current_block_; | 1747 HBasicBlock* current_block_; |
| 1698 int position_; | 1748 int position_; |
| 1699 }; | 1749 }; |
| 1700 | 1750 |
| 1701 | 1751 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 BailoutId ast_id); | 2144 BailoutId ast_id); |
| 2095 | 2145 |
| 2096 void HandlePropertyAssignment(Assignment* expr); | 2146 void HandlePropertyAssignment(Assignment* expr); |
| 2097 void HandleCompoundAssignment(Assignment* expr); | 2147 void HandleCompoundAssignment(Assignment* expr); |
| 2098 void HandlePolymorphicLoadNamedField(BailoutId ast_id, | 2148 void HandlePolymorphicLoadNamedField(BailoutId ast_id, |
| 2099 BailoutId return_id, | 2149 BailoutId return_id, |
| 2100 HValue* object, | 2150 HValue* object, |
| 2101 SmallMapList* types, | 2151 SmallMapList* types, |
| 2102 Handle<String> name); | 2152 Handle<String> name); |
| 2103 | 2153 |
| 2154 bool IsCallNewArrayInlineable(CallNew* expr); |
| 2155 void BuildInlinedCallNewArray(CallNew* expr); |
| 2156 |
| 2104 class PropertyAccessInfo { | 2157 class PropertyAccessInfo { |
| 2105 public: | 2158 public: |
| 2106 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name) | 2159 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name) |
| 2107 : lookup_(isolate), | 2160 : lookup_(isolate), |
| 2108 map_(map), | 2161 map_(map), |
| 2109 name_(name), | 2162 name_(name), |
| 2110 access_(HObjectAccess::ForMap()) { } | 2163 access_(HObjectAccess::ForMap()) { } |
| 2111 | 2164 |
| 2112 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic | 2165 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic |
| 2113 // load named. It additionally fills in the fields necessary to generate the | 2166 // load named. It additionally fills in the fields necessary to generate the |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2522 } | 2575 } |
| 2523 | 2576 |
| 2524 private: | 2577 private: |
| 2525 HGraphBuilder* builder_; | 2578 HGraphBuilder* builder_; |
| 2526 }; | 2579 }; |
| 2527 | 2580 |
| 2528 | 2581 |
| 2529 } } // namespace v8::internal | 2582 } } // namespace v8::internal |
| 2530 | 2583 |
| 2531 #endif // V8_HYDROGEN_H_ | 2584 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |