| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // HSar | 69 // HSar |
| 70 // HShl | 70 // HShl |
| 71 // HShr | 71 // HShr |
| 72 // HBoundsCheck | 72 // HBoundsCheck |
| 73 // HCompare | 73 // HCompare |
| 74 // HCompareJSObjectEq | 74 // HCompareJSObjectEq |
| 75 // HInstanceOf | 75 // HInstanceOf |
| 76 // HLoadKeyed | 76 // HLoadKeyed |
| 77 // HLoadKeyedFastElement | 77 // HLoadKeyedFastElement |
| 78 // HLoadKeyedGeneric | 78 // HLoadKeyedGeneric |
| 79 // HLoadNamedGeneric | |
| 80 // HPower | 79 // HPower |
| 81 // HStoreNamed | 80 // HStoreNamed |
| 82 // HStoreNamedField | 81 // HStoreNamedField |
| 83 // HStoreNamedGeneric | 82 // HStoreNamedGeneric |
| 84 // HBlockEntry | 83 // HBlockEntry |
| 85 // HCall | 84 // HCall |
| 86 // HCallConstantFunction | 85 // HCallConstantFunction |
| 87 // HCallFunction | 86 // HCallFunction |
| 88 // HCallGlobal | 87 // HCallGlobal |
| 89 // HCallKeyed | 88 // HCallKeyed |
| (...skipping 22 matching lines...) Expand all Loading... |
| 112 // HObjectLiteral | 111 // HObjectLiteral |
| 113 // HRegExpLiteral | 112 // HRegExpLiteral |
| 114 // HOsrEntry | 113 // HOsrEntry |
| 115 // HParameter | 114 // HParameter |
| 116 // HSimulate | 115 // HSimulate |
| 117 // HStackCheck | 116 // HStackCheck |
| 118 // HStoreKeyed | 117 // HStoreKeyed |
| 119 // HStoreKeyedFastElement | 118 // HStoreKeyedFastElement |
| 120 // HStoreKeyedGeneric | 119 // HStoreKeyedGeneric |
| 121 // HUnaryOperation | 120 // HUnaryOperation |
| 122 // HArrayLength | |
| 123 // HBitNot | 121 // HBitNot |
| 124 // HChange | 122 // HChange |
| 125 // HCheckFunction | 123 // HCheckFunction |
| 126 // HCheckInstanceType | 124 // HCheckInstanceType |
| 127 // HCheckMap | 125 // HCheckMap |
| 128 // HCheckNonSmi | 126 // HCheckNonSmi |
| 129 // HCheckPrototypeMaps | 127 // HCheckPrototypeMaps |
| 130 // HCheckSmi | 128 // HCheckSmi |
| 131 // HDeleteProperty | 129 // HDeleteProperty |
| 130 // HFixedArrayLength |
| 131 // HJSArrayLength |
| 132 // HLoadElements | 132 // HLoadElements |
| 133 // HTypeofIs | 133 // HTypeofIs |
| 134 // HLoadNamedField | 134 // HLoadNamedField |
| 135 // HLoadNamedGeneric |
| 136 // HLoadFunctionPrototype |
| 135 // HPushArgument | 137 // HPushArgument |
| 136 // HTypeof | 138 // HTypeof |
| 137 // HUnaryMathOperation | 139 // HUnaryMathOperation |
| 138 // HUnaryPredicate | 140 // HUnaryPredicate |
| 139 // HClassOfTest | 141 // HClassOfTest |
| 140 // HHasCachedArrayIndex | 142 // HHasCachedArrayIndex |
| 141 // HHasInstanceType | 143 // HHasInstanceType |
| 142 // HIsNull | 144 // HIsNull |
| 143 // HIsObject | 145 // HIsObject |
| 144 // HIsSmi | 146 // HIsSmi |
| (...skipping 18 matching lines...) Expand all Loading... |
| 163 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) | 165 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) |
| 164 | 166 |
| 165 | 167 |
| 166 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ | 168 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ |
| 167 V(AccessArgumentsAt) \ | 169 V(AccessArgumentsAt) \ |
| 168 V(Add) \ | 170 V(Add) \ |
| 169 V(ApplyArguments) \ | 171 V(ApplyArguments) \ |
| 170 V(ArgumentsElements) \ | 172 V(ArgumentsElements) \ |
| 171 V(ArgumentsLength) \ | 173 V(ArgumentsLength) \ |
| 172 V(ArgumentsObject) \ | 174 V(ArgumentsObject) \ |
| 173 V(ArrayLength) \ | |
| 174 V(ArrayLiteral) \ | 175 V(ArrayLiteral) \ |
| 175 V(BitAnd) \ | 176 V(BitAnd) \ |
| 176 V(BitNot) \ | 177 V(BitNot) \ |
| 177 V(BitOr) \ | 178 V(BitOr) \ |
| 178 V(BitXor) \ | 179 V(BitXor) \ |
| 179 V(BlockEntry) \ | 180 V(BlockEntry) \ |
| 180 V(BoundsCheck) \ | 181 V(BoundsCheck) \ |
| 181 V(Branch) \ | 182 V(Branch) \ |
| 182 V(CallConstantFunction) \ | 183 V(CallConstantFunction) \ |
| 183 V(CallFunction) \ | 184 V(CallFunction) \ |
| (...skipping 12 matching lines...) Expand all Loading... |
| 196 V(CheckPrototypeMaps) \ | 197 V(CheckPrototypeMaps) \ |
| 197 V(CheckSmi) \ | 198 V(CheckSmi) \ |
| 198 V(Compare) \ | 199 V(Compare) \ |
| 199 V(CompareJSObjectEq) \ | 200 V(CompareJSObjectEq) \ |
| 200 V(CompareMapAndBranch) \ | 201 V(CompareMapAndBranch) \ |
| 201 V(Constant) \ | 202 V(Constant) \ |
| 202 V(DeleteProperty) \ | 203 V(DeleteProperty) \ |
| 203 V(Deoptimize) \ | 204 V(Deoptimize) \ |
| 204 V(Div) \ | 205 V(Div) \ |
| 205 V(EnterInlined) \ | 206 V(EnterInlined) \ |
| 207 V(FixedArrayLength) \ |
| 206 V(FunctionLiteral) \ | 208 V(FunctionLiteral) \ |
| 207 V(GlobalObject) \ | 209 V(GlobalObject) \ |
| 208 V(GlobalReceiver) \ | 210 V(GlobalReceiver) \ |
| 209 V(Goto) \ | 211 V(Goto) \ |
| 210 V(InstanceOf) \ | 212 V(InstanceOf) \ |
| 211 V(IsNull) \ | 213 V(IsNull) \ |
| 212 V(IsObject) \ | 214 V(IsObject) \ |
| 213 V(IsSmi) \ | 215 V(IsSmi) \ |
| 214 V(HasInstanceType) \ | 216 V(HasInstanceType) \ |
| 215 V(HasCachedArrayIndex) \ | 217 V(HasCachedArrayIndex) \ |
| 218 V(JSArrayLength) \ |
| 216 V(ClassOfTest) \ | 219 V(ClassOfTest) \ |
| 217 V(LeaveInlined) \ | 220 V(LeaveInlined) \ |
| 218 V(LoadElements) \ | 221 V(LoadElements) \ |
| 219 V(LoadGlobal) \ | 222 V(LoadGlobal) \ |
| 220 V(LoadKeyedFastElement) \ | 223 V(LoadKeyedFastElement) \ |
| 221 V(LoadKeyedGeneric) \ | 224 V(LoadKeyedGeneric) \ |
| 222 V(LoadNamedField) \ | 225 V(LoadNamedField) \ |
| 223 V(LoadNamedGeneric) \ | 226 V(LoadNamedGeneric) \ |
| 227 V(LoadFunctionPrototype) \ |
| 224 V(Mod) \ | 228 V(Mod) \ |
| 225 V(Mul) \ | 229 V(Mul) \ |
| 226 V(ObjectLiteral) \ | 230 V(ObjectLiteral) \ |
| 227 V(OsrEntry) \ | 231 V(OsrEntry) \ |
| 228 V(Parameter) \ | 232 V(Parameter) \ |
| 229 V(Power) \ | 233 V(Power) \ |
| 230 V(PushArgument) \ | 234 V(PushArgument) \ |
| 231 V(RegExpLiteral) \ | 235 V(RegExpLiteral) \ |
| 232 V(Return) \ | 236 V(Return) \ |
| 233 V(Sar) \ | 237 V(Sar) \ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 249 V(ValueOf) | 253 V(ValueOf) |
| 250 | 254 |
| 251 #define GVN_FLAG_LIST(V) \ | 255 #define GVN_FLAG_LIST(V) \ |
| 252 V(Calls) \ | 256 V(Calls) \ |
| 253 V(InobjectFields) \ | 257 V(InobjectFields) \ |
| 254 V(BackingStoreFields) \ | 258 V(BackingStoreFields) \ |
| 255 V(ArrayElements) \ | 259 V(ArrayElements) \ |
| 256 V(GlobalVars) \ | 260 V(GlobalVars) \ |
| 257 V(Maps) \ | 261 V(Maps) \ |
| 258 V(ArrayLengths) \ | 262 V(ArrayLengths) \ |
| 263 V(FunctionPrototypes) \ |
| 259 V(OsrEntries) | 264 V(OsrEntries) |
| 260 | 265 |
| 261 #define DECLARE_INSTRUCTION(type) \ | 266 #define DECLARE_INSTRUCTION(type) \ |
| 262 virtual bool Is##type() const { return true; } \ | 267 virtual bool Is##type() const { return true; } \ |
| 263 static H##type* cast(HValue* value) { \ | 268 static H##type* cast(HValue* value) { \ |
| 264 ASSERT(value->Is##type()); \ | 269 ASSERT(value->Is##type()); \ |
| 265 return reinterpret_cast<H##type*>(value); \ | 270 return reinterpret_cast<H##type*>(value); \ |
| 266 } \ | 271 } \ |
| 267 Opcode opcode() const { return HValue::k##type; } | 272 Opcode opcode() const { return HValue::k##type; } |
| 268 | 273 |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 true_destination_(true_destination), | 903 true_destination_(true_destination), |
| 899 false_destination_(false_destination) { | 904 false_destination_(false_destination) { |
| 900 ASSERT(true_destination != NULL); | 905 ASSERT(true_destination != NULL); |
| 901 ASSERT(false_destination != NULL); | 906 ASSERT(false_destination != NULL); |
| 902 ASSERT(!map.is_null()); | 907 ASSERT(!map.is_null()); |
| 903 } | 908 } |
| 904 | 909 |
| 905 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } | 910 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } |
| 906 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; } | 911 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; } |
| 907 | 912 |
| 913 HBasicBlock* true_destination() const { return true_destination_; } |
| 914 HBasicBlock* false_destination() const { return false_destination_; } |
| 915 |
| 908 virtual void PrintDataTo(StringStream* stream) const; | 916 virtual void PrintDataTo(StringStream* stream) const; |
| 909 | 917 |
| 910 Handle<Map> map() const { return map_; } | 918 Handle<Map> map() const { return map_; } |
| 911 | 919 |
| 912 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") | 920 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") |
| 913 | 921 |
| 914 private: | 922 private: |
| 915 Handle<Map> map_; | 923 Handle<Map> map_; |
| 916 HBasicBlock* true_destination_; | 924 HBasicBlock* true_destination_; |
| 917 HBasicBlock* false_destination_; | 925 HBasicBlock* false_destination_; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 } | 1016 } |
| 1009 | 1017 |
| 1010 private: | 1018 private: |
| 1011 Representation from_; | 1019 Representation from_; |
| 1012 Representation to_; | 1020 Representation to_; |
| 1013 }; | 1021 }; |
| 1014 | 1022 |
| 1015 | 1023 |
| 1016 class HSimulate: public HInstruction { | 1024 class HSimulate: public HInstruction { |
| 1017 public: | 1025 public: |
| 1018 HSimulate(int ast_id, int pop_count, int environment_height) | 1026 HSimulate(int ast_id, int pop_count, int environment_length) |
| 1019 : ast_id_(ast_id), | 1027 : ast_id_(ast_id), |
| 1020 pop_count_(pop_count), | 1028 pop_count_(pop_count), |
| 1021 environment_height_(environment_height), | 1029 environment_length_(environment_length), |
| 1022 values_(2), | 1030 values_(2), |
| 1023 assigned_indexes_(2) {} | 1031 assigned_indexes_(2) {} |
| 1024 virtual ~HSimulate() {} | 1032 virtual ~HSimulate() {} |
| 1025 | 1033 |
| 1026 virtual void PrintDataTo(StringStream* stream) const; | 1034 virtual void PrintDataTo(StringStream* stream) const; |
| 1027 | 1035 |
| 1028 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } | 1036 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } |
| 1029 int ast_id() const { return ast_id_; } | 1037 int ast_id() const { return ast_id_; } |
| 1030 void set_ast_id(int id) { | 1038 void set_ast_id(int id) { |
| 1031 ASSERT(!HasAstId()); | 1039 ASSERT(!HasAstId()); |
| 1032 ast_id_ = id; | 1040 ast_id_ = id; |
| 1033 } | 1041 } |
| 1034 | 1042 |
| 1035 int environment_height() const { return environment_height_; } | 1043 int environment_length() const { return environment_length_; } |
| 1036 int pop_count() const { return pop_count_; } | 1044 int pop_count() const { return pop_count_; } |
| 1037 const ZoneList<HValue*>* values() const { return &values_; } | 1045 const ZoneList<HValue*>* values() const { return &values_; } |
| 1038 int GetAssignedIndexAt(int index) const { | 1046 int GetAssignedIndexAt(int index) const { |
| 1039 ASSERT(HasAssignedIndexAt(index)); | 1047 ASSERT(HasAssignedIndexAt(index)); |
| 1040 return assigned_indexes_[index]; | 1048 return assigned_indexes_[index]; |
| 1041 } | 1049 } |
| 1042 bool HasAssignedIndexAt(int index) const { | 1050 bool HasAssignedIndexAt(int index) const { |
| 1043 return assigned_indexes_[index] != kNoIndex; | 1051 return assigned_indexes_[index] != kNoIndex; |
| 1044 } | 1052 } |
| 1045 void AddAssignedValue(int index, HValue* value) { | 1053 void AddAssignedValue(int index, HValue* value) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1067 void AddValue(int index, HValue* value) { | 1075 void AddValue(int index, HValue* value) { |
| 1068 assigned_indexes_.Add(index); | 1076 assigned_indexes_.Add(index); |
| 1069 // Resize the list of pushed values. | 1077 // Resize the list of pushed values. |
| 1070 values_.Add(NULL); | 1078 values_.Add(NULL); |
| 1071 // Set the operand through the base method in HValue to make sure that the | 1079 // Set the operand through the base method in HValue to make sure that the |
| 1072 // use lists are correctly updated. | 1080 // use lists are correctly updated. |
| 1073 SetOperandAt(values_.length() - 1, value); | 1081 SetOperandAt(values_.length() - 1, value); |
| 1074 } | 1082 } |
| 1075 int ast_id_; | 1083 int ast_id_; |
| 1076 int pop_count_; | 1084 int pop_count_; |
| 1077 int environment_height_; | 1085 int environment_length_; |
| 1078 ZoneList<HValue*> values_; | 1086 ZoneList<HValue*> values_; |
| 1079 ZoneList<int> assigned_indexes_; | 1087 ZoneList<int> assigned_indexes_; |
| 1080 }; | 1088 }; |
| 1081 | 1089 |
| 1082 | 1090 |
| 1083 class HStackCheck: public HInstruction { | 1091 class HStackCheck: public HInstruction { |
| 1084 public: | 1092 public: |
| 1085 HStackCheck() { } | 1093 HStackCheck() { } |
| 1086 | 1094 |
| 1087 DECLARE_CONCRETE_INSTRUCTION(Throw, "stack_check") | 1095 DECLARE_CONCRETE_INSTRUCTION(Throw, "stack_check") |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 Handle<String> name() const { return name_; } | 1337 Handle<String> name() const { return name_; } |
| 1330 | 1338 |
| 1331 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") | 1339 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") |
| 1332 | 1340 |
| 1333 private: | 1341 private: |
| 1334 Runtime::Function* c_function_; | 1342 Runtime::Function* c_function_; |
| 1335 Handle<String> name_; | 1343 Handle<String> name_; |
| 1336 }; | 1344 }; |
| 1337 | 1345 |
| 1338 | 1346 |
| 1339 class HArrayLength: public HUnaryOperation { | 1347 class HJSArrayLength: public HUnaryOperation { |
| 1340 public: | 1348 public: |
| 1341 explicit HArrayLength(HValue* value) : HUnaryOperation(value) { | 1349 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { |
| 1342 // The length of an array is stored as a tagged value in the array | 1350 // The length of an array is stored as a tagged value in the array |
| 1343 // object. It is guaranteed to be 32 bit integer, but it can be | 1351 // object. It is guaranteed to be 32 bit integer, but it can be |
| 1344 // represented as either a smi or heap number. | 1352 // represented as either a smi or heap number. |
| 1345 set_representation(Representation::Tagged()); | 1353 set_representation(Representation::Tagged()); |
| 1346 SetFlag(kDependsOnArrayLengths); | 1354 SetFlag(kDependsOnArrayLengths); |
| 1347 SetFlag(kUseGVN); | 1355 SetFlag(kUseGVN); |
| 1348 } | 1356 } |
| 1349 | 1357 |
| 1350 virtual Representation RequiredInputRepresentation(int index) const { | 1358 virtual Representation RequiredInputRepresentation(int index) const { |
| 1351 return Representation::Tagged(); | 1359 return Representation::Tagged(); |
| 1352 } | 1360 } |
| 1353 | 1361 |
| 1354 DECLARE_CONCRETE_INSTRUCTION(ArrayLength, "array_length") | 1362 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") |
| 1363 }; |
| 1364 |
| 1365 |
| 1366 class HFixedArrayLength: public HUnaryOperation { |
| 1367 public: |
| 1368 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { |
| 1369 set_representation(Representation::Tagged()); |
| 1370 SetFlag(kDependsOnArrayLengths); |
| 1371 SetFlag(kUseGVN); |
| 1372 } |
| 1373 |
| 1374 virtual Representation RequiredInputRepresentation(int index) const { |
| 1375 return Representation::Tagged(); |
| 1376 } |
| 1377 |
| 1378 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") |
| 1355 }; | 1379 }; |
| 1356 | 1380 |
| 1357 | 1381 |
| 1358 class HBitNot: public HUnaryOperation { | 1382 class HBitNot: public HUnaryOperation { |
| 1359 public: | 1383 public: |
| 1360 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 1384 explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
| 1361 set_representation(Representation::Integer32()); | 1385 set_representation(Representation::Integer32()); |
| 1362 SetFlag(kUseGVN); | 1386 SetFlag(kUseGVN); |
| 1363 SetFlag(kTruncatingToInt32); | 1387 SetFlag(kTruncatingToInt32); |
| 1364 } | 1388 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1759 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") | 1783 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") |
| 1760 }; | 1784 }; |
| 1761 | 1785 |
| 1762 | 1786 |
| 1763 class HConstant: public HInstruction { | 1787 class HConstant: public HInstruction { |
| 1764 public: | 1788 public: |
| 1765 HConstant(Handle<Object> handle, Representation r); | 1789 HConstant(Handle<Object> handle, Representation r); |
| 1766 | 1790 |
| 1767 Handle<Object> handle() const { return handle_; } | 1791 Handle<Object> handle() const { return handle_; } |
| 1768 | 1792 |
| 1793 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); } |
| 1794 |
| 1769 virtual bool EmitAtUses() const { return !representation().IsDouble(); } | 1795 virtual bool EmitAtUses() const { return !representation().IsDouble(); } |
| 1770 virtual void PrintDataTo(StringStream* stream) const; | 1796 virtual void PrintDataTo(StringStream* stream) const; |
| 1771 virtual HType CalculateInferredType() const; | 1797 virtual HType CalculateInferredType() const; |
| 1772 bool IsInteger() const { return handle_->IsSmi(); } | 1798 bool IsInteger() const { return handle_->IsSmi(); } |
| 1773 HConstant* CopyToRepresentation(Representation r) const; | 1799 HConstant* CopyToRepresentation(Representation r) const; |
| 1774 HConstant* CopyToTruncatedInt32() const; | 1800 HConstant* CopyToTruncatedInt32() const; |
| 1775 bool HasInteger32Value() const { return has_int32_value_; } | 1801 bool HasInteger32Value() const { return has_int32_value_; } |
| 1776 int32_t Integer32Value() const { | 1802 int32_t Integer32Value() const { |
| 1777 ASSERT(HasInteger32Value()); | 1803 ASSERT(HasInteger32Value()); |
| 1778 return int32_value_; | 1804 return int32_value_; |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2610 virtual bool DataEquals(HValue* other) const { | 2636 virtual bool DataEquals(HValue* other) const { |
| 2611 HLoadNamedGeneric* b = HLoadNamedGeneric::cast(other); | 2637 HLoadNamedGeneric* b = HLoadNamedGeneric::cast(other); |
| 2612 return name_.is_identical_to(b->name_); | 2638 return name_.is_identical_to(b->name_); |
| 2613 } | 2639 } |
| 2614 | 2640 |
| 2615 private: | 2641 private: |
| 2616 Handle<Object> name_; | 2642 Handle<Object> name_; |
| 2617 }; | 2643 }; |
| 2618 | 2644 |
| 2619 | 2645 |
| 2646 class HLoadFunctionPrototype: public HUnaryOperation { |
| 2647 public: |
| 2648 explicit HLoadFunctionPrototype(HValue* function) |
| 2649 : HUnaryOperation(function) { |
| 2650 set_representation(Representation::Tagged()); |
| 2651 SetFlagMask(kDependsOnFunctionPrototypes); |
| 2652 } |
| 2653 |
| 2654 HValue* function() const { return OperandAt(0); } |
| 2655 |
| 2656 virtual Representation RequiredInputRepresentation(int index) const { |
| 2657 return Representation::Tagged(); |
| 2658 } |
| 2659 |
| 2660 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") |
| 2661 |
| 2662 protected: |
| 2663 virtual bool DataEquals(HValue* other) const { return true; } |
| 2664 }; |
| 2665 |
| 2666 |
| 2620 class HLoadKeyed: public HBinaryOperation { | 2667 class HLoadKeyed: public HBinaryOperation { |
| 2621 public: | 2668 public: |
| 2622 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { | 2669 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { |
| 2623 set_representation(Representation::Tagged()); | 2670 set_representation(Representation::Tagged()); |
| 2624 } | 2671 } |
| 2625 | 2672 |
| 2626 virtual void PrintDataTo(StringStream* stream) const; | 2673 virtual void PrintDataTo(StringStream* stream) const; |
| 2627 | 2674 |
| 2628 virtual Representation RequiredInputRepresentation(int index) const { | 2675 virtual Representation RequiredInputRepresentation(int index) const { |
| 2629 return Representation::Tagged(); | 2676 return Representation::Tagged(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2656 class HLoadKeyedGeneric: public HLoadKeyed { | 2703 class HLoadKeyedGeneric: public HLoadKeyed { |
| 2657 public: | 2704 public: |
| 2658 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { | 2705 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { |
| 2659 SetFlagMask(AllSideEffects()); | 2706 SetFlagMask(AllSideEffects()); |
| 2660 } | 2707 } |
| 2661 | 2708 |
| 2662 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") | 2709 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") |
| 2663 }; | 2710 }; |
| 2664 | 2711 |
| 2665 | 2712 |
| 2713 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
| 2714 return !value->type().IsSmi() && |
| 2715 !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); |
| 2716 } |
| 2717 |
| 2718 |
| 2666 class HStoreNamed: public HBinaryOperation { | 2719 class HStoreNamed: public HBinaryOperation { |
| 2667 public: | 2720 public: |
| 2668 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val) | 2721 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val) |
| 2669 : HBinaryOperation(obj, val), name_(name) { | 2722 : HBinaryOperation(obj, val), name_(name) { |
| 2670 } | 2723 } |
| 2671 | 2724 |
| 2672 virtual Representation RequiredInputRepresentation(int index) const { | 2725 virtual Representation RequiredInputRepresentation(int index) const { |
| 2673 return Representation::Tagged(); | 2726 return Representation::Tagged(); |
| 2674 } | 2727 } |
| 2675 | 2728 |
| 2676 virtual void PrintDataTo(StringStream* stream) const; | 2729 virtual void PrintDataTo(StringStream* stream) const; |
| 2677 | 2730 |
| 2678 HValue* object() const { return OperandAt(0); } | 2731 HValue* object() const { return OperandAt(0); } |
| 2679 Handle<Object> name() const { return name_; } | 2732 Handle<Object> name() const { return name_; } |
| 2680 HValue* value() const { return OperandAt(1); } | 2733 HValue* value() const { return OperandAt(1); } |
| 2681 void set_value(HValue* value) { SetOperandAt(1, value); } | 2734 void set_value(HValue* value) { SetOperandAt(1, value); } |
| 2682 | 2735 |
| 2736 bool NeedsWriteBarrier() const { |
| 2737 return StoringValueNeedsWriteBarrier(value()); |
| 2738 } |
| 2739 |
| 2683 DECLARE_INSTRUCTION(StoreNamed) | 2740 DECLARE_INSTRUCTION(StoreNamed) |
| 2684 | 2741 |
| 2685 protected: | 2742 protected: |
| 2686 virtual bool DataEquals(HValue* other) const { | 2743 virtual bool DataEquals(HValue* other) const { |
| 2687 HStoreNamed* b = HStoreNamed::cast(other); | 2744 HStoreNamed* b = HStoreNamed::cast(other); |
| 2688 return name_.is_identical_to(b->name_); | 2745 return name_.is_identical_to(b->name_); |
| 2689 } | 2746 } |
| 2690 | 2747 |
| 2691 private: | 2748 private: |
| 2692 Handle<Object> name_; | 2749 Handle<Object> name_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2753 virtual HValue* OperandAt(int index) const { return operands_[index]; } | 2810 virtual HValue* OperandAt(int index) const { return operands_[index]; } |
| 2754 | 2811 |
| 2755 virtual Representation RequiredInputRepresentation(int index) const { | 2812 virtual Representation RequiredInputRepresentation(int index) const { |
| 2756 return Representation::Tagged(); | 2813 return Representation::Tagged(); |
| 2757 } | 2814 } |
| 2758 | 2815 |
| 2759 HValue* object() const { return OperandAt(0); } | 2816 HValue* object() const { return OperandAt(0); } |
| 2760 HValue* key() const { return OperandAt(1); } | 2817 HValue* key() const { return OperandAt(1); } |
| 2761 HValue* value() const { return OperandAt(2); } | 2818 HValue* value() const { return OperandAt(2); } |
| 2762 | 2819 |
| 2820 bool NeedsWriteBarrier() const { |
| 2821 return StoringValueNeedsWriteBarrier(value()); |
| 2822 } |
| 2823 |
| 2763 DECLARE_INSTRUCTION(StoreKeyed) | 2824 DECLARE_INSTRUCTION(StoreKeyed) |
| 2764 | 2825 |
| 2765 protected: | 2826 protected: |
| 2766 virtual void InternalSetOperandAt(int index, HValue* value) { | 2827 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 2767 operands_[index] = value; | 2828 operands_[index] = value; |
| 2768 } | 2829 } |
| 2769 | 2830 |
| 2770 private: | 2831 private: |
| 2771 HOperandVector<3> operands_; | 2832 HOperandVector<3> operands_; |
| 2772 }; | 2833 }; |
| 2773 | 2834 |
| 2774 | 2835 |
| 2775 class HStoreKeyedFastElement: public HStoreKeyed { | 2836 class HStoreKeyedFastElement: public HStoreKeyed { |
| 2776 public: | 2837 public: |
| 2777 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) | 2838 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) |
| 2778 : HStoreKeyed(obj, key, val) { | 2839 : HStoreKeyed(obj, key, val) { |
| 2779 SetFlag(kChangesArrayElements); | 2840 SetFlag(kChangesArrayElements); |
| 2780 } | 2841 } |
| 2781 | 2842 |
| 2782 bool NeedsWriteBarrier() const { | |
| 2783 return !value()->type().IsSmi(); | |
| 2784 } | |
| 2785 | |
| 2786 virtual Representation RequiredInputRepresentation(int index) const { | 2843 virtual Representation RequiredInputRepresentation(int index) const { |
| 2787 // The key is supposed to be Integer32. | 2844 // The key is supposed to be Integer32. |
| 2788 return (index == 1) ? Representation::Integer32() | 2845 return (index == 1) ? Representation::Integer32() |
| 2789 : Representation::Tagged(); | 2846 : Representation::Tagged(); |
| 2790 } | 2847 } |
| 2791 | 2848 |
| 2792 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, | 2849 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, |
| 2793 "store_keyed_fast_element") | 2850 "store_keyed_fast_element") |
| 2794 }; | 2851 }; |
| 2795 | 2852 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2944 HValue* object() const { return left(); } | 3001 HValue* object() const { return left(); } |
| 2945 HValue* key() const { return right(); } | 3002 HValue* key() const { return right(); } |
| 2946 }; | 3003 }; |
| 2947 | 3004 |
| 2948 #undef DECLARE_INSTRUCTION | 3005 #undef DECLARE_INSTRUCTION |
| 2949 #undef DECLARE_CONCRETE_INSTRUCTION | 3006 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2950 | 3007 |
| 2951 } } // namespace v8::internal | 3008 } } // namespace v8::internal |
| 2952 | 3009 |
| 2953 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3010 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |