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 27 matching lines...) Expand all Loading... |
38 #include "v8conversions.h" | 38 #include "v8conversions.h" |
39 #include "v8utils.h" | 39 #include "v8utils.h" |
40 #include "zone.h" | 40 #include "zone.h" |
41 | 41 |
42 namespace v8 { | 42 namespace v8 { |
43 namespace internal { | 43 namespace internal { |
44 | 44 |
45 // Forward declarations. | 45 // Forward declarations. |
46 class HBasicBlock; | 46 class HBasicBlock; |
47 class HEnvironment; | 47 class HEnvironment; |
48 class HInferRepresentation; | 48 class HInferRepresentationPhase; |
49 class HInstruction; | 49 class HInstruction; |
50 class HLoopInformation; | 50 class HLoopInformation; |
51 class HValue; | 51 class HValue; |
52 class LInstruction; | 52 class LInstruction; |
53 class LChunkBuilder; | 53 class LChunkBuilder; |
54 | 54 |
55 | 55 |
56 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ | 56 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ |
57 V(ArithmeticBinaryOperation) \ | 57 V(ArithmeticBinaryOperation) \ |
58 V(BinaryOperation) \ | 58 V(BinaryOperation) \ |
(...skipping 26 matching lines...) Expand all Loading... |
85 V(CallNamed) \ | 85 V(CallNamed) \ |
86 V(CallNew) \ | 86 V(CallNew) \ |
87 V(CallNewArray) \ | 87 V(CallNewArray) \ |
88 V(CallRuntime) \ | 88 V(CallRuntime) \ |
89 V(CallStub) \ | 89 V(CallStub) \ |
90 V(Change) \ | 90 V(Change) \ |
91 V(CheckFunction) \ | 91 V(CheckFunction) \ |
92 V(CheckHeapObject) \ | 92 V(CheckHeapObject) \ |
93 V(CheckInstanceType) \ | 93 V(CheckInstanceType) \ |
94 V(CheckMaps) \ | 94 V(CheckMaps) \ |
| 95 V(CheckSmi) \ |
95 V(CheckPrototypeMaps) \ | 96 V(CheckPrototypeMaps) \ |
96 V(ClampToUint8) \ | 97 V(ClampToUint8) \ |
97 V(ClassOfTestAndBranch) \ | 98 V(ClassOfTestAndBranch) \ |
98 V(CompareIDAndBranch) \ | 99 V(CompareNumericAndBranch) \ |
99 V(CompareGeneric) \ | 100 V(CompareGeneric) \ |
100 V(CompareObjectEqAndBranch) \ | 101 V(CompareObjectEqAndBranch) \ |
101 V(CompareMap) \ | 102 V(CompareMap) \ |
102 V(CompareConstantEqAndBranch) \ | 103 V(CompareConstantEqAndBranch) \ |
103 V(Constant) \ | 104 V(Constant) \ |
104 V(Context) \ | 105 V(Context) \ |
105 V(DebugBreak) \ | 106 V(DebugBreak) \ |
106 V(DeclareGlobals) \ | 107 V(DeclareGlobals) \ |
107 V(DeleteProperty) \ | 108 V(DeleteProperty) \ |
108 V(Deoptimize) \ | 109 V(Deoptimize) \ |
109 V(Div) \ | 110 V(Div) \ |
110 V(DummyUse) \ | 111 V(DummyUse) \ |
111 V(ElementsKind) \ | 112 V(ElementsKind) \ |
112 V(EnterInlined) \ | 113 V(EnterInlined) \ |
113 V(EnvironmentMarker) \ | 114 V(EnvironmentMarker) \ |
114 V(FixedArrayBaseLength) \ | |
115 V(ForceRepresentation) \ | 115 V(ForceRepresentation) \ |
116 V(FunctionLiteral) \ | 116 V(FunctionLiteral) \ |
117 V(GetCachedArrayIndex) \ | 117 V(GetCachedArrayIndex) \ |
118 V(GlobalObject) \ | 118 V(GlobalObject) \ |
119 V(GlobalReceiver) \ | 119 V(GlobalReceiver) \ |
120 V(Goto) \ | 120 V(Goto) \ |
121 V(HasCachedArrayIndexAndBranch) \ | 121 V(HasCachedArrayIndexAndBranch) \ |
122 V(HasInstanceTypeAndBranch) \ | 122 V(HasInstanceTypeAndBranch) \ |
123 V(InductionVariableAnnotation) \ | 123 V(InductionVariableAnnotation) \ |
124 V(In) \ | 124 V(In) \ |
125 V(InnerAllocatedObject) \ | 125 V(InnerAllocatedObject) \ |
126 V(InstanceOf) \ | 126 V(InstanceOf) \ |
127 V(InstanceOfKnownGlobal) \ | 127 V(InstanceOfKnownGlobal) \ |
128 V(InstanceSize) \ | 128 V(InstanceSize) \ |
129 V(InvokeFunction) \ | 129 V(InvokeFunction) \ |
130 V(IsConstructCallAndBranch) \ | 130 V(IsConstructCallAndBranch) \ |
131 V(IsObjectAndBranch) \ | 131 V(IsObjectAndBranch) \ |
| 132 V(IsNumberAndBranch) \ |
132 V(IsStringAndBranch) \ | 133 V(IsStringAndBranch) \ |
133 V(IsSmiAndBranch) \ | 134 V(IsSmiAndBranch) \ |
134 V(IsUndetectableAndBranch) \ | 135 V(IsUndetectableAndBranch) \ |
135 V(LeaveInlined) \ | 136 V(LeaveInlined) \ |
136 V(LoadContextSlot) \ | 137 V(LoadContextSlot) \ |
137 V(LoadExternalArrayPointer) \ | 138 V(LoadExternalArrayPointer) \ |
138 V(LoadFunctionPrototype) \ | 139 V(LoadFunctionPrototype) \ |
139 V(LoadGlobalCell) \ | 140 V(LoadGlobalCell) \ |
140 V(LoadGlobalGeneric) \ | 141 V(LoadGlobalGeneric) \ |
141 V(LoadKeyed) \ | 142 V(LoadKeyed) \ |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 bool HasRange() const { return range_ != NULL; } | 1056 bool HasRange() const { return range_ != NULL; } |
1056 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } | 1057 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } |
1057 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } | 1058 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } |
1058 bool RangeCanInclude(int value) const { | 1059 bool RangeCanInclude(int value) const { |
1059 return !HasRange() || range()->Includes(value); | 1060 return !HasRange() || range()->Includes(value); |
1060 } | 1061 } |
1061 void AddNewRange(Range* r, Zone* zone); | 1062 void AddNewRange(Range* r, Zone* zone); |
1062 void RemoveLastAddedRange(); | 1063 void RemoveLastAddedRange(); |
1063 void ComputeInitialRange(Zone* zone); | 1064 void ComputeInitialRange(Zone* zone); |
1064 | 1065 |
| 1066 // Escape analysis helpers. |
| 1067 virtual bool HasEscapingOperandAt(int index) { return true; } |
| 1068 |
1065 // Representation helpers. | 1069 // Representation helpers. |
1066 virtual Representation observed_input_representation(int index) { | 1070 virtual Representation observed_input_representation(int index) { |
1067 return Representation::None(); | 1071 return Representation::None(); |
1068 } | 1072 } |
1069 virtual Representation RequiredInputRepresentation(int index) = 0; | 1073 virtual Representation RequiredInputRepresentation(int index) = 0; |
1070 virtual void InferRepresentation(HInferRepresentation* h_infer); | 1074 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
1071 | 1075 |
1072 // This gives the instruction an opportunity to replace itself with an | 1076 // This gives the instruction an opportunity to replace itself with an |
1073 // instruction that does the same in some better way. To replace an | 1077 // instruction that does the same in some better way. To replace an |
1074 // instruction with a new one, first add the new instruction to the graph, | 1078 // instruction with a new one, first add the new instruction to the graph, |
1075 // then return it. Return NULL to have the instruction deleted. | 1079 // then return it. Return NULL to have the instruction deleted. |
1076 virtual HValue* Canonicalize() { return this; } | 1080 virtual HValue* Canonicalize() { return this; } |
1077 | 1081 |
1078 bool Equals(HValue* other); | 1082 bool Equals(HValue* other); |
1079 virtual intptr_t Hashcode(); | 1083 virtual intptr_t Hashcode(); |
1080 | 1084 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 UNREACHABLE(); | 1156 UNREACHABLE(); |
1153 return false; | 1157 return false; |
1154 } | 1158 } |
1155 | 1159 |
1156 virtual Representation RepresentationFromInputs() { | 1160 virtual Representation RepresentationFromInputs() { |
1157 return representation(); | 1161 return representation(); |
1158 } | 1162 } |
1159 Representation RepresentationFromUses(); | 1163 Representation RepresentationFromUses(); |
1160 Representation RepresentationFromUseRequirements(); | 1164 Representation RepresentationFromUseRequirements(); |
1161 virtual void UpdateRepresentation(Representation new_rep, | 1165 virtual void UpdateRepresentation(Representation new_rep, |
1162 HInferRepresentation* h_infer, | 1166 HInferRepresentationPhase* h_infer, |
1163 const char* reason); | 1167 const char* reason); |
1164 void AddDependantsToWorklist(HInferRepresentation* h_infer); | 1168 void AddDependantsToWorklist(HInferRepresentationPhase* h_infer); |
1165 | 1169 |
1166 virtual void RepresentationChanged(Representation to) { } | 1170 virtual void RepresentationChanged(Representation to) { } |
1167 | 1171 |
1168 virtual Range* InferRange(Zone* zone); | 1172 virtual Range* InferRange(Zone* zone); |
1169 virtual void DeleteFromGraph() = 0; | 1173 virtual void DeleteFromGraph() = 0; |
1170 virtual void InternalSetOperandAt(int index, HValue* value) = 0; | 1174 virtual void InternalSetOperandAt(int index, HValue* value) = 0; |
1171 void clear_block() { | 1175 void clear_block() { |
1172 ASSERT(block_ != NULL); | 1176 ASSERT(block_ != NULL); |
1173 block_ = NULL; | 1177 block_ = NULL; |
1174 } | 1178 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 explicit HDummyUse(HValue* value) { | 1430 explicit HDummyUse(HValue* value) { |
1427 SetOperandAt(0, value); | 1431 SetOperandAt(0, value); |
1428 // Pretend to be a Smi so that the HChange instructions inserted | 1432 // Pretend to be a Smi so that the HChange instructions inserted |
1429 // before any use generate as little code as possible. | 1433 // before any use generate as little code as possible. |
1430 set_representation(Representation::Tagged()); | 1434 set_representation(Representation::Tagged()); |
1431 set_type(HType::Smi()); | 1435 set_type(HType::Smi()); |
1432 } | 1436 } |
1433 | 1437 |
1434 HValue* value() { return OperandAt(0); } | 1438 HValue* value() { return OperandAt(0); } |
1435 | 1439 |
| 1440 virtual bool HasEscapingOperandAt(int index) { return false; } |
1436 virtual Representation RequiredInputRepresentation(int index) { | 1441 virtual Representation RequiredInputRepresentation(int index) { |
1437 return Representation::None(); | 1442 return Representation::None(); |
1438 } | 1443 } |
1439 | 1444 |
1440 virtual void PrintDataTo(StringStream* stream); | 1445 virtual void PrintDataTo(StringStream* stream); |
1441 | 1446 |
1442 DECLARE_CONCRETE_INSTRUCTION(DummyUse); | 1447 DECLARE_CONCRETE_INSTRUCTION(DummyUse); |
1443 }; | 1448 }; |
1444 | 1449 |
1445 | 1450 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 | 1599 |
1595 virtual void PrintDataTo(StringStream* stream); | 1600 virtual void PrintDataTo(StringStream* stream); |
1596 | 1601 |
1597 HValue* value() { return OperandAt(0); } | 1602 HValue* value() { return OperandAt(0); } |
1598 }; | 1603 }; |
1599 | 1604 |
1600 | 1605 |
1601 class HBranch: public HUnaryControlInstruction { | 1606 class HBranch: public HUnaryControlInstruction { |
1602 public: | 1607 public: |
1603 HBranch(HValue* value, | 1608 HBranch(HValue* value, |
1604 HBasicBlock* true_target, | 1609 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), |
1605 HBasicBlock* false_target, | 1610 HBasicBlock* true_target = NULL, |
1606 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types()) | 1611 HBasicBlock* false_target = NULL) |
1607 : HUnaryControlInstruction(value, true_target, false_target), | 1612 : HUnaryControlInstruction(value, true_target, false_target), |
1608 expected_input_types_(expected_input_types) { | 1613 expected_input_types_(expected_input_types) { |
1609 ASSERT(true_target != NULL && false_target != NULL); | |
1610 SetFlag(kAllowUndefinedAsNaN); | |
1611 } | |
1612 explicit HBranch(HValue* value) | |
1613 : HUnaryControlInstruction(value, NULL, NULL) { | |
1614 SetFlag(kAllowUndefinedAsNaN); | |
1615 } | |
1616 HBranch(HValue* value, ToBooleanStub::Types expected_input_types) | |
1617 : HUnaryControlInstruction(value, NULL, NULL), | |
1618 expected_input_types_(expected_input_types) { | |
1619 SetFlag(kAllowUndefinedAsNaN); | 1614 SetFlag(kAllowUndefinedAsNaN); |
1620 } | 1615 } |
1621 | 1616 |
1622 virtual Representation RequiredInputRepresentation(int index) { | 1617 virtual Representation RequiredInputRepresentation(int index) { |
1623 return Representation::None(); | 1618 return Representation::None(); |
1624 } | 1619 } |
1625 virtual Representation observed_input_representation(int index); | 1620 virtual Representation observed_input_representation(int index); |
1626 | 1621 |
1627 ToBooleanStub::Types expected_input_types() const { | 1622 ToBooleanStub::Types expected_input_types() const { |
1628 return expected_input_types_; | 1623 return expected_input_types_; |
1629 } | 1624 } |
1630 | 1625 |
1631 DECLARE_CONCRETE_INSTRUCTION(Branch) | 1626 DECLARE_CONCRETE_INSTRUCTION(Branch) |
1632 | 1627 |
1633 private: | 1628 private: |
1634 ToBooleanStub::Types expected_input_types_; | 1629 ToBooleanStub::Types expected_input_types_; |
1635 }; | 1630 }; |
1636 | 1631 |
1637 | 1632 |
1638 class HCompareMap: public HUnaryControlInstruction { | 1633 class HCompareMap: public HUnaryControlInstruction { |
1639 public: | 1634 public: |
1640 HCompareMap(HValue* value, | 1635 HCompareMap(HValue* value, |
1641 Handle<Map> map, | 1636 Handle<Map> map, |
1642 HBasicBlock* true_target, | 1637 HBasicBlock* true_target = NULL, |
1643 HBasicBlock* false_target) | 1638 HBasicBlock* false_target = NULL) |
1644 : HUnaryControlInstruction(value, true_target, false_target), | 1639 : HUnaryControlInstruction(value, true_target, false_target), |
1645 map_(map) { | 1640 map_(map) { |
1646 ASSERT(true_target != NULL); | |
1647 ASSERT(false_target != NULL); | |
1648 ASSERT(!map.is_null()); | 1641 ASSERT(!map.is_null()); |
1649 } | 1642 } |
1650 | 1643 |
1651 virtual void PrintDataTo(StringStream* stream); | 1644 virtual void PrintDataTo(StringStream* stream); |
1652 | 1645 |
1653 Handle<Map> map() const { return map_; } | 1646 Handle<Map> map() const { return map_; } |
1654 | 1647 |
1655 virtual Representation RequiredInputRepresentation(int index) { | 1648 virtual Representation RequiredInputRepresentation(int index) { |
1656 return Representation::Tagged(); | 1649 return Representation::Tagged(); |
1657 } | 1650 } |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 } | 1878 } |
1886 int ToOperandIndex(int environment_index) { | 1879 int ToOperandIndex(int environment_index) { |
1887 for (int i = 0; i < assigned_indexes_.length(); ++i) { | 1880 for (int i = 0; i < assigned_indexes_.length(); ++i) { |
1888 if (assigned_indexes_[i] == environment_index) return i; | 1881 if (assigned_indexes_[i] == environment_index) return i; |
1889 } | 1882 } |
1890 return -1; | 1883 return -1; |
1891 } | 1884 } |
1892 virtual int OperandCount() { return values_.length(); } | 1885 virtual int OperandCount() { return values_.length(); } |
1893 virtual HValue* OperandAt(int index) const { return values_[index]; } | 1886 virtual HValue* OperandAt(int index) const { return values_[index]; } |
1894 | 1887 |
| 1888 virtual bool HasEscapingOperandAt(int index) { return false; } |
1895 virtual Representation RequiredInputRepresentation(int index) { | 1889 virtual Representation RequiredInputRepresentation(int index) { |
1896 return Representation::None(); | 1890 return Representation::None(); |
1897 } | 1891 } |
1898 | 1892 |
1899 void MergeWith(ZoneList<HSimulate*>* list); | 1893 void MergeWith(ZoneList<HSimulate*>* list); |
1900 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } | 1894 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } |
1901 | 1895 |
1902 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1896 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
1903 | 1897 |
1904 #ifdef DEBUG | 1898 #ifdef DEBUG |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 HValue* context() { return first(); } | 2475 HValue* context() { return first(); } |
2482 HValue* constructor() { return second(); } | 2476 HValue* constructor() { return second(); } |
2483 | 2477 |
2484 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 2478 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
2485 }; | 2479 }; |
2486 | 2480 |
2487 | 2481 |
2488 class HCallNewArray: public HCallNew { | 2482 class HCallNewArray: public HCallNew { |
2489 public: | 2483 public: |
2490 HCallNewArray(HValue* context, HValue* constructor, int argument_count, | 2484 HCallNewArray(HValue* context, HValue* constructor, int argument_count, |
2491 Handle<Cell> type_cell) | 2485 Handle<Cell> type_cell, ElementsKind elements_kind) |
2492 : HCallNew(context, constructor, argument_count), | 2486 : HCallNew(context, constructor, argument_count), |
2493 type_cell_(type_cell) { | 2487 elements_kind_(elements_kind), |
2494 elements_kind_ = static_cast<ElementsKind>( | 2488 type_cell_(type_cell) {} |
2495 Smi::cast(type_cell->value())->value()); | 2489 |
2496 } | 2490 virtual void PrintDataTo(StringStream* stream); |
2497 | 2491 |
2498 Handle<Cell> property_cell() const { | 2492 Handle<Cell> property_cell() const { |
2499 return type_cell_; | 2493 return type_cell_; |
2500 } | 2494 } |
2501 | 2495 |
2502 ElementsKind elements_kind() const { return elements_kind_; } | 2496 ElementsKind elements_kind() const { return elements_kind_; } |
2503 | 2497 |
2504 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) | 2498 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) |
2505 | 2499 |
2506 private: | 2500 private: |
(...skipping 23 matching lines...) Expand all Loading... |
2530 } | 2524 } |
2531 | 2525 |
2532 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 2526 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
2533 | 2527 |
2534 private: | 2528 private: |
2535 const Runtime::Function* c_function_; | 2529 const Runtime::Function* c_function_; |
2536 Handle<String> name_; | 2530 Handle<String> name_; |
2537 }; | 2531 }; |
2538 | 2532 |
2539 | 2533 |
2540 class HFixedArrayBaseLength: public HUnaryOperation { | |
2541 public: | |
2542 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { | |
2543 set_type(HType::Smi()); | |
2544 set_representation(Representation::Smi()); | |
2545 SetFlag(kUseGVN); | |
2546 SetGVNFlag(kDependsOnArrayLengths); | |
2547 } | |
2548 | |
2549 virtual Representation RequiredInputRepresentation(int index) { | |
2550 return Representation::Tagged(); | |
2551 } | |
2552 | |
2553 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) | |
2554 | |
2555 protected: | |
2556 virtual bool DataEquals(HValue* other) { return true; } | |
2557 | |
2558 private: | |
2559 virtual bool IsDeletable() const { return true; } | |
2560 }; | |
2561 | |
2562 | |
2563 class HMapEnumLength: public HUnaryOperation { | 2534 class HMapEnumLength: public HUnaryOperation { |
2564 public: | 2535 public: |
2565 explicit HMapEnumLength(HValue* value) : HUnaryOperation(value) { | 2536 explicit HMapEnumLength(HValue* value) : HUnaryOperation(value) { |
2566 set_type(HType::Smi()); | 2537 set_type(HType::Smi()); |
2567 set_representation(Representation::Smi()); | 2538 set_representation(Representation::Smi()); |
2568 SetFlag(kUseGVN); | 2539 SetFlag(kUseGVN); |
2569 SetGVNFlag(kDependsOnMaps); | 2540 SetGVNFlag(kDependsOnMaps); |
2570 } | 2541 } |
2571 | 2542 |
2572 virtual Representation RequiredInputRepresentation(int index) { | 2543 virtual Representation RequiredInputRepresentation(int index) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2794 Map* transitioned_map = | 2765 Map* transitioned_map = |
2795 map->LookupElementsTransitionMap(kind); | 2766 map->LookupElementsTransitionMap(kind); |
2796 if (transitioned_map) { | 2767 if (transitioned_map) { |
2797 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone); | 2768 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone); |
2798 } | 2769 } |
2799 }; | 2770 }; |
2800 check_map->map_set_.Sort(); | 2771 check_map->map_set_.Sort(); |
2801 return check_map; | 2772 return check_map; |
2802 } | 2773 } |
2803 | 2774 |
| 2775 virtual bool HasEscapingOperandAt(int index) { return false; } |
2804 virtual Representation RequiredInputRepresentation(int index) { | 2776 virtual Representation RequiredInputRepresentation(int index) { |
2805 return Representation::Tagged(); | 2777 return Representation::Tagged(); |
2806 } | 2778 } |
2807 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator); | 2779 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator); |
2808 virtual void PrintDataTo(StringStream* stream); | 2780 virtual void PrintDataTo(StringStream* stream); |
2809 virtual HType CalculateInferredType(); | 2781 virtual HType CalculateInferredType(); |
2810 | 2782 |
2811 HValue* value() { return OperandAt(0); } | 2783 HValue* value() { return OperandAt(0); } |
2812 SmallMapList* map_set() { return &map_set_; } | 2784 SmallMapList* map_set() { return &map_set_; } |
2813 | 2785 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2859 SetFlag(kUseGVN); | 2831 SetFlag(kUseGVN); |
2860 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); | 2832 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); |
2861 } | 2833 } |
2862 | 2834 |
2863 virtual Representation RequiredInputRepresentation(int index) { | 2835 virtual Representation RequiredInputRepresentation(int index) { |
2864 return Representation::Tagged(); | 2836 return Representation::Tagged(); |
2865 } | 2837 } |
2866 virtual void PrintDataTo(StringStream* stream); | 2838 virtual void PrintDataTo(StringStream* stream); |
2867 virtual HType CalculateInferredType(); | 2839 virtual HType CalculateInferredType(); |
2868 | 2840 |
| 2841 virtual HValue* Canonicalize(); |
| 2842 |
2869 #ifdef DEBUG | 2843 #ifdef DEBUG |
2870 virtual void Verify(); | 2844 virtual void Verify(); |
2871 #endif | 2845 #endif |
2872 | 2846 |
2873 virtual void FinalizeUniqueValueId() { | 2847 virtual void FinalizeUniqueValueId() { |
2874 target_unique_id_ = UniqueValueId(target_); | 2848 target_unique_id_ = UniqueValueId(target_); |
2875 } | 2849 } |
2876 | 2850 |
2877 Handle<JSFunction> target() const { return target_; } | 2851 Handle<JSFunction> target() const { return target_; } |
2878 bool target_in_new_space() const { return target_in_new_space_; } | 2852 bool target_in_new_space() const { return target_in_new_space_; } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2945 HCheckInstanceType(HValue* value, Check check) | 2919 HCheckInstanceType(HValue* value, Check check) |
2946 : HUnaryOperation(value), check_(check) { | 2920 : HUnaryOperation(value), check_(check) { |
2947 set_representation(Representation::Tagged()); | 2921 set_representation(Representation::Tagged()); |
2948 SetFlag(kUseGVN); | 2922 SetFlag(kUseGVN); |
2949 } | 2923 } |
2950 | 2924 |
2951 const Check check_; | 2925 const Check check_; |
2952 }; | 2926 }; |
2953 | 2927 |
2954 | 2928 |
| 2929 class HCheckSmi: public HUnaryOperation { |
| 2930 public: |
| 2931 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
| 2932 set_representation(Representation::Smi()); |
| 2933 SetFlag(kUseGVN); |
| 2934 } |
| 2935 |
| 2936 virtual Representation RequiredInputRepresentation(int index) { |
| 2937 return Representation::Tagged(); |
| 2938 } |
| 2939 |
| 2940 virtual HType CalculateInferredType(); |
| 2941 |
| 2942 virtual HValue* Canonicalize() { |
| 2943 HType value_type = value()->type(); |
| 2944 if (value_type.IsSmi()) { |
| 2945 return NULL; |
| 2946 } |
| 2947 return this; |
| 2948 } |
| 2949 |
| 2950 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
| 2951 |
| 2952 protected: |
| 2953 virtual bool DataEquals(HValue* other) { return true; } |
| 2954 }; |
| 2955 |
| 2956 |
| 2957 class HIsNumberAndBranch: public HUnaryControlInstruction { |
| 2958 public: |
| 2959 explicit HIsNumberAndBranch(HValue* value) |
| 2960 : HUnaryControlInstruction(value, NULL, NULL) { |
| 2961 SetFlag(kFlexibleRepresentation); |
| 2962 } |
| 2963 |
| 2964 virtual Representation RequiredInputRepresentation(int index) { |
| 2965 return Representation::None(); |
| 2966 } |
| 2967 |
| 2968 DECLARE_CONCRETE_INSTRUCTION(IsNumberAndBranch) |
| 2969 }; |
| 2970 |
| 2971 |
2955 class HCheckHeapObject: public HUnaryOperation { | 2972 class HCheckHeapObject: public HUnaryOperation { |
2956 public: | 2973 public: |
2957 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { | 2974 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { |
2958 set_representation(Representation::Tagged()); | 2975 set_representation(Representation::Tagged()); |
2959 SetFlag(kUseGVN); | 2976 SetFlag(kUseGVN); |
2960 } | 2977 } |
2961 | 2978 |
2962 virtual Representation RequiredInputRepresentation(int index) { | 2979 virtual Representation RequiredInputRepresentation(int index) { |
2963 return Representation::Tagged(); | 2980 return Representation::Tagged(); |
2964 } | 2981 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3068 indirect_uses_[i] = 0; | 3085 indirect_uses_[i] = 0; |
3069 } | 3086 } |
3070 ASSERT(merged_index >= 0); | 3087 ASSERT(merged_index >= 0); |
3071 SetFlag(kFlexibleRepresentation); | 3088 SetFlag(kFlexibleRepresentation); |
3072 SetFlag(kAllowUndefinedAsNaN); | 3089 SetFlag(kAllowUndefinedAsNaN); |
3073 } | 3090 } |
3074 | 3091 |
3075 virtual Representation RepresentationFromInputs(); | 3092 virtual Representation RepresentationFromInputs(); |
3076 | 3093 |
3077 virtual Range* InferRange(Zone* zone); | 3094 virtual Range* InferRange(Zone* zone); |
3078 virtual void InferRepresentation(HInferRepresentation* h_infer); | 3095 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3079 virtual Representation RequiredInputRepresentation(int index) { | 3096 virtual Representation RequiredInputRepresentation(int index) { |
3080 return representation(); | 3097 return representation(); |
3081 } | 3098 } |
3082 virtual Representation KnownOptimalRepresentation() { | 3099 virtual Representation KnownOptimalRepresentation() { |
3083 return representation(); | 3100 return representation(); |
3084 } | 3101 } |
3085 virtual HType CalculateInferredType(); | 3102 virtual HType CalculateInferredType(); |
3086 virtual int OperandCount() { return inputs_.length(); } | 3103 virtual int OperandCount() { return inputs_.length(); } |
3087 virtual HValue* OperandAt(int index) const { return inputs_[index]; } | 3104 virtual HValue* OperandAt(int index) const { return inputs_[index]; } |
3088 HValue* GetRedundantReplacement(); | 3105 HValue* GetRedundantReplacement(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 int arguments_count() const { return values_.length(); } | 3238 int arguments_count() const { return values_.length(); } |
3222 | 3239 |
3223 void AddArgument(HValue* argument, Zone* zone) { | 3240 void AddArgument(HValue* argument, Zone* zone) { |
3224 values_.Add(NULL, zone); // Resize list. | 3241 values_.Add(NULL, zone); // Resize list. |
3225 SetOperandAt(values_.length() - 1, argument); | 3242 SetOperandAt(values_.length() - 1, argument); |
3226 } | 3243 } |
3227 | 3244 |
3228 virtual int OperandCount() { return values_.length(); } | 3245 virtual int OperandCount() { return values_.length(); } |
3229 virtual HValue* OperandAt(int index) const { return values_[index]; } | 3246 virtual HValue* OperandAt(int index) const { return values_[index]; } |
3230 | 3247 |
| 3248 virtual bool HasEscapingOperandAt(int index) { return false; } |
3231 virtual Representation RequiredInputRepresentation(int index) { | 3249 virtual Representation RequiredInputRepresentation(int index) { |
3232 return Representation::None(); | 3250 return Representation::None(); |
3233 } | 3251 } |
3234 | 3252 |
3235 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3253 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
3236 | 3254 |
3237 protected: | 3255 protected: |
3238 virtual void InternalSetOperandAt(int index, HValue* value) { | 3256 virtual void InternalSetOperandAt(int index, HValue* value) { |
3239 values_[index] = value; | 3257 values_[index] = value; |
3240 } | 3258 } |
(...skipping 15 matching lines...) Expand all Loading... |
3256 HConstant(double value, | 3274 HConstant(double value, |
3257 Representation r = Representation::None(), | 3275 Representation r = Representation::None(), |
3258 bool is_not_in_new_space = true, | 3276 bool is_not_in_new_space = true, |
3259 Handle<Object> optional_handle = Handle<Object>::null()); | 3277 Handle<Object> optional_handle = Handle<Object>::null()); |
3260 HConstant(Handle<Object> handle, | 3278 HConstant(Handle<Object> handle, |
3261 UniqueValueId unique_id, | 3279 UniqueValueId unique_id, |
3262 Representation r, | 3280 Representation r, |
3263 HType type, | 3281 HType type, |
3264 bool is_internalized_string, | 3282 bool is_internalized_string, |
3265 bool is_not_in_new_space, | 3283 bool is_not_in_new_space, |
| 3284 bool is_cell, |
3266 bool boolean_value); | 3285 bool boolean_value); |
3267 | 3286 |
3268 Handle<Object> handle() { | 3287 Handle<Object> handle() { |
3269 if (handle_.is_null()) { | 3288 if (handle_.is_null()) { |
3270 Factory* factory = Isolate::Current()->factory(); | 3289 Factory* factory = Isolate::Current()->factory(); |
3271 // Default arguments to is_not_in_new_space depend on this heap number | 3290 // Default arguments to is_not_in_new_space depend on this heap number |
3272 // to be tenured so that it's guaranteed not be be located in new space. | 3291 // to be tenured so that it's guaranteed not be be located in new space. |
3273 handle_ = factory->NewNumber(double_value_, TENURED); | 3292 handle_ = factory->NewNumber(double_value_, TENURED); |
3274 } | 3293 } |
3275 AllowDeferredHandleDereference smi_check; | 3294 AllowDeferredHandleDereference smi_check; |
(...skipping 28 matching lines...) Expand all Loading... |
3304 ASSERT(unique_id_ != UniqueValueId(heap->minus_zero_value())); | 3323 ASSERT(unique_id_ != UniqueValueId(heap->minus_zero_value())); |
3305 ASSERT(unique_id_ != UniqueValueId(heap->nan_value())); | 3324 ASSERT(unique_id_ != UniqueValueId(heap->nan_value())); |
3306 return unique_id_ == UniqueValueId(heap->undefined_value()) || | 3325 return unique_id_ == UniqueValueId(heap->undefined_value()) || |
3307 unique_id_ == UniqueValueId(heap->null_value()) || | 3326 unique_id_ == UniqueValueId(heap->null_value()) || |
3308 unique_id_ == UniqueValueId(heap->true_value()) || | 3327 unique_id_ == UniqueValueId(heap->true_value()) || |
3309 unique_id_ == UniqueValueId(heap->false_value()) || | 3328 unique_id_ == UniqueValueId(heap->false_value()) || |
3310 unique_id_ == UniqueValueId(heap->the_hole_value()) || | 3329 unique_id_ == UniqueValueId(heap->the_hole_value()) || |
3311 unique_id_ == UniqueValueId(heap->empty_string()); | 3330 unique_id_ == UniqueValueId(heap->empty_string()); |
3312 } | 3331 } |
3313 | 3332 |
| 3333 bool IsCell() const { |
| 3334 return is_cell_; |
| 3335 } |
| 3336 |
3314 virtual Representation RequiredInputRepresentation(int index) { | 3337 virtual Representation RequiredInputRepresentation(int index) { |
3315 return Representation::None(); | 3338 return Representation::None(); |
3316 } | 3339 } |
3317 | 3340 |
3318 virtual Representation KnownOptimalRepresentation() { | 3341 virtual Representation KnownOptimalRepresentation() { |
3319 if (HasSmiValue()) return Representation::Smi(); | 3342 if (HasSmiValue()) return Representation::Smi(); |
3320 if (HasInteger32Value()) return Representation::Integer32(); | 3343 if (HasInteger32Value()) return Representation::Integer32(); |
3321 if (HasNumberValue()) return Representation::Double(); | 3344 if (HasNumberValue()) return Representation::Double(); |
3322 return Representation::Tagged(); | 3345 return Representation::Tagged(); |
3323 } | 3346 } |
3324 | 3347 |
3325 virtual bool EmitAtUses() { return !representation().IsDouble(); } | 3348 virtual bool EmitAtUses(); |
3326 virtual void PrintDataTo(StringStream* stream); | 3349 virtual void PrintDataTo(StringStream* stream); |
3327 virtual HType CalculateInferredType(); | 3350 virtual HType CalculateInferredType(); |
3328 bool IsInteger() { return handle()->IsSmi(); } | 3351 bool IsInteger() { return handle()->IsSmi(); } |
3329 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3352 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
3330 HConstant* CopyToTruncatedInt32(Zone* zone) const; | 3353 HConstant* CopyToTruncatedInt32(Zone* zone) const; |
3331 bool HasInteger32Value() const { return has_int32_value_; } | 3354 bool HasInteger32Value() const { return has_int32_value_; } |
3332 int32_t Integer32Value() const { | 3355 int32_t Integer32Value() const { |
3333 ASSERT(HasInteger32Value()); | 3356 ASSERT(HasInteger32Value()); |
3334 return int32_value_; | 3357 return int32_value_; |
3335 } | 3358 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3383 } | 3406 } |
3384 } | 3407 } |
3385 | 3408 |
3386 virtual void FinalizeUniqueValueId() { | 3409 virtual void FinalizeUniqueValueId() { |
3387 if (!has_double_value_) { | 3410 if (!has_double_value_) { |
3388 ASSERT(!handle_.is_null()); | 3411 ASSERT(!handle_.is_null()); |
3389 unique_id_ = UniqueValueId(handle_); | 3412 unique_id_ = UniqueValueId(handle_); |
3390 } | 3413 } |
3391 } | 3414 } |
3392 | 3415 |
| 3416 bool UniqueValueIdsMatch(UniqueValueId other) { |
| 3417 if (!has_double_value_) return unique_id_ == other; |
| 3418 return false; |
| 3419 } |
| 3420 |
3393 #ifdef DEBUG | 3421 #ifdef DEBUG |
3394 virtual void Verify() { } | 3422 virtual void Verify() { } |
3395 #endif | 3423 #endif |
3396 | 3424 |
3397 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3425 DECLARE_CONCRETE_INSTRUCTION(Constant) |
3398 | 3426 |
3399 protected: | 3427 protected: |
3400 virtual Range* InferRange(Zone* zone); | 3428 virtual Range* InferRange(Zone* zone); |
3401 | 3429 |
3402 virtual bool DataEquals(HValue* other) { | 3430 virtual bool DataEquals(HValue* other) { |
(...skipping 27 matching lines...) Expand all Loading... |
3430 // We store the HConstant in the most specific form safely possible. | 3458 // We store the HConstant in the most specific form safely possible. |
3431 // The two flags, has_int32_value_ and has_double_value_ tell us if | 3459 // The two flags, has_int32_value_ and has_double_value_ tell us if |
3432 // int32_value_ and double_value_ hold valid, safe representations | 3460 // int32_value_ and double_value_ hold valid, safe representations |
3433 // of the constant. has_int32_value_ implies has_double_value_ but | 3461 // of the constant. has_int32_value_ implies has_double_value_ but |
3434 // not the converse. | 3462 // not the converse. |
3435 bool has_smi_value_ : 1; | 3463 bool has_smi_value_ : 1; |
3436 bool has_int32_value_ : 1; | 3464 bool has_int32_value_ : 1; |
3437 bool has_double_value_ : 1; | 3465 bool has_double_value_ : 1; |
3438 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. | 3466 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. |
3439 bool is_not_in_new_space_ : 1; | 3467 bool is_not_in_new_space_ : 1; |
| 3468 bool is_cell_ : 1; |
3440 bool boolean_value_ : 1; | 3469 bool boolean_value_ : 1; |
3441 int32_t int32_value_; | 3470 int32_t int32_value_; |
3442 double double_value_; | 3471 double double_value_; |
3443 HType type_from_value_; | 3472 HType type_from_value_; |
3444 }; | 3473 }; |
3445 | 3474 |
3446 | 3475 |
3447 class HBinaryOperation: public HTemplateInstruction<3> { | 3476 class HBinaryOperation: public HTemplateInstruction<3> { |
3448 public: | 3477 public: |
3449 HBinaryOperation(HValue* context, HValue* left, HValue* right) | 3478 HBinaryOperation(HValue* context, HValue* left, HValue* right) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3490 | 3519 |
3491 virtual void initialize_output_representation(Representation observed) { | 3520 virtual void initialize_output_representation(Representation observed) { |
3492 observed_output_representation_ = observed; | 3521 observed_output_representation_ = observed; |
3493 } | 3522 } |
3494 | 3523 |
3495 virtual Representation observed_input_representation(int index) { | 3524 virtual Representation observed_input_representation(int index) { |
3496 if (index == 0) return Representation::Tagged(); | 3525 if (index == 0) return Representation::Tagged(); |
3497 return observed_input_representation_[index - 1]; | 3526 return observed_input_representation_[index - 1]; |
3498 } | 3527 } |
3499 | 3528 |
3500 virtual void InferRepresentation(HInferRepresentation* h_infer); | 3529 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3501 virtual Representation RepresentationFromInputs(); | 3530 virtual Representation RepresentationFromInputs(); |
3502 virtual void AssumeRepresentation(Representation r); | 3531 virtual void AssumeRepresentation(Representation r); |
3503 | 3532 |
3504 virtual void UpdateRepresentation(Representation new_rep, | 3533 virtual void UpdateRepresentation(Representation new_rep, |
3505 HInferRepresentation* h_infer, | 3534 HInferRepresentationPhase* h_infer, |
3506 const char* reason) { | 3535 const char* reason) { |
3507 // By default, binary operations don't handle Smis. | 3536 // By default, binary operations don't handle Smis. |
3508 if (new_rep.IsSmi()) { | 3537 if (new_rep.IsSmi()) { |
3509 new_rep = Representation::Integer32(); | 3538 new_rep = Representation::Integer32(); |
3510 } | 3539 } |
3511 HValue::UpdateRepresentation(new_rep, h_infer, reason); | 3540 HValue::UpdateRepresentation(new_rep, h_infer, reason); |
3512 } | 3541 } |
3513 | 3542 |
3514 virtual bool IsCommutative() const { return false; } | 3543 virtual bool IsCommutative() const { return false; } |
3515 | 3544 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3707 virtual Representation RequiredInputRepresentation(int arg_index) { | 3736 virtual Representation RequiredInputRepresentation(int arg_index) { |
3708 return representation(); | 3737 return representation(); |
3709 } | 3738 } |
3710 | 3739 |
3711 virtual bool IsRelationTrueInternal(NumericRelation relation, | 3740 virtual bool IsRelationTrueInternal(NumericRelation relation, |
3712 HValue* related_value, | 3741 HValue* related_value, |
3713 int offset = 0, | 3742 int offset = 0, |
3714 int scale = 0); | 3743 int scale = 0); |
3715 | 3744 |
3716 virtual void PrintDataTo(StringStream* stream); | 3745 virtual void PrintDataTo(StringStream* stream); |
3717 virtual void InferRepresentation(HInferRepresentation* h_infer); | 3746 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3718 | 3747 |
3719 HValue* index() { return OperandAt(0); } | 3748 HValue* index() { return OperandAt(0); } |
3720 HValue* length() { return OperandAt(1); } | 3749 HValue* length() { return OperandAt(1); } |
3721 | 3750 |
3722 virtual int RedefinedOperandIndex() { return 0; } | 3751 virtual int RedefinedOperandIndex() { return 0; } |
3723 virtual bool IsPurelyInformativeDefinition() { return skip_check(); } | 3752 virtual bool IsPurelyInformativeDefinition() { return skip_check(); } |
3724 virtual void AddInformativeDefinitions(); | 3753 virtual void AddInformativeDefinitions(); |
3725 | 3754 |
3726 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 3755 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
3727 | 3756 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3804 ASSERT(to.IsInteger32()); | 3833 ASSERT(to.IsInteger32()); |
3805 ClearAllSideEffects(); | 3834 ClearAllSideEffects(); |
3806 SetFlag(kUseGVN); | 3835 SetFlag(kUseGVN); |
3807 } else { | 3836 } else { |
3808 SetAllSideEffects(); | 3837 SetAllSideEffects(); |
3809 ClearFlag(kUseGVN); | 3838 ClearFlag(kUseGVN); |
3810 } | 3839 } |
3811 } | 3840 } |
3812 | 3841 |
3813 virtual void UpdateRepresentation(Representation new_rep, | 3842 virtual void UpdateRepresentation(Representation new_rep, |
3814 HInferRepresentation* h_infer, | 3843 HInferRepresentationPhase* h_infer, |
3815 const char* reason) { | 3844 const char* reason) { |
3816 // We only generate either int32 or generic tagged bitwise operations. | 3845 // We only generate either int32 or generic tagged bitwise operations. |
3817 if (new_rep.IsSmi() || new_rep.IsDouble()) { | 3846 if (new_rep.IsSmi() || new_rep.IsDouble()) { |
3818 new_rep = Representation::Integer32(); | 3847 new_rep = Representation::Integer32(); |
3819 } | 3848 } |
3820 HValue::UpdateRepresentation(new_rep, h_infer, reason); | 3849 HValue::UpdateRepresentation(new_rep, h_infer, reason); |
3821 } | 3850 } |
3822 | 3851 |
3823 virtual void initialize_output_representation(Representation observed) { | 3852 virtual void initialize_output_representation(Representation observed) { |
3824 if (observed.IsDouble()) observed = Representation::Integer32(); | 3853 if (observed.IsDouble()) observed = Representation::Integer32(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3919 | 3948 |
3920 virtual HType CalculateInferredType(); | 3949 virtual HType CalculateInferredType(); |
3921 | 3950 |
3922 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 3951 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
3923 | 3952 |
3924 private: | 3953 private: |
3925 Token::Value token_; | 3954 Token::Value token_; |
3926 }; | 3955 }; |
3927 | 3956 |
3928 | 3957 |
3929 class HCompareIDAndBranch: public HTemplateControlInstruction<2, 2> { | 3958 class HCompareNumericAndBranch: public HTemplateControlInstruction<2, 2> { |
3930 public: | 3959 public: |
3931 HCompareIDAndBranch(HValue* left, HValue* right, Token::Value token) | 3960 HCompareNumericAndBranch(HValue* left, HValue* right, Token::Value token) |
3932 : token_(token) { | 3961 : token_(token) { |
3933 SetFlag(kFlexibleRepresentation); | 3962 SetFlag(kFlexibleRepresentation); |
3934 ASSERT(Token::IsCompareOp(token)); | 3963 ASSERT(Token::IsCompareOp(token)); |
3935 SetOperandAt(0, left); | 3964 SetOperandAt(0, left); |
3936 SetOperandAt(1, right); | 3965 SetOperandAt(1, right); |
3937 } | 3966 } |
3938 | 3967 |
3939 HValue* left() { return OperandAt(0); } | 3968 HValue* left() { return OperandAt(0); } |
3940 HValue* right() { return OperandAt(1); } | 3969 HValue* right() { return OperandAt(1); } |
3941 Token::Value token() const { return token_; } | 3970 Token::Value token() const { return token_; } |
3942 | 3971 |
3943 void set_observed_input_representation(Representation left, | 3972 void set_observed_input_representation(Representation left, |
3944 Representation right) { | 3973 Representation right) { |
3945 observed_input_representation_[0] = left; | 3974 observed_input_representation_[0] = left; |
3946 observed_input_representation_[1] = right; | 3975 observed_input_representation_[1] = right; |
3947 } | 3976 } |
3948 | 3977 |
3949 virtual void InferRepresentation(HInferRepresentation* h_infer); | 3978 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3950 | 3979 |
3951 virtual Representation RequiredInputRepresentation(int index) { | 3980 virtual Representation RequiredInputRepresentation(int index) { |
3952 return representation(); | 3981 return representation(); |
3953 } | 3982 } |
3954 virtual Representation observed_input_representation(int index) { | 3983 virtual Representation observed_input_representation(int index) { |
3955 return observed_input_representation_[index]; | 3984 return observed_input_representation_[index]; |
3956 } | 3985 } |
3957 virtual void PrintDataTo(StringStream* stream); | 3986 virtual void PrintDataTo(StringStream* stream); |
3958 | 3987 |
3959 virtual void AddInformativeDefinitions(); | 3988 virtual void AddInformativeDefinitions(); |
3960 | 3989 |
3961 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) | 3990 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) |
3962 | 3991 |
3963 private: | 3992 private: |
3964 Representation observed_input_representation_[2]; | 3993 Representation observed_input_representation_[2]; |
3965 Token::Value token_; | 3994 Token::Value token_; |
3966 }; | 3995 }; |
3967 | 3996 |
3968 | 3997 |
3969 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { | 3998 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
3970 public: | 3999 public: |
3971 HCompareObjectEqAndBranch(HValue* left, HValue* right) { | 4000 HCompareObjectEqAndBranch(HValue* left, HValue* right) { |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4556 | 4585 |
4557 virtual Representation RequiredInputRepresentation(int index) { | 4586 virtual Representation RequiredInputRepresentation(int index) { |
4558 return index == 0 ? Representation::Tagged() | 4587 return index == 0 ? Representation::Tagged() |
4559 : representation(); | 4588 : representation(); |
4560 } | 4589 } |
4561 | 4590 |
4562 virtual Representation observed_input_representation(int index) { | 4591 virtual Representation observed_input_representation(int index) { |
4563 return RequiredInputRepresentation(index); | 4592 return RequiredInputRepresentation(index); |
4564 } | 4593 } |
4565 | 4594 |
4566 virtual void InferRepresentation(HInferRepresentation* h_infer); | 4595 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
4567 | 4596 |
4568 virtual Representation RepresentationFromInputs() { | 4597 virtual Representation RepresentationFromInputs() { |
4569 Representation left_rep = left()->representation(); | 4598 Representation left_rep = left()->representation(); |
4570 Representation right_rep = right()->representation(); | 4599 Representation right_rep = right()->representation(); |
4571 if ((left_rep.IsNone() || left_rep.IsInteger32()) && | 4600 if ((left_rep.IsNone() || left_rep.IsInteger32()) && |
4572 (right_rep.IsNone() || right_rep.IsInteger32())) { | 4601 (right_rep.IsNone() || right_rep.IsInteger32())) { |
4573 return Representation::Integer32(); | 4602 return Representation::Integer32(); |
4574 } | 4603 } |
4575 return Representation::Double(); | 4604 return Representation::Double(); |
4576 } | 4605 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4728 | 4757 |
4729 protected: | 4758 protected: |
4730 virtual bool DataEquals(HValue* other) { return true; } | 4759 virtual bool DataEquals(HValue* other) { return true; } |
4731 }; | 4760 }; |
4732 | 4761 |
4733 | 4762 |
4734 class HOsrEntry: public HTemplateInstruction<0> { | 4763 class HOsrEntry: public HTemplateInstruction<0> { |
4735 public: | 4764 public: |
4736 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { | 4765 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { |
4737 SetGVNFlag(kChangesOsrEntries); | 4766 SetGVNFlag(kChangesOsrEntries); |
| 4767 SetGVNFlag(kChangesNewSpacePromotion); |
4738 } | 4768 } |
4739 | 4769 |
4740 BailoutId ast_id() const { return ast_id_; } | 4770 BailoutId ast_id() const { return ast_id_; } |
4741 | 4771 |
4742 virtual Representation RequiredInputRepresentation(int index) { | 4772 virtual Representation RequiredInputRepresentation(int index) { |
4743 return Representation::None(); | 4773 return Representation::None(); |
4744 } | 4774 } |
4745 | 4775 |
4746 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) | 4776 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
4747 | 4777 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5082 } | 5112 } |
5083 | 5113 |
5084 | 5114 |
5085 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, | 5115 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, |
5086 HValue* new_space_dominator) { | 5116 HValue* new_space_dominator) { |
5087 if (object->IsInnerAllocatedObject()) { | 5117 if (object->IsInnerAllocatedObject()) { |
5088 return ReceiverObjectNeedsWriteBarrier( | 5118 return ReceiverObjectNeedsWriteBarrier( |
5089 HInnerAllocatedObject::cast(object)->base_object(), | 5119 HInnerAllocatedObject::cast(object)->base_object(), |
5090 new_space_dominator); | 5120 new_space_dominator); |
5091 } | 5121 } |
| 5122 if (object->IsConstant() && HConstant::cast(object)->IsCell()) { |
| 5123 return false; |
| 5124 } |
5092 if (object != new_space_dominator) return true; | 5125 if (object != new_space_dominator) return true; |
5093 if (object->IsAllocateObject()) return false; | 5126 if (object->IsAllocateObject()) return false; |
5094 if (object->IsAllocate()) { | 5127 if (object->IsAllocate()) { |
5095 return !HAllocate::cast(object)->GuaranteedInNewSpace(); | 5128 return !HAllocate::cast(object)->GuaranteedInNewSpace(); |
5096 } | 5129 } |
5097 return true; | 5130 return true; |
5098 } | 5131 } |
5099 | 5132 |
5100 | 5133 |
5101 class HStoreGlobalCell: public HUnaryOperation { | 5134 class HStoreGlobalCell: public HUnaryOperation { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5307 } | 5340 } |
5308 | 5341 |
5309 static HObjectAccess ForElementsPointer() { | 5342 static HObjectAccess ForElementsPointer() { |
5310 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); | 5343 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); |
5311 } | 5344 } |
5312 | 5345 |
5313 static HObjectAccess ForArrayLength() { | 5346 static HObjectAccess ForArrayLength() { |
5314 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); | 5347 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); |
5315 } | 5348 } |
5316 | 5349 |
| 5350 static HObjectAccess ForAllocationSitePayload() { |
| 5351 return HObjectAccess(kInobject, AllocationSite::kPayloadOffset); |
| 5352 } |
| 5353 |
5317 static HObjectAccess ForFixedArrayLength() { | 5354 static HObjectAccess ForFixedArrayLength() { |
5318 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); | 5355 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); |
5319 } | 5356 } |
5320 | 5357 |
5321 static HObjectAccess ForPropertiesPointer() { | 5358 static HObjectAccess ForPropertiesPointer() { |
5322 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); | 5359 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); |
5323 } | 5360 } |
5324 | 5361 |
5325 static HObjectAccess ForPrototypeOrInitialMap() { | 5362 static HObjectAccess ForPrototypeOrInitialMap() { |
5326 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); | 5363 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); |
5327 } | 5364 } |
5328 | 5365 |
5329 static HObjectAccess ForMap() { | 5366 static HObjectAccess ForMap() { |
5330 return HObjectAccess(kMaps, JSObject::kMapOffset); | 5367 return HObjectAccess(kMaps, JSObject::kMapOffset); |
5331 } | 5368 } |
5332 | 5369 |
5333 static HObjectAccess ForAllocationSitePayload() { | 5370 static HObjectAccess ForPropertyCellValue() { |
5334 return HObjectAccess(kInobject, AllocationSiteInfo::kPayloadOffset); | 5371 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
| 5372 } |
| 5373 |
| 5374 static HObjectAccess ForCellValue() { |
| 5375 return HObjectAccess(kInobject, Cell::kValueOffset); |
| 5376 } |
| 5377 |
| 5378 static HObjectAccess ForAllocationSiteInfoSite() { |
| 5379 return HObjectAccess(kInobject, AllocationSiteInfo::kAllocationSiteOffset); |
5335 } | 5380 } |
5336 | 5381 |
5337 // Create an access to an offset in a fixed array header. | 5382 // Create an access to an offset in a fixed array header. |
5338 static HObjectAccess ForFixedArrayHeader(int offset); | 5383 static HObjectAccess ForFixedArrayHeader(int offset); |
5339 | 5384 |
5340 // Create an access to an in-object property in a JSObject. | 5385 // Create an access to an in-object property in a JSObject. |
5341 static HObjectAccess ForJSObjectOffset(int offset); | 5386 static HObjectAccess ForJSObjectOffset(int offset); |
5342 | 5387 |
5343 // Create an access to an in-object property in a JSArray. | 5388 // Create an access to an in-object property in a JSArray. |
5344 static HObjectAccess ForJSArrayOffset(int offset); | 5389 static HObjectAccess ForJSArrayOffset(int offset); |
5345 | 5390 |
5346 // Create an access to the backing store of an object. | 5391 // Create an access to the backing store of an object. |
5347 static HObjectAccess ForBackingStoreOffset(int offset); | 5392 static HObjectAccess ForBackingStoreOffset(int offset); |
5348 | 5393 |
5349 // Create an access to a resolved field (in-object or backing store). | 5394 // Create an access to a resolved field (in-object or backing store). |
5350 static HObjectAccess ForField(Handle<Map> map, | 5395 static HObjectAccess ForField(Handle<Map> map, |
5351 LookupResult *lookup, Handle<String> name = Handle<String>::null()); | 5396 LookupResult *lookup, Handle<String> name = Handle<String>::null()); |
5352 | 5397 |
| 5398 // Create an access for the payload of a Cell or JSGlobalPropertyCell. |
| 5399 static HObjectAccess ForCellPayload(Isolate* isolate); |
| 5400 |
5353 void PrintTo(StringStream* stream); | 5401 void PrintTo(StringStream* stream); |
5354 | 5402 |
5355 inline bool Equals(HObjectAccess that) const { | 5403 inline bool Equals(HObjectAccess that) const { |
5356 return value_ == that.value_; // portion and offset must match | 5404 return value_ == that.value_; // portion and offset must match |
5357 } | 5405 } |
5358 | 5406 |
5359 protected: | 5407 protected: |
5360 void SetGVNFlags(HValue *instr, bool is_store); | 5408 void SetGVNFlags(HValue *instr, bool is_store); |
5361 | 5409 |
5362 private: | 5410 private: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5424 HValue* object() { return OperandAt(0); } | 5472 HValue* object() { return OperandAt(0); } |
5425 HValue* typecheck() { | 5473 HValue* typecheck() { |
5426 ASSERT(HasTypeCheck()); | 5474 ASSERT(HasTypeCheck()); |
5427 return OperandAt(1); | 5475 return OperandAt(1); |
5428 } | 5476 } |
5429 | 5477 |
5430 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } | 5478 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } |
5431 HObjectAccess access() const { return access_; } | 5479 HObjectAccess access() const { return access_; } |
5432 Representation field_representation() const { return representation_; } | 5480 Representation field_representation() const { return representation_; } |
5433 | 5481 |
| 5482 virtual bool HasEscapingOperandAt(int index) { return false; } |
5434 virtual Representation RequiredInputRepresentation(int index) { | 5483 virtual Representation RequiredInputRepresentation(int index) { |
5435 return Representation::Tagged(); | 5484 return Representation::Tagged(); |
5436 } | 5485 } |
5437 virtual void PrintDataTo(StringStream* stream); | 5486 virtual void PrintDataTo(StringStream* stream); |
5438 | 5487 |
5439 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 5488 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
5440 | 5489 |
5441 protected: | 5490 protected: |
5442 virtual bool DataEquals(HValue* other) { | 5491 virtual bool DataEquals(HValue* other) { |
5443 HLoadNamedField* b = HLoadNamedField::cast(other); | 5492 HLoadNamedField* b = HLoadNamedField::cast(other); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5748 public: | 5797 public: |
5749 HStoreNamedField(HValue* obj, | 5798 HStoreNamedField(HValue* obj, |
5750 HObjectAccess access, | 5799 HObjectAccess access, |
5751 HValue* val, | 5800 HValue* val, |
5752 Representation field_representation | 5801 Representation field_representation |
5753 = Representation::Tagged()) | 5802 = Representation::Tagged()) |
5754 : access_(access), | 5803 : access_(access), |
5755 field_representation_(field_representation), | 5804 field_representation_(field_representation), |
5756 transition_(), | 5805 transition_(), |
5757 transition_unique_id_(), | 5806 transition_unique_id_(), |
5758 new_space_dominator_(NULL) { | 5807 new_space_dominator_(NULL), |
| 5808 write_barrier_mode_(UPDATE_WRITE_BARRIER) { |
5759 SetOperandAt(0, obj); | 5809 SetOperandAt(0, obj); |
5760 SetOperandAt(1, val); | 5810 SetOperandAt(1, val); |
5761 access.SetGVNFlags(this, true); | 5811 access.SetGVNFlags(this, true); |
5762 } | 5812 } |
5763 | 5813 |
5764 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 5814 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
5765 | 5815 |
| 5816 virtual bool HasEscapingOperandAt(int index) { return index == 1; } |
5766 virtual Representation RequiredInputRepresentation(int index) { | 5817 virtual Representation RequiredInputRepresentation(int index) { |
5767 if (FLAG_track_double_fields && | 5818 if (FLAG_track_double_fields && |
5768 index == 1 && field_representation_.IsDouble()) { | 5819 index == 1 && field_representation_.IsDouble()) { |
5769 return field_representation_; | 5820 return field_representation_; |
5770 } else if (FLAG_track_fields && | 5821 } else if (FLAG_track_fields && |
5771 index == 1 && field_representation_.IsSmi()) { | 5822 index == 1 && field_representation_.IsSmi()) { |
5772 return field_representation_; | 5823 return field_representation_; |
5773 } | 5824 } |
5774 return Representation::Tagged(); | 5825 return Representation::Tagged(); |
5775 } | 5826 } |
5776 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 5827 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5777 ASSERT(side_effect == kChangesNewSpacePromotion); | 5828 ASSERT(side_effect == kChangesNewSpacePromotion); |
5778 new_space_dominator_ = dominator; | 5829 new_space_dominator_ = dominator; |
5779 } | 5830 } |
5780 virtual void PrintDataTo(StringStream* stream); | 5831 virtual void PrintDataTo(StringStream* stream); |
5781 | 5832 |
| 5833 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } |
| 5834 bool IsSkipWriteBarrier() const { |
| 5835 return write_barrier_mode_ == SKIP_WRITE_BARRIER; |
| 5836 } |
| 5837 |
5782 HValue* object() { return OperandAt(0); } | 5838 HValue* object() { return OperandAt(0); } |
5783 HValue* value() { return OperandAt(1); } | 5839 HValue* value() { return OperandAt(1); } |
5784 | 5840 |
5785 HObjectAccess access() const { return access_; } | 5841 HObjectAccess access() const { return access_; } |
5786 Handle<Map> transition() const { return transition_; } | 5842 Handle<Map> transition() const { return transition_; } |
5787 UniqueValueId transition_unique_id() const { return transition_unique_id_; } | 5843 UniqueValueId transition_unique_id() const { return transition_unique_id_; } |
5788 void SetTransition(Handle<Map> map, CompilationInfo* info) { | 5844 void SetTransition(Handle<Map> map, CompilationInfo* info) { |
5789 ASSERT(transition_.is_null()); // Only set once. | 5845 ASSERT(transition_.is_null()); // Only set once. |
5790 if (map->CanBeDeprecated()) { | 5846 if (map->CanBeDeprecated()) { |
5791 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); | 5847 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); |
5792 } | 5848 } |
5793 transition_ = map; | 5849 transition_ = map; |
5794 } | 5850 } |
5795 HValue* new_space_dominator() const { return new_space_dominator_; } | 5851 HValue* new_space_dominator() const { return new_space_dominator_; } |
5796 | 5852 |
5797 bool NeedsWriteBarrier() { | 5853 bool NeedsWriteBarrier() { |
5798 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || | 5854 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || |
5799 transition_.is_null()); | 5855 transition_.is_null()); |
| 5856 if (IsSkipWriteBarrier()) return false; |
5800 return (!FLAG_track_fields || !field_representation_.IsSmi()) && | 5857 return (!FLAG_track_fields || !field_representation_.IsSmi()) && |
5801 // If there is a transition, a new storage object needs to be allocated. | 5858 // If there is a transition, a new storage object needs to be allocated. |
5802 !(FLAG_track_double_fields && field_representation_.IsDouble()) && | 5859 !(FLAG_track_double_fields && field_representation_.IsDouble()) && |
5803 StoringValueNeedsWriteBarrier(value()) && | 5860 StoringValueNeedsWriteBarrier(value()) && |
5804 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5861 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5805 } | 5862 } |
5806 | 5863 |
5807 bool NeedsWriteBarrierForMap() { | 5864 bool NeedsWriteBarrierForMap() { |
| 5865 if (IsSkipWriteBarrier()) return false; |
5808 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5866 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5809 } | 5867 } |
5810 | 5868 |
5811 virtual void FinalizeUniqueValueId() { | 5869 virtual void FinalizeUniqueValueId() { |
5812 transition_unique_id_ = UniqueValueId(transition_); | 5870 transition_unique_id_ = UniqueValueId(transition_); |
5813 } | 5871 } |
5814 | 5872 |
5815 Representation field_representation() const { | 5873 Representation field_representation() const { |
5816 return field_representation_; | 5874 return field_representation_; |
5817 } | 5875 } |
5818 | 5876 |
5819 private: | 5877 private: |
5820 HObjectAccess access_; | 5878 HObjectAccess access_; |
5821 Representation field_representation_; | 5879 Representation field_representation_; |
5822 Handle<Map> transition_; | 5880 Handle<Map> transition_; |
5823 UniqueValueId transition_unique_id_; | 5881 UniqueValueId transition_unique_id_; |
5824 HValue* new_space_dominator_; | 5882 HValue* new_space_dominator_; |
| 5883 WriteBarrierMode write_barrier_mode_; |
5825 }; | 5884 }; |
5826 | 5885 |
5827 | 5886 |
5828 class HStoreNamedGeneric: public HTemplateInstruction<3> { | 5887 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
5829 public: | 5888 public: |
5830 HStoreNamedGeneric(HValue* context, | 5889 HStoreNamedGeneric(HValue* context, |
5831 HValue* object, | 5890 HValue* object, |
5832 Handle<String> name, | 5891 Handle<String> name, |
5833 HValue* value, | 5892 HValue* value, |
5834 StrictModeFlag strict_mode_flag) | 5893 StrictModeFlag strict_mode_flag) |
(...skipping 26 matching lines...) Expand all Loading... |
5861 | 5920 |
5862 | 5921 |
5863 class HStoreKeyed | 5922 class HStoreKeyed |
5864 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 5923 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
5865 public: | 5924 public: |
5866 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 5925 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
5867 ElementsKind elements_kind) | 5926 ElementsKind elements_kind) |
5868 : elements_kind_(elements_kind), | 5927 : elements_kind_(elements_kind), |
5869 index_offset_(0), | 5928 index_offset_(0), |
5870 is_dehoisted_(false), | 5929 is_dehoisted_(false), |
| 5930 is_uninitialized_(false), |
5871 new_space_dominator_(NULL) { | 5931 new_space_dominator_(NULL) { |
5872 SetOperandAt(0, obj); | 5932 SetOperandAt(0, obj); |
5873 SetOperandAt(1, key); | 5933 SetOperandAt(1, key); |
5874 SetOperandAt(2, val); | 5934 SetOperandAt(2, val); |
5875 | 5935 |
5876 if (IsFastObjectElementsKind(elements_kind)) { | 5936 if (IsFastObjectElementsKind(elements_kind)) { |
5877 SetFlag(kTrackSideEffectDominators); | 5937 SetFlag(kTrackSideEffectDominators); |
5878 SetGVNFlag(kDependsOnNewSpacePromotion); | 5938 SetGVNFlag(kDependsOnNewSpacePromotion); |
5879 } | 5939 } |
5880 if (is_external()) { | 5940 if (is_external()) { |
5881 SetGVNFlag(kChangesSpecializedArrayElements); | 5941 SetGVNFlag(kChangesSpecializedArrayElements); |
5882 SetFlag(kAllowUndefinedAsNaN); | 5942 SetFlag(kAllowUndefinedAsNaN); |
5883 } else if (IsFastDoubleElementsKind(elements_kind)) { | 5943 } else if (IsFastDoubleElementsKind(elements_kind)) { |
5884 SetGVNFlag(kChangesDoubleArrayElements); | 5944 SetGVNFlag(kChangesDoubleArrayElements); |
5885 } else if (IsFastSmiElementsKind(elements_kind)) { | 5945 } else if (IsFastSmiElementsKind(elements_kind)) { |
5886 SetGVNFlag(kChangesArrayElements); | 5946 SetGVNFlag(kChangesArrayElements); |
5887 } else { | 5947 } else { |
5888 SetGVNFlag(kChangesArrayElements); | 5948 SetGVNFlag(kChangesArrayElements); |
5889 } | 5949 } |
5890 | 5950 |
5891 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 5951 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
5892 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 5952 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
5893 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 5953 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
5894 SetFlag(kTruncatingToInt32); | 5954 SetFlag(kTruncatingToInt32); |
5895 } | 5955 } |
5896 } | 5956 } |
5897 | 5957 |
| 5958 virtual bool HasEscapingOperandAt(int index) { return index != 0; } |
5898 virtual Representation RequiredInputRepresentation(int index) { | 5959 virtual Representation RequiredInputRepresentation(int index) { |
5899 // kind_fast: tagged[int32] = tagged | 5960 // kind_fast: tagged[int32] = tagged |
5900 // kind_double: tagged[int32] = double | 5961 // kind_double: tagged[int32] = double |
5901 // kind_smi : tagged[int32] = smi | 5962 // kind_smi : tagged[int32] = smi |
5902 // kind_external: external[int32] = (double | int32) | 5963 // kind_external: external[int32] = (double | int32) |
5903 if (index == 0) { | 5964 if (index == 0) { |
5904 return is_external() ? Representation::External() | 5965 return is_external() ? Representation::External() |
5905 : Representation::Tagged(); | 5966 : Representation::Tagged(); |
5906 } else if (index == 1) { | 5967 } else if (index == 1) { |
5907 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 5968 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
(...skipping 12 matching lines...) Expand all Loading... |
5920 return is_external() ? Representation::Integer32() | 5981 return is_external() ? Representation::Integer32() |
5921 : Representation::Tagged(); | 5982 : Representation::Tagged(); |
5922 } | 5983 } |
5923 | 5984 |
5924 bool is_external() const { | 5985 bool is_external() const { |
5925 return IsExternalArrayElementsKind(elements_kind()); | 5986 return IsExternalArrayElementsKind(elements_kind()); |
5926 } | 5987 } |
5927 | 5988 |
5928 virtual Representation observed_input_representation(int index) { | 5989 virtual Representation observed_input_representation(int index) { |
5929 if (index < 2) return RequiredInputRepresentation(index); | 5990 if (index < 2) return RequiredInputRepresentation(index); |
| 5991 if (IsUninitialized()) { |
| 5992 return Representation::None(); |
| 5993 } |
5930 if (IsFastSmiElementsKind(elements_kind())) { | 5994 if (IsFastSmiElementsKind(elements_kind())) { |
5931 return Representation::Smi(); | 5995 return Representation::Smi(); |
5932 } | 5996 } |
5933 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 5997 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
5934 return Representation::Double(); | 5998 return Representation::Double(); |
5935 } | 5999 } |
5936 if (is_external()) { | 6000 if (is_external()) { |
5937 return Representation::Integer32(); | 6001 return Representation::Integer32(); |
5938 } | 6002 } |
5939 // For fast object elements kinds, don't assume anything. | 6003 // For fast object elements kinds, don't assume anything. |
5940 return Representation::None(); | 6004 return Representation::None(); |
5941 } | 6005 } |
5942 | 6006 |
5943 HValue* elements() { return OperandAt(0); } | 6007 HValue* elements() { return OperandAt(0); } |
5944 HValue* key() { return OperandAt(1); } | 6008 HValue* key() { return OperandAt(1); } |
5945 HValue* value() { return OperandAt(2); } | 6009 HValue* value() { return OperandAt(2); } |
5946 bool value_is_smi() const { | 6010 bool value_is_smi() const { |
5947 return IsFastSmiElementsKind(elements_kind_); | 6011 return IsFastSmiElementsKind(elements_kind_); |
5948 } | 6012 } |
5949 ElementsKind elements_kind() const { return elements_kind_; } | 6013 ElementsKind elements_kind() const { return elements_kind_; } |
5950 uint32_t index_offset() { return index_offset_; } | 6014 uint32_t index_offset() { return index_offset_; } |
5951 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } | 6015 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } |
5952 HValue* GetKey() { return key(); } | 6016 HValue* GetKey() { return key(); } |
5953 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6017 void SetKey(HValue* key) { SetOperandAt(1, key); } |
5954 bool IsDehoisted() { return is_dehoisted_; } | 6018 bool IsDehoisted() { return is_dehoisted_; } |
5955 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6019 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
| 6020 bool IsUninitialized() { return is_uninitialized_; } |
| 6021 void SetUninitialized(bool is_uninitialized) { |
| 6022 is_uninitialized_ = is_uninitialized; |
| 6023 } |
5956 | 6024 |
5957 bool IsConstantHoleStore() { | 6025 bool IsConstantHoleStore() { |
5958 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 6026 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
5959 } | 6027 } |
5960 | 6028 |
5961 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 6029 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5962 ASSERT(side_effect == kChangesNewSpacePromotion); | 6030 ASSERT(side_effect == kChangesNewSpacePromotion); |
5963 new_space_dominator_ = dominator; | 6031 new_space_dominator_ = dominator; |
5964 } | 6032 } |
5965 | 6033 |
(...skipping 10 matching lines...) Expand all Loading... |
5976 | 6044 |
5977 bool NeedsCanonicalization(); | 6045 bool NeedsCanonicalization(); |
5978 | 6046 |
5979 virtual void PrintDataTo(StringStream* stream); | 6047 virtual void PrintDataTo(StringStream* stream); |
5980 | 6048 |
5981 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6049 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
5982 | 6050 |
5983 private: | 6051 private: |
5984 ElementsKind elements_kind_; | 6052 ElementsKind elements_kind_; |
5985 uint32_t index_offset_; | 6053 uint32_t index_offset_; |
5986 bool is_dehoisted_; | 6054 bool is_dehoisted_ : 1; |
| 6055 bool is_uninitialized_ : 1; |
5987 HValue* new_space_dominator_; | 6056 HValue* new_space_dominator_; |
5988 }; | 6057 }; |
5989 | 6058 |
5990 | 6059 |
5991 class HStoreKeyedGeneric: public HTemplateInstruction<4> { | 6060 class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
5992 public: | 6061 public: |
5993 HStoreKeyedGeneric(HValue* context, | 6062 HStoreKeyedGeneric(HValue* context, |
5994 HValue* object, | 6063 HValue* object, |
5995 HValue* key, | 6064 HValue* key, |
5996 HValue* value, | 6065 HValue* value, |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6641 virtual bool IsDeletable() const { return true; } | 6710 virtual bool IsDeletable() const { return true; } |
6642 }; | 6711 }; |
6643 | 6712 |
6644 | 6713 |
6645 #undef DECLARE_INSTRUCTION | 6714 #undef DECLARE_INSTRUCTION |
6646 #undef DECLARE_CONCRETE_INSTRUCTION | 6715 #undef DECLARE_CONCRETE_INSTRUCTION |
6647 | 6716 |
6648 } } // namespace v8::internal | 6717 } } // namespace v8::internal |
6649 | 6718 |
6650 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6719 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |