| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // HBitAnd | 66 // HBitAnd |
| 67 // HBitOr | 67 // HBitOr |
| 68 // HBitXor | 68 // HBitXor |
| 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 // HInstanceOfKnownGlobal |
| 76 // HLoadKeyed | 77 // HLoadKeyed |
| 77 // HLoadKeyedFastElement | 78 // HLoadKeyedFastElement |
| 78 // HLoadKeyedGeneric | 79 // HLoadKeyedGeneric |
| 79 // HLoadNamedGeneric | |
| 80 // HPower | 80 // HPower |
| 81 // HStoreNamed | 81 // HStoreNamed |
| 82 // HStoreNamedField | 82 // HStoreNamedField |
| 83 // HStoreNamedGeneric | 83 // HStoreNamedGeneric |
| 84 // HBlockEntry | 84 // HBlockEntry |
| 85 // HCall | 85 // HCall |
| 86 // HCallConstantFunction | 86 // HCallConstantFunction |
| 87 // HCallFunction | 87 // HCallFunction |
| 88 // HCallGlobal | 88 // HCallGlobal |
| 89 // HCallKeyed | 89 // HCallKeyed |
| 90 // HCallKnownGlobal | 90 // HCallKnownGlobal |
| 91 // HCallNamed | 91 // HCallNamed |
| 92 // HCallNew | 92 // HCallNew |
| 93 // HCallRuntime | 93 // HCallRuntime |
| 94 // HCallStub | 94 // HCallStub |
| 95 // HCheckPrototypeMaps |
| 95 // HConstant | 96 // HConstant |
| 96 // HControlInstruction | 97 // HControlInstruction |
| 97 // HDeoptimize | 98 // HDeoptimize |
| 98 // HGoto | 99 // HGoto |
| 99 // HUnaryControlInstruction | 100 // HUnaryControlInstruction |
| 100 // HBranch | 101 // HBranch |
| 101 // HCompareMapAndBranch | 102 // HCompareMapAndBranch |
| 102 // HReturn | 103 // HReturn |
| 103 // HThrow | 104 // HThrow |
| 104 // HEnterInlined | 105 // HEnterInlined |
| 105 // HFunctionLiteral | 106 // HFunctionLiteral |
| 106 // HGlobalObject | 107 // HGlobalObject |
| 107 // HGlobalReceiver | 108 // HGlobalReceiver |
| 108 // HLeaveInlined | 109 // HLeaveInlined |
| 109 // HLoadGlobal | 110 // HLoadGlobal |
| 110 // HMaterializedLiteral | 111 // HMaterializedLiteral |
| 111 // HArrayLiteral | 112 // HArrayLiteral |
| 112 // HObjectLiteral | 113 // HObjectLiteral |
| 113 // HRegExpLiteral | 114 // HRegExpLiteral |
| 114 // HOsrEntry | 115 // HOsrEntry |
| 115 // HParameter | 116 // HParameter |
| 116 // HSimulate | 117 // HSimulate |
| 117 // HStackCheck | 118 // HStackCheck |
| 118 // HStoreKeyed | 119 // HStoreKeyed |
| 119 // HStoreKeyedFastElement | 120 // HStoreKeyedFastElement |
| 120 // HStoreKeyedGeneric | 121 // HStoreKeyedGeneric |
| 121 // HUnaryOperation | 122 // HUnaryOperation |
| 122 // HArrayLength | |
| 123 // HBitNot | 123 // HBitNot |
| 124 // HChange | 124 // HChange |
| 125 // HCheckFunction | 125 // HCheckFunction |
| 126 // HCheckInstanceType | 126 // HCheckInstanceType |
| 127 // HCheckMap | 127 // HCheckMap |
| 128 // HCheckNonSmi | 128 // HCheckNonSmi |
| 129 // HCheckPrototypeMaps | |
| 130 // HCheckSmi | 129 // HCheckSmi |
| 131 // HDeleteProperty | 130 // HDeleteProperty |
| 131 // HFixedArrayLength |
| 132 // HJSArrayLength |
| 132 // HLoadElements | 133 // HLoadElements |
| 133 // HTypeofIs | 134 // HTypeofIs |
| 134 // HLoadNamedField | 135 // HLoadNamedField |
| 136 // HLoadNamedGeneric |
| 137 // HLoadFunctionPrototype |
| 135 // HPushArgument | 138 // HPushArgument |
| 136 // HTypeof | 139 // HTypeof |
| 137 // HUnaryMathOperation | 140 // HUnaryMathOperation |
| 138 // HUnaryPredicate | 141 // HUnaryPredicate |
| 139 // HClassOfTest | 142 // HClassOfTest |
| 140 // HHasCachedArrayIndex | 143 // HHasCachedArrayIndex |
| 141 // HHasInstanceType | 144 // HHasInstanceType |
| 142 // HIsNull | 145 // HIsNull |
| 143 // HIsObject | 146 // HIsObject |
| 144 // HIsSmi | 147 // HIsSmi |
| (...skipping 18 matching lines...) Expand all Loading... |
| 163 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) | 166 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) |
| 164 | 167 |
| 165 | 168 |
| 166 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ | 169 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ |
| 167 V(AccessArgumentsAt) \ | 170 V(AccessArgumentsAt) \ |
| 168 V(Add) \ | 171 V(Add) \ |
| 169 V(ApplyArguments) \ | 172 V(ApplyArguments) \ |
| 170 V(ArgumentsElements) \ | 173 V(ArgumentsElements) \ |
| 171 V(ArgumentsLength) \ | 174 V(ArgumentsLength) \ |
| 172 V(ArgumentsObject) \ | 175 V(ArgumentsObject) \ |
| 173 V(ArrayLength) \ | |
| 174 V(ArrayLiteral) \ | 176 V(ArrayLiteral) \ |
| 175 V(BitAnd) \ | 177 V(BitAnd) \ |
| 176 V(BitNot) \ | 178 V(BitNot) \ |
| 177 V(BitOr) \ | 179 V(BitOr) \ |
| 178 V(BitXor) \ | 180 V(BitXor) \ |
| 179 V(BlockEntry) \ | 181 V(BlockEntry) \ |
| 180 V(BoundsCheck) \ | 182 V(BoundsCheck) \ |
| 181 V(Branch) \ | 183 V(Branch) \ |
| 182 V(CallConstantFunction) \ | 184 V(CallConstantFunction) \ |
| 183 V(CallFunction) \ | 185 V(CallFunction) \ |
| (...skipping 12 matching lines...) Expand all Loading... |
| 196 V(CheckPrototypeMaps) \ | 198 V(CheckPrototypeMaps) \ |
| 197 V(CheckSmi) \ | 199 V(CheckSmi) \ |
| 198 V(Compare) \ | 200 V(Compare) \ |
| 199 V(CompareJSObjectEq) \ | 201 V(CompareJSObjectEq) \ |
| 200 V(CompareMapAndBranch) \ | 202 V(CompareMapAndBranch) \ |
| 201 V(Constant) \ | 203 V(Constant) \ |
| 202 V(DeleteProperty) \ | 204 V(DeleteProperty) \ |
| 203 V(Deoptimize) \ | 205 V(Deoptimize) \ |
| 204 V(Div) \ | 206 V(Div) \ |
| 205 V(EnterInlined) \ | 207 V(EnterInlined) \ |
| 208 V(FixedArrayLength) \ |
| 206 V(FunctionLiteral) \ | 209 V(FunctionLiteral) \ |
| 207 V(GlobalObject) \ | 210 V(GlobalObject) \ |
| 208 V(GlobalReceiver) \ | 211 V(GlobalReceiver) \ |
| 209 V(Goto) \ | 212 V(Goto) \ |
| 210 V(InstanceOf) \ | 213 V(InstanceOf) \ |
| 214 V(InstanceOfKnownGlobal) \ |
| 211 V(IsNull) \ | 215 V(IsNull) \ |
| 212 V(IsObject) \ | 216 V(IsObject) \ |
| 213 V(IsSmi) \ | 217 V(IsSmi) \ |
| 214 V(HasInstanceType) \ | 218 V(HasInstanceType) \ |
| 215 V(HasCachedArrayIndex) \ | 219 V(HasCachedArrayIndex) \ |
| 220 V(JSArrayLength) \ |
| 216 V(ClassOfTest) \ | 221 V(ClassOfTest) \ |
| 217 V(LeaveInlined) \ | 222 V(LeaveInlined) \ |
| 218 V(LoadElements) \ | 223 V(LoadElements) \ |
| 219 V(LoadGlobal) \ | 224 V(LoadGlobal) \ |
| 220 V(LoadKeyedFastElement) \ | 225 V(LoadKeyedFastElement) \ |
| 221 V(LoadKeyedGeneric) \ | 226 V(LoadKeyedGeneric) \ |
| 222 V(LoadNamedField) \ | 227 V(LoadNamedField) \ |
| 223 V(LoadNamedGeneric) \ | 228 V(LoadNamedGeneric) \ |
| 229 V(LoadFunctionPrototype) \ |
| 224 V(Mod) \ | 230 V(Mod) \ |
| 225 V(Mul) \ | 231 V(Mul) \ |
| 226 V(ObjectLiteral) \ | 232 V(ObjectLiteral) \ |
| 227 V(OsrEntry) \ | 233 V(OsrEntry) \ |
| 228 V(Parameter) \ | 234 V(Parameter) \ |
| 229 V(Power) \ | 235 V(Power) \ |
| 230 V(PushArgument) \ | 236 V(PushArgument) \ |
| 231 V(RegExpLiteral) \ | 237 V(RegExpLiteral) \ |
| 232 V(Return) \ | 238 V(Return) \ |
| 233 V(Sar) \ | 239 V(Sar) \ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 249 V(ValueOf) | 255 V(ValueOf) |
| 250 | 256 |
| 251 #define GVN_FLAG_LIST(V) \ | 257 #define GVN_FLAG_LIST(V) \ |
| 252 V(Calls) \ | 258 V(Calls) \ |
| 253 V(InobjectFields) \ | 259 V(InobjectFields) \ |
| 254 V(BackingStoreFields) \ | 260 V(BackingStoreFields) \ |
| 255 V(ArrayElements) \ | 261 V(ArrayElements) \ |
| 256 V(GlobalVars) \ | 262 V(GlobalVars) \ |
| 257 V(Maps) \ | 263 V(Maps) \ |
| 258 V(ArrayLengths) \ | 264 V(ArrayLengths) \ |
| 265 V(FunctionPrototypes) \ |
| 259 V(OsrEntries) | 266 V(OsrEntries) |
| 260 | 267 |
| 261 #define DECLARE_INSTRUCTION(type) \ | 268 #define DECLARE_INSTRUCTION(type) \ |
| 262 virtual bool Is##type() const { return true; } \ | 269 virtual bool Is##type() const { return true; } \ |
| 263 static H##type* cast(HValue* value) { \ | 270 static H##type* cast(HValue* value) { \ |
| 264 ASSERT(value->Is##type()); \ | 271 ASSERT(value->Is##type()); \ |
| 265 return reinterpret_cast<H##type*>(value); \ | 272 return reinterpret_cast<H##type*>(value); \ |
| 266 } \ | 273 } \ |
| 267 Opcode opcode() const { return HValue::k##type; } | 274 Opcode opcode() const { return HValue::k##type; } |
| 268 | 275 |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 true_destination_(true_destination), | 905 true_destination_(true_destination), |
| 899 false_destination_(false_destination) { | 906 false_destination_(false_destination) { |
| 900 ASSERT(true_destination != NULL); | 907 ASSERT(true_destination != NULL); |
| 901 ASSERT(false_destination != NULL); | 908 ASSERT(false_destination != NULL); |
| 902 ASSERT(!map.is_null()); | 909 ASSERT(!map.is_null()); |
| 903 } | 910 } |
| 904 | 911 |
| 905 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } | 912 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } |
| 906 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; } | 913 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; } |
| 907 | 914 |
| 915 HBasicBlock* true_destination() const { return true_destination_; } |
| 916 HBasicBlock* false_destination() const { return false_destination_; } |
| 917 |
| 908 virtual void PrintDataTo(StringStream* stream) const; | 918 virtual void PrintDataTo(StringStream* stream) const; |
| 909 | 919 |
| 910 Handle<Map> map() const { return map_; } | 920 Handle<Map> map() const { return map_; } |
| 911 | 921 |
| 912 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") | 922 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") |
| 913 | 923 |
| 914 private: | 924 private: |
| 915 Handle<Map> map_; | 925 Handle<Map> map_; |
| 916 HBasicBlock* true_destination_; | 926 HBasicBlock* true_destination_; |
| 917 HBasicBlock* false_destination_; | 927 HBasicBlock* false_destination_; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 } | 1018 } |
| 1009 | 1019 |
| 1010 private: | 1020 private: |
| 1011 Representation from_; | 1021 Representation from_; |
| 1012 Representation to_; | 1022 Representation to_; |
| 1013 }; | 1023 }; |
| 1014 | 1024 |
| 1015 | 1025 |
| 1016 class HSimulate: public HInstruction { | 1026 class HSimulate: public HInstruction { |
| 1017 public: | 1027 public: |
| 1018 HSimulate(int ast_id, int pop_count, int environment_height) | 1028 HSimulate(int ast_id, int pop_count, int environment_length) |
| 1019 : ast_id_(ast_id), | 1029 : ast_id_(ast_id), |
| 1020 pop_count_(pop_count), | 1030 pop_count_(pop_count), |
| 1021 environment_height_(environment_height), | 1031 environment_length_(environment_length), |
| 1022 values_(2), | 1032 values_(2), |
| 1023 assigned_indexes_(2) {} | 1033 assigned_indexes_(2) {} |
| 1024 virtual ~HSimulate() {} | 1034 virtual ~HSimulate() {} |
| 1025 | 1035 |
| 1026 virtual void PrintDataTo(StringStream* stream) const; | 1036 virtual void PrintDataTo(StringStream* stream) const; |
| 1027 | 1037 |
| 1028 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } | 1038 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } |
| 1029 int ast_id() const { return ast_id_; } | 1039 int ast_id() const { return ast_id_; } |
| 1030 void set_ast_id(int id) { | 1040 void set_ast_id(int id) { |
| 1031 ASSERT(!HasAstId()); | 1041 ASSERT(!HasAstId()); |
| 1032 ast_id_ = id; | 1042 ast_id_ = id; |
| 1033 } | 1043 } |
| 1034 | 1044 |
| 1035 int environment_height() const { return environment_height_; } | 1045 int environment_length() const { return environment_length_; } |
| 1036 int pop_count() const { return pop_count_; } | 1046 int pop_count() const { return pop_count_; } |
| 1037 const ZoneList<HValue*>* values() const { return &values_; } | 1047 const ZoneList<HValue*>* values() const { return &values_; } |
| 1038 int GetAssignedIndexAt(int index) const { | 1048 int GetAssignedIndexAt(int index) const { |
| 1039 ASSERT(HasAssignedIndexAt(index)); | 1049 ASSERT(HasAssignedIndexAt(index)); |
| 1040 return assigned_indexes_[index]; | 1050 return assigned_indexes_[index]; |
| 1041 } | 1051 } |
| 1042 bool HasAssignedIndexAt(int index) const { | 1052 bool HasAssignedIndexAt(int index) const { |
| 1043 return assigned_indexes_[index] != kNoIndex; | 1053 return assigned_indexes_[index] != kNoIndex; |
| 1044 } | 1054 } |
| 1045 void AddAssignedValue(int index, HValue* value) { | 1055 void AddAssignedValue(int index, HValue* value) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1067 void AddValue(int index, HValue* value) { | 1077 void AddValue(int index, HValue* value) { |
| 1068 assigned_indexes_.Add(index); | 1078 assigned_indexes_.Add(index); |
| 1069 // Resize the list of pushed values. | 1079 // Resize the list of pushed values. |
| 1070 values_.Add(NULL); | 1080 values_.Add(NULL); |
| 1071 // Set the operand through the base method in HValue to make sure that the | 1081 // Set the operand through the base method in HValue to make sure that the |
| 1072 // use lists are correctly updated. | 1082 // use lists are correctly updated. |
| 1073 SetOperandAt(values_.length() - 1, value); | 1083 SetOperandAt(values_.length() - 1, value); |
| 1074 } | 1084 } |
| 1075 int ast_id_; | 1085 int ast_id_; |
| 1076 int pop_count_; | 1086 int pop_count_; |
| 1077 int environment_height_; | 1087 int environment_length_; |
| 1078 ZoneList<HValue*> values_; | 1088 ZoneList<HValue*> values_; |
| 1079 ZoneList<int> assigned_indexes_; | 1089 ZoneList<int> assigned_indexes_; |
| 1080 }; | 1090 }; |
| 1081 | 1091 |
| 1082 | 1092 |
| 1083 class HStackCheck: public HInstruction { | 1093 class HStackCheck: public HInstruction { |
| 1084 public: | 1094 public: |
| 1085 HStackCheck() { } | 1095 HStackCheck() { } |
| 1086 | 1096 |
| 1087 DECLARE_CONCRETE_INSTRUCTION(Throw, "stack_check") | 1097 DECLARE_CONCRETE_INSTRUCTION(Throw, "stack_check") |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 Handle<String> name() const { return name_; } | 1340 Handle<String> name() const { return name_; } |
| 1331 | 1341 |
| 1332 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") | 1342 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") |
| 1333 | 1343 |
| 1334 private: | 1344 private: |
| 1335 const Runtime::Function* c_function_; | 1345 const Runtime::Function* c_function_; |
| 1336 Handle<String> name_; | 1346 Handle<String> name_; |
| 1337 }; | 1347 }; |
| 1338 | 1348 |
| 1339 | 1349 |
| 1340 class HArrayLength: public HUnaryOperation { | 1350 class HJSArrayLength: public HUnaryOperation { |
| 1341 public: | 1351 public: |
| 1342 explicit HArrayLength(HValue* value) : HUnaryOperation(value) { | 1352 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { |
| 1343 // The length of an array is stored as a tagged value in the array | 1353 // The length of an array is stored as a tagged value in the array |
| 1344 // object. It is guaranteed to be 32 bit integer, but it can be | 1354 // object. It is guaranteed to be 32 bit integer, but it can be |
| 1345 // represented as either a smi or heap number. | 1355 // represented as either a smi or heap number. |
| 1346 set_representation(Representation::Tagged()); | 1356 set_representation(Representation::Tagged()); |
| 1347 SetFlag(kDependsOnArrayLengths); | 1357 SetFlag(kDependsOnArrayLengths); |
| 1348 SetFlag(kUseGVN); | 1358 SetFlag(kUseGVN); |
| 1349 } | 1359 } |
| 1350 | 1360 |
| 1351 virtual Representation RequiredInputRepresentation(int index) const { | 1361 virtual Representation RequiredInputRepresentation(int index) const { |
| 1352 return Representation::Tagged(); | 1362 return Representation::Tagged(); |
| 1353 } | 1363 } |
| 1354 | 1364 |
| 1355 DECLARE_CONCRETE_INSTRUCTION(ArrayLength, "array_length") | 1365 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") |
| 1366 }; |
| 1367 |
| 1368 |
| 1369 class HFixedArrayLength: public HUnaryOperation { |
| 1370 public: |
| 1371 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { |
| 1372 set_representation(Representation::Tagged()); |
| 1373 SetFlag(kDependsOnArrayLengths); |
| 1374 SetFlag(kUseGVN); |
| 1375 } |
| 1376 |
| 1377 virtual Representation RequiredInputRepresentation(int index) const { |
| 1378 return Representation::Tagged(); |
| 1379 } |
| 1380 |
| 1381 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") |
| 1356 }; | 1382 }; |
| 1357 | 1383 |
| 1358 | 1384 |
| 1359 class HBitNot: public HUnaryOperation { | 1385 class HBitNot: public HUnaryOperation { |
| 1360 public: | 1386 public: |
| 1361 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 1387 explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
| 1362 set_representation(Representation::Integer32()); | 1388 set_representation(Representation::Integer32()); |
| 1363 SetFlag(kUseGVN); | 1389 SetFlag(kUseGVN); |
| 1364 SetFlag(kTruncatingToInt32); | 1390 SetFlag(kTruncatingToInt32); |
| 1365 } | 1391 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 virtual HType CalculateInferredType() const; | 1616 virtual HType CalculateInferredType() const; |
| 1591 | 1617 |
| 1592 #ifdef DEBUG | 1618 #ifdef DEBUG |
| 1593 virtual void Verify() const; | 1619 virtual void Verify() const; |
| 1594 #endif | 1620 #endif |
| 1595 | 1621 |
| 1596 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") | 1622 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") |
| 1597 }; | 1623 }; |
| 1598 | 1624 |
| 1599 | 1625 |
| 1600 class HCheckPrototypeMaps: public HUnaryOperation { | 1626 class HCheckPrototypeMaps: public HInstruction { |
| 1601 public: | 1627 public: |
| 1602 HCheckPrototypeMaps(HValue* value, | 1628 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
| 1603 Handle<JSObject> holder, | 1629 : prototype_(prototype), holder_(holder) { |
| 1604 Handle<Map> receiver_map) | |
| 1605 : HUnaryOperation(value), | |
| 1606 holder_(holder), | |
| 1607 receiver_map_(receiver_map) { | |
| 1608 set_representation(Representation::Tagged()); | |
| 1609 SetFlag(kUseGVN); | 1630 SetFlag(kUseGVN); |
| 1610 SetFlag(kDependsOnMaps); | 1631 SetFlag(kDependsOnMaps); |
| 1611 } | 1632 } |
| 1612 | 1633 |
| 1613 virtual Representation RequiredInputRepresentation(int index) const { | |
| 1614 return Representation::Tagged(); | |
| 1615 } | |
| 1616 | |
| 1617 #ifdef DEBUG | 1634 #ifdef DEBUG |
| 1618 virtual void Verify() const; | 1635 virtual void Verify() const; |
| 1619 #endif | 1636 #endif |
| 1620 | 1637 |
| 1638 Handle<JSObject> prototype() const { return prototype_; } |
| 1621 Handle<JSObject> holder() const { return holder_; } | 1639 Handle<JSObject> holder() const { return holder_; } |
| 1622 Handle<Map> receiver_map() const { return receiver_map_; } | |
| 1623 | 1640 |
| 1624 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") | 1641 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") |
| 1625 | 1642 |
| 1643 virtual intptr_t Hashcode() const { |
| 1644 ASSERT(!HEAP->IsAllocationAllowed()); |
| 1645 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); |
| 1646 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); |
| 1647 return hash; |
| 1648 } |
| 1649 |
| 1626 protected: | 1650 protected: |
| 1627 virtual bool DataEquals(HValue* other) const { | 1651 virtual bool DataEquals(HValue* other) const { |
| 1628 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); | 1652 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); |
| 1629 return holder_.is_identical_to(b->holder()) && | 1653 return prototype_.is_identical_to(b->prototype()) && |
| 1630 receiver_map_.is_identical_to(b->receiver_map()); | 1654 holder_.is_identical_to(b->holder()); |
| 1631 } | 1655 } |
| 1632 | 1656 |
| 1633 private: | 1657 private: |
| 1658 Handle<JSObject> prototype_; |
| 1634 Handle<JSObject> holder_; | 1659 Handle<JSObject> holder_; |
| 1635 Handle<Map> receiver_map_; | |
| 1636 }; | 1660 }; |
| 1637 | 1661 |
| 1638 | 1662 |
| 1639 class HCheckSmi: public HUnaryOperation { | 1663 class HCheckSmi: public HUnaryOperation { |
| 1640 public: | 1664 public: |
| 1641 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | 1665 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
| 1642 set_representation(Representation::Tagged()); | 1666 set_representation(Representation::Tagged()); |
| 1643 SetFlag(kUseGVN); | 1667 SetFlag(kUseGVN); |
| 1644 } | 1668 } |
| 1645 | 1669 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") | 1784 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") |
| 1761 }; | 1785 }; |
| 1762 | 1786 |
| 1763 | 1787 |
| 1764 class HConstant: public HInstruction { | 1788 class HConstant: public HInstruction { |
| 1765 public: | 1789 public: |
| 1766 HConstant(Handle<Object> handle, Representation r); | 1790 HConstant(Handle<Object> handle, Representation r); |
| 1767 | 1791 |
| 1768 Handle<Object> handle() const { return handle_; } | 1792 Handle<Object> handle() const { return handle_; } |
| 1769 | 1793 |
| 1794 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
| 1795 |
| 1770 virtual bool EmitAtUses() const { return !representation().IsDouble(); } | 1796 virtual bool EmitAtUses() const { return !representation().IsDouble(); } |
| 1771 virtual void PrintDataTo(StringStream* stream) const; | 1797 virtual void PrintDataTo(StringStream* stream) const; |
| 1772 virtual HType CalculateInferredType() const; | 1798 virtual HType CalculateInferredType() const; |
| 1773 bool IsInteger() const { return handle_->IsSmi(); } | 1799 bool IsInteger() const { return handle_->IsSmi(); } |
| 1774 HConstant* CopyToRepresentation(Representation r) const; | 1800 HConstant* CopyToRepresentation(Representation r) const; |
| 1775 HConstant* CopyToTruncatedInt32() const; | 1801 HConstant* CopyToTruncatedInt32() const; |
| 1776 bool HasInteger32Value() const { return has_int32_value_; } | 1802 bool HasInteger32Value() const { return has_int32_value_; } |
| 1777 int32_t Integer32Value() const { | 1803 int32_t Integer32Value() const { |
| 1778 ASSERT(HasInteger32Value()); | 1804 ASSERT(HasInteger32Value()); |
| 1779 return int32_value_; | 1805 return int32_value_; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2256 virtual bool EmitAtUses() const { return uses()->length() <= 1; } |
| 2231 | 2257 |
| 2232 virtual Representation RequiredInputRepresentation(int index) const { | 2258 virtual Representation RequiredInputRepresentation(int index) const { |
| 2233 return Representation::Tagged(); | 2259 return Representation::Tagged(); |
| 2234 } | 2260 } |
| 2235 | 2261 |
| 2236 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") | 2262 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") |
| 2237 }; | 2263 }; |
| 2238 | 2264 |
| 2239 | 2265 |
| 2266 class HInstanceOfKnownGlobal: public HUnaryOperation { |
| 2267 public: |
| 2268 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) |
| 2269 : HUnaryOperation(left), function_(right) { |
| 2270 set_representation(Representation::Tagged()); |
| 2271 SetFlagMask(AllSideEffects()); |
| 2272 } |
| 2273 |
| 2274 Handle<JSFunction> function() { return function_; } |
| 2275 |
| 2276 virtual Representation RequiredInputRepresentation(int index) const { |
| 2277 return Representation::Tagged(); |
| 2278 } |
| 2279 |
| 2280 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, |
| 2281 "instance_of_known_global") |
| 2282 |
| 2283 private: |
| 2284 Handle<JSFunction> function_; |
| 2285 }; |
| 2286 |
| 2287 |
| 2240 class HPower: public HBinaryOperation { | 2288 class HPower: public HBinaryOperation { |
| 2241 public: | 2289 public: |
| 2242 HPower(HValue* left, HValue* right) | 2290 HPower(HValue* left, HValue* right) |
| 2243 : HBinaryOperation(left, right) { | 2291 : HBinaryOperation(left, right) { |
| 2244 set_representation(Representation::Double()); | 2292 set_representation(Representation::Double()); |
| 2245 SetFlag(kUseGVN); | 2293 SetFlag(kUseGVN); |
| 2246 } | 2294 } |
| 2247 | 2295 |
| 2248 virtual Representation RequiredInputRepresentation(int index) const { | 2296 virtual Representation RequiredInputRepresentation(int index) const { |
| 2249 return (index == 1) ? Representation::None() : Representation::Double(); | 2297 return (index == 1) ? Representation::None() : Representation::Double(); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 virtual bool DataEquals(HValue* other) const { | 2659 virtual bool DataEquals(HValue* other) const { |
| 2612 HLoadNamedGeneric* b = HLoadNamedGeneric::cast(other); | 2660 HLoadNamedGeneric* b = HLoadNamedGeneric::cast(other); |
| 2613 return name_.is_identical_to(b->name_); | 2661 return name_.is_identical_to(b->name_); |
| 2614 } | 2662 } |
| 2615 | 2663 |
| 2616 private: | 2664 private: |
| 2617 Handle<Object> name_; | 2665 Handle<Object> name_; |
| 2618 }; | 2666 }; |
| 2619 | 2667 |
| 2620 | 2668 |
| 2669 class HLoadFunctionPrototype: public HUnaryOperation { |
| 2670 public: |
| 2671 explicit HLoadFunctionPrototype(HValue* function) |
| 2672 : HUnaryOperation(function) { |
| 2673 set_representation(Representation::Tagged()); |
| 2674 SetFlagMask(kDependsOnFunctionPrototypes); |
| 2675 } |
| 2676 |
| 2677 HValue* function() const { return OperandAt(0); } |
| 2678 |
| 2679 virtual Representation RequiredInputRepresentation(int index) const { |
| 2680 return Representation::Tagged(); |
| 2681 } |
| 2682 |
| 2683 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") |
| 2684 |
| 2685 protected: |
| 2686 virtual bool DataEquals(HValue* other) const { return true; } |
| 2687 }; |
| 2688 |
| 2689 |
| 2621 class HLoadKeyed: public HBinaryOperation { | 2690 class HLoadKeyed: public HBinaryOperation { |
| 2622 public: | 2691 public: |
| 2623 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { | 2692 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { |
| 2624 set_representation(Representation::Tagged()); | 2693 set_representation(Representation::Tagged()); |
| 2625 } | 2694 } |
| 2626 | 2695 |
| 2627 virtual void PrintDataTo(StringStream* stream) const; | 2696 virtual void PrintDataTo(StringStream* stream) const; |
| 2628 | 2697 |
| 2629 virtual Representation RequiredInputRepresentation(int index) const { | 2698 virtual Representation RequiredInputRepresentation(int index) const { |
| 2630 return Representation::Tagged(); | 2699 return Representation::Tagged(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2657 class HLoadKeyedGeneric: public HLoadKeyed { | 2726 class HLoadKeyedGeneric: public HLoadKeyed { |
| 2658 public: | 2727 public: |
| 2659 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { | 2728 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { |
| 2660 SetFlagMask(AllSideEffects()); | 2729 SetFlagMask(AllSideEffects()); |
| 2661 } | 2730 } |
| 2662 | 2731 |
| 2663 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") | 2732 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") |
| 2664 }; | 2733 }; |
| 2665 | 2734 |
| 2666 | 2735 |
| 2736 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
| 2737 return !value->type().IsSmi() && |
| 2738 !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); |
| 2739 } |
| 2740 |
| 2741 |
| 2667 class HStoreNamed: public HBinaryOperation { | 2742 class HStoreNamed: public HBinaryOperation { |
| 2668 public: | 2743 public: |
| 2669 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val) | 2744 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val) |
| 2670 : HBinaryOperation(obj, val), name_(name) { | 2745 : HBinaryOperation(obj, val), name_(name) { |
| 2671 } | 2746 } |
| 2672 | 2747 |
| 2673 virtual Representation RequiredInputRepresentation(int index) const { | 2748 virtual Representation RequiredInputRepresentation(int index) const { |
| 2674 return Representation::Tagged(); | 2749 return Representation::Tagged(); |
| 2675 } | 2750 } |
| 2676 | 2751 |
| 2677 virtual void PrintDataTo(StringStream* stream) const; | 2752 virtual void PrintDataTo(StringStream* stream) const; |
| 2678 | 2753 |
| 2679 HValue* object() const { return OperandAt(0); } | 2754 HValue* object() const { return OperandAt(0); } |
| 2680 Handle<Object> name() const { return name_; } | 2755 Handle<Object> name() const { return name_; } |
| 2681 HValue* value() const { return OperandAt(1); } | 2756 HValue* value() const { return OperandAt(1); } |
| 2682 void set_value(HValue* value) { SetOperandAt(1, value); } | 2757 void set_value(HValue* value) { SetOperandAt(1, value); } |
| 2683 | 2758 |
| 2759 bool NeedsWriteBarrier() const { |
| 2760 return StoringValueNeedsWriteBarrier(value()); |
| 2761 } |
| 2762 |
| 2684 DECLARE_INSTRUCTION(StoreNamed) | 2763 DECLARE_INSTRUCTION(StoreNamed) |
| 2685 | 2764 |
| 2686 protected: | 2765 protected: |
| 2687 virtual bool DataEquals(HValue* other) const { | 2766 virtual bool DataEquals(HValue* other) const { |
| 2688 HStoreNamed* b = HStoreNamed::cast(other); | 2767 HStoreNamed* b = HStoreNamed::cast(other); |
| 2689 return name_.is_identical_to(b->name_); | 2768 return name_.is_identical_to(b->name_); |
| 2690 } | 2769 } |
| 2691 | 2770 |
| 2692 private: | 2771 private: |
| 2693 Handle<Object> name_; | 2772 Handle<Object> name_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2754 virtual HValue* OperandAt(int index) const { return operands_[index]; } | 2833 virtual HValue* OperandAt(int index) const { return operands_[index]; } |
| 2755 | 2834 |
| 2756 virtual Representation RequiredInputRepresentation(int index) const { | 2835 virtual Representation RequiredInputRepresentation(int index) const { |
| 2757 return Representation::Tagged(); | 2836 return Representation::Tagged(); |
| 2758 } | 2837 } |
| 2759 | 2838 |
| 2760 HValue* object() const { return OperandAt(0); } | 2839 HValue* object() const { return OperandAt(0); } |
| 2761 HValue* key() const { return OperandAt(1); } | 2840 HValue* key() const { return OperandAt(1); } |
| 2762 HValue* value() const { return OperandAt(2); } | 2841 HValue* value() const { return OperandAt(2); } |
| 2763 | 2842 |
| 2843 bool NeedsWriteBarrier() const { |
| 2844 return StoringValueNeedsWriteBarrier(value()); |
| 2845 } |
| 2846 |
| 2764 DECLARE_INSTRUCTION(StoreKeyed) | 2847 DECLARE_INSTRUCTION(StoreKeyed) |
| 2765 | 2848 |
| 2766 protected: | 2849 protected: |
| 2767 virtual void InternalSetOperandAt(int index, HValue* value) { | 2850 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 2768 operands_[index] = value; | 2851 operands_[index] = value; |
| 2769 } | 2852 } |
| 2770 | 2853 |
| 2771 private: | 2854 private: |
| 2772 HOperandVector<3> operands_; | 2855 HOperandVector<3> operands_; |
| 2773 }; | 2856 }; |
| 2774 | 2857 |
| 2775 | 2858 |
| 2776 class HStoreKeyedFastElement: public HStoreKeyed { | 2859 class HStoreKeyedFastElement: public HStoreKeyed { |
| 2777 public: | 2860 public: |
| 2778 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) | 2861 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) |
| 2779 : HStoreKeyed(obj, key, val) { | 2862 : HStoreKeyed(obj, key, val) { |
| 2780 SetFlag(kChangesArrayElements); | 2863 SetFlag(kChangesArrayElements); |
| 2781 } | 2864 } |
| 2782 | 2865 |
| 2783 bool NeedsWriteBarrier() const { | |
| 2784 return !value()->type().IsSmi(); | |
| 2785 } | |
| 2786 | |
| 2787 virtual Representation RequiredInputRepresentation(int index) const { | 2866 virtual Representation RequiredInputRepresentation(int index) const { |
| 2788 // The key is supposed to be Integer32. | 2867 // The key is supposed to be Integer32. |
| 2789 return (index == 1) ? Representation::Integer32() | 2868 return (index == 1) ? Representation::Integer32() |
| 2790 : Representation::Tagged(); | 2869 : Representation::Tagged(); |
| 2791 } | 2870 } |
| 2792 | 2871 |
| 2793 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, | 2872 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, |
| 2794 "store_keyed_fast_element") | 2873 "store_keyed_fast_element") |
| 2795 }; | 2874 }; |
| 2796 | 2875 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2945 HValue* object() const { return left(); } | 3024 HValue* object() const { return left(); } |
| 2946 HValue* key() const { return right(); } | 3025 HValue* key() const { return right(); } |
| 2947 }; | 3026 }; |
| 2948 | 3027 |
| 2949 #undef DECLARE_INSTRUCTION | 3028 #undef DECLARE_INSTRUCTION |
| 2950 #undef DECLARE_CONCRETE_INSTRUCTION | 3029 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2951 | 3030 |
| 2952 } } // namespace v8::internal | 3031 } } // namespace v8::internal |
| 2953 | 3032 |
| 2954 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3033 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |