| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 79 // HLoadNamedGeneric |
| 80 // HPower |
| 80 // HStoreNamed | 81 // HStoreNamed |
| 81 // HStoreNamedField | 82 // HStoreNamedField |
| 82 // HStoreNamedGeneric | 83 // HStoreNamedGeneric |
| 83 // HBlockEntry | 84 // HBlockEntry |
| 84 // HCall | 85 // HCall |
| 85 // HCallConstantFunction | 86 // HCallConstantFunction |
| 86 // HCallFunction | 87 // HCallFunction |
| 87 // HCallGlobal | 88 // HCallGlobal |
| 88 // HCallKeyed | 89 // HCallKeyed |
| 89 // HCallKnownGlobal | 90 // HCallKnownGlobal |
| 90 // HCallNamed | 91 // HCallNamed |
| 91 // HCallNew | 92 // HCallNew |
| 92 // HCallRuntime | 93 // HCallRuntime |
| 93 // HCallStub | 94 // HCallStub |
| 94 // HConstant | 95 // HConstant |
| 95 // HControlInstruction | 96 // HControlInstruction |
| 97 // HDeoptimize |
| 96 // HGoto | 98 // HGoto |
| 97 // HUnaryControlInstruction | 99 // HUnaryControlInstruction |
| 98 // HBranch | 100 // HBranch |
| 99 // HCompareMapAndBranch | 101 // HCompareMapAndBranch |
| 100 // HReturn | 102 // HReturn |
| 101 // HThrow | 103 // HThrow |
| 102 // HDeoptimize | |
| 103 // HEnterInlined | 104 // HEnterInlined |
| 104 // HFunctionLiteral | 105 // HFunctionLiteral |
| 105 // HGlobalObject | 106 // HGlobalObject |
| 106 // HGlobalReceiver | 107 // HGlobalReceiver |
| 107 // HLeaveInlined | 108 // HLeaveInlined |
| 108 // HLoadGlobal | 109 // HLoadGlobal |
| 109 // HMaterializedLiteral | 110 // HMaterializedLiteral |
| 110 // HArrayLiteral | 111 // HArrayLiteral |
| 111 // HObjectLiteral | 112 // HObjectLiteral |
| 112 // HRegExpLiteral | 113 // HRegExpLiteral |
| (...skipping 19 matching lines...) Expand all Loading... |
| 132 // HTypeofIs | 133 // HTypeofIs |
| 133 // HLoadNamedField | 134 // HLoadNamedField |
| 134 // HPushArgument | 135 // HPushArgument |
| 135 // HTypeof | 136 // HTypeof |
| 136 // HUnaryMathOperation | 137 // HUnaryMathOperation |
| 137 // HUnaryPredicate | 138 // HUnaryPredicate |
| 138 // HClassOfTest | 139 // HClassOfTest |
| 139 // HHasCachedArrayIndex | 140 // HHasCachedArrayIndex |
| 140 // HHasInstanceType | 141 // HHasInstanceType |
| 141 // HIsNull | 142 // HIsNull |
| 143 // HIsObject |
| 142 // HIsSmi | 144 // HIsSmi |
| 143 // HValueOf | 145 // HValueOf |
| 144 // HUnknownOSRValue | 146 // HUnknownOSRValue |
| 145 // HPhi | 147 // HPhi |
| 146 | 148 |
| 147 #define HYDROGEN_ALL_INSTRUCTION_LIST(V) \ | 149 #define HYDROGEN_ALL_INSTRUCTION_LIST(V) \ |
| 148 V(ArithmeticBinaryOperation) \ | 150 V(ArithmeticBinaryOperation) \ |
| 149 V(BinaryOperation) \ | 151 V(BinaryOperation) \ |
| 150 V(BitwiseBinaryOperation) \ | 152 V(BitwiseBinaryOperation) \ |
| 151 V(Call) \ | 153 V(Call) \ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 V(DeleteProperty) \ | 202 V(DeleteProperty) \ |
| 201 V(Deoptimize) \ | 203 V(Deoptimize) \ |
| 202 V(Div) \ | 204 V(Div) \ |
| 203 V(EnterInlined) \ | 205 V(EnterInlined) \ |
| 204 V(FunctionLiteral) \ | 206 V(FunctionLiteral) \ |
| 205 V(GlobalObject) \ | 207 V(GlobalObject) \ |
| 206 V(GlobalReceiver) \ | 208 V(GlobalReceiver) \ |
| 207 V(Goto) \ | 209 V(Goto) \ |
| 208 V(InstanceOf) \ | 210 V(InstanceOf) \ |
| 209 V(IsNull) \ | 211 V(IsNull) \ |
| 212 V(IsObject) \ |
| 210 V(IsSmi) \ | 213 V(IsSmi) \ |
| 211 V(HasInstanceType) \ | 214 V(HasInstanceType) \ |
| 212 V(HasCachedArrayIndex) \ | 215 V(HasCachedArrayIndex) \ |
| 213 V(ClassOfTest) \ | 216 V(ClassOfTest) \ |
| 214 V(LeaveInlined) \ | 217 V(LeaveInlined) \ |
| 215 V(LoadElements) \ | 218 V(LoadElements) \ |
| 216 V(LoadGlobal) \ | 219 V(LoadGlobal) \ |
| 217 V(LoadKeyedFastElement) \ | 220 V(LoadKeyedFastElement) \ |
| 218 V(LoadKeyedGeneric) \ | 221 V(LoadKeyedGeneric) \ |
| 219 V(LoadNamedField) \ | 222 V(LoadNamedField) \ |
| 220 V(LoadNamedGeneric) \ | 223 V(LoadNamedGeneric) \ |
| 221 V(Mod) \ | 224 V(Mod) \ |
| 222 V(Mul) \ | 225 V(Mul) \ |
| 223 V(ObjectLiteral) \ | 226 V(ObjectLiteral) \ |
| 224 V(OsrEntry) \ | 227 V(OsrEntry) \ |
| 225 V(Parameter) \ | 228 V(Parameter) \ |
| 229 V(Power) \ |
| 226 V(PushArgument) \ | 230 V(PushArgument) \ |
| 227 V(RegExpLiteral) \ | 231 V(RegExpLiteral) \ |
| 228 V(Return) \ | 232 V(Return) \ |
| 229 V(Sar) \ | 233 V(Sar) \ |
| 230 V(Shl) \ | 234 V(Shl) \ |
| 231 V(Shr) \ | 235 V(Shr) \ |
| 232 V(Simulate) \ | 236 V(Simulate) \ |
| 233 V(StackCheck) \ | 237 V(StackCheck) \ |
| 234 V(StoreGlobal) \ | 238 V(StoreGlobal) \ |
| 235 V(StoreKeyedFastElement) \ | 239 V(StoreKeyedFastElement) \ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 int old_upper = upper_; | 327 int old_upper = upper_; |
| 324 lower_ = lower_ << bits; | 328 lower_ = lower_ << bits; |
| 325 upper_ = upper_ << bits; | 329 upper_ = upper_ << bits; |
| 326 if (old_lower != lower_ >> bits || old_upper != upper_ >> bits) { | 330 if (old_lower != lower_ >> bits || old_upper != upper_ >> bits) { |
| 327 upper_ = kMaxInt; | 331 upper_ = kMaxInt; |
| 328 lower_ = kMinInt; | 332 lower_ = kMinInt; |
| 329 } | 333 } |
| 330 set_can_be_minus_zero(false); | 334 set_can_be_minus_zero(false); |
| 331 } | 335 } |
| 332 | 336 |
| 337 // Adds a constant to the lower and upper bound of the range. |
| 338 void AddConstant(int32_t value); |
| 339 |
| 333 void StackUpon(Range* other) { | 340 void StackUpon(Range* other) { |
| 334 Intersect(other); | 341 Intersect(other); |
| 335 next_ = other; | 342 next_ = other; |
| 336 } | 343 } |
| 337 | 344 |
| 338 void Intersect(Range* other) { | 345 void Intersect(Range* other) { |
| 339 upper_ = Min(upper_, other->upper_); | 346 upper_ = Min(upper_, other->upper_); |
| 340 lower_ = Max(lower_, other->lower_); | 347 lower_ = Max(lower_, other->lower_); |
| 341 bool b = CanBeMinusZero() && other->CanBeMinusZero(); | 348 bool b = CanBeMinusZero() && other->CanBeMinusZero(); |
| 342 set_can_be_minus_zero(b); | 349 set_can_be_minus_zero(b); |
| 343 } | 350 } |
| 344 | 351 |
| 345 void Union(Range* other) { | 352 void Union(Range* other) { |
| 346 upper_ = Max(upper_, other->upper_); | 353 upper_ = Max(upper_, other->upper_); |
| 347 lower_ = Min(lower_, other->lower_); | 354 lower_ = Min(lower_, other->lower_); |
| 348 bool b = CanBeMinusZero() || other->CanBeMinusZero(); | 355 bool b = CanBeMinusZero() || other->CanBeMinusZero(); |
| 349 set_can_be_minus_zero(b); | 356 set_can_be_minus_zero(b); |
| 350 } | 357 } |
| 351 | 358 |
| 352 void Add(int32_t value); | 359 // Compute a new result range and return true, if the operation |
| 360 // can overflow. |
| 353 bool AddAndCheckOverflow(Range* other); | 361 bool AddAndCheckOverflow(Range* other); |
| 354 bool SubAndCheckOverflow(Range* other); | 362 bool SubAndCheckOverflow(Range* other); |
| 355 bool MulAndCheckOverflow(Range* other); | 363 bool MulAndCheckOverflow(Range* other); |
| 356 | 364 |
| 357 private: | 365 private: |
| 358 int32_t lower_; | 366 int32_t lower_; |
| 359 int32_t upper_; | 367 int32_t upper_; |
| 360 Range* next_; | 368 Range* next_; |
| 361 bool can_be_minus_zero_; | 369 bool can_be_minus_zero_; |
| 362 }; | 370 }; |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 true_destination_(true_destination), | 898 true_destination_(true_destination), |
| 891 false_destination_(false_destination) { | 899 false_destination_(false_destination) { |
| 892 ASSERT(true_destination != NULL); | 900 ASSERT(true_destination != NULL); |
| 893 ASSERT(false_destination != NULL); | 901 ASSERT(false_destination != NULL); |
| 894 ASSERT(!map.is_null()); | 902 ASSERT(!map.is_null()); |
| 895 } | 903 } |
| 896 | 904 |
| 897 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } | 905 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } |
| 898 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; } | 906 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; } |
| 899 | 907 |
| 908 virtual void PrintDataTo(StringStream* stream) const; |
| 909 |
| 900 Handle<Map> map() const { return map_; } | 910 Handle<Map> map() const { return map_; } |
| 901 | 911 |
| 902 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") | 912 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") |
| 903 | 913 |
| 904 private: | 914 private: |
| 905 Handle<Map> map_; | 915 Handle<Map> map_; |
| 906 HBasicBlock* true_destination_; | 916 HBasicBlock* true_destination_; |
| 907 HBasicBlock* false_destination_; | 917 HBasicBlock* false_destination_; |
| 908 }; | 918 }; |
| 909 | 919 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 return Representation::Integer32(); | 1368 return Representation::Integer32(); |
| 1359 } | 1369 } |
| 1360 virtual HType CalculateInferredType() const; | 1370 virtual HType CalculateInferredType() const; |
| 1361 | 1371 |
| 1362 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") | 1372 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") |
| 1363 }; | 1373 }; |
| 1364 | 1374 |
| 1365 | 1375 |
| 1366 class HUnaryMathOperation: public HUnaryOperation { | 1376 class HUnaryMathOperation: public HUnaryOperation { |
| 1367 public: | 1377 public: |
| 1368 HUnaryMathOperation(HValue* value, MathFunctionId op) | 1378 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) |
| 1369 : HUnaryOperation(value), op_(op) { | 1379 : HUnaryOperation(value), op_(op) { |
| 1370 switch (op) { | 1380 switch (op) { |
| 1371 case kMathFloor: | 1381 case kMathFloor: |
| 1372 case kMathRound: | 1382 case kMathRound: |
| 1373 case kMathCeil: | 1383 case kMathCeil: |
| 1374 set_representation(Representation::Integer32()); | 1384 set_representation(Representation::Integer32()); |
| 1375 break; | 1385 break; |
| 1376 case kMathAbs: | 1386 case kMathAbs: |
| 1377 set_representation(Representation::Tagged()); | 1387 set_representation(Representation::Tagged()); |
| 1378 SetFlag(kFlexibleRepresentation); | 1388 SetFlag(kFlexibleRepresentation); |
| 1379 break; | 1389 break; |
| 1380 case kMathSqrt: | 1390 case kMathSqrt: |
| 1391 case kMathPowHalf: |
| 1392 case kMathLog: |
| 1393 case kMathSin: |
| 1394 case kMathCos: |
| 1395 set_representation(Representation::Double()); |
| 1396 break; |
| 1381 default: | 1397 default: |
| 1382 set_representation(Representation::Double()); | 1398 UNREACHABLE(); |
| 1383 } | 1399 } |
| 1384 SetFlag(kUseGVN); | 1400 SetFlag(kUseGVN); |
| 1385 } | 1401 } |
| 1386 | 1402 |
| 1387 virtual void PrintDataTo(StringStream* stream) const; | 1403 virtual void PrintDataTo(StringStream* stream) const; |
| 1388 | 1404 |
| 1389 virtual HType CalculateInferredType() const; | 1405 virtual HType CalculateInferredType() const; |
| 1390 | 1406 |
| 1391 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1407 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1392 | 1408 |
| 1393 virtual Representation RequiredInputRepresentation(int index) const { | 1409 virtual Representation RequiredInputRepresentation(int index) const { |
| 1394 switch (op_) { | 1410 switch (op_) { |
| 1395 case kMathFloor: | 1411 case kMathFloor: |
| 1396 case kMathRound: | 1412 case kMathRound: |
| 1397 case kMathCeil: | 1413 case kMathCeil: |
| 1398 case kMathSqrt: | 1414 case kMathSqrt: |
| 1415 case kMathPowHalf: |
| 1416 case kMathLog: |
| 1417 case kMathSin: |
| 1418 case kMathCos: |
| 1399 return Representation::Double(); | 1419 return Representation::Double(); |
| 1400 break; | 1420 break; |
| 1401 case kMathAbs: | 1421 case kMathAbs: |
| 1402 return representation(); | 1422 return representation(); |
| 1403 break; | 1423 break; |
| 1404 default: | 1424 default: |
| 1405 return Representation::None(); | 1425 return Representation::None(); |
| 1406 } | 1426 } |
| 1407 } | 1427 } |
| 1408 | 1428 |
| 1409 virtual HValue* Canonicalize() { | 1429 virtual HValue* Canonicalize() { |
| 1410 // If the input is integer32 then we replace the floor instruction | 1430 // If the input is integer32 then we replace the floor instruction |
| 1411 // with its inputs. This happens before the representation changes are | 1431 // with its inputs. This happens before the representation changes are |
| 1412 // introduced. | 1432 // introduced. |
| 1413 if (op() == kMathFloor) { | 1433 if (op() == kMathFloor) { |
| 1414 if (value()->representation().IsInteger32()) return value(); | 1434 if (value()->representation().IsInteger32()) return value(); |
| 1415 } | 1435 } |
| 1416 return this; | 1436 return this; |
| 1417 } | 1437 } |
| 1418 | 1438 |
| 1419 MathFunctionId op() const { return op_; } | 1439 BuiltinFunctionId op() const { return op_; } |
| 1420 const char* OpName() const; | 1440 const char* OpName() const; |
| 1421 | 1441 |
| 1422 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary_math_operation") | 1442 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary_math_operation") |
| 1423 | 1443 |
| 1444 protected: |
| 1445 virtual bool DataEquals(HValue* other) const { |
| 1446 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); |
| 1447 return op_ == b->op(); |
| 1448 } |
| 1449 |
| 1424 private: | 1450 private: |
| 1425 MathFunctionId op_; | 1451 BuiltinFunctionId op_; |
| 1426 }; | 1452 }; |
| 1427 | 1453 |
| 1428 | 1454 |
| 1429 class HLoadElements: public HUnaryOperation { | 1455 class HLoadElements: public HUnaryOperation { |
| 1430 public: | 1456 public: |
| 1431 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { | 1457 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { |
| 1432 set_representation(Representation::Tagged()); | 1458 set_representation(Representation::Tagged()); |
| 1433 SetFlag(kUseGVN); | 1459 SetFlag(kUseGVN); |
| 1434 SetFlag(kDependsOnMaps); | 1460 SetFlag(kDependsOnMaps); |
| 1435 } | 1461 } |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 | 2107 |
| 2082 class HIsNull: public HUnaryPredicate { | 2108 class HIsNull: public HUnaryPredicate { |
| 2083 public: | 2109 public: |
| 2084 HIsNull(HValue* value, bool is_strict) | 2110 HIsNull(HValue* value, bool is_strict) |
| 2085 : HUnaryPredicate(value), is_strict_(is_strict) { } | 2111 : HUnaryPredicate(value), is_strict_(is_strict) { } |
| 2086 | 2112 |
| 2087 bool is_strict() const { return is_strict_; } | 2113 bool is_strict() const { return is_strict_; } |
| 2088 | 2114 |
| 2089 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is_null") | 2115 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is_null") |
| 2090 | 2116 |
| 2117 protected: |
| 2118 virtual bool DataEquals(HValue* other) const { |
| 2119 HIsNull* b = HIsNull::cast(other); |
| 2120 return is_strict_ == b->is_strict(); |
| 2121 } |
| 2122 |
| 2091 private: | 2123 private: |
| 2092 bool is_strict_; | 2124 bool is_strict_; |
| 2093 }; | 2125 }; |
| 2094 | 2126 |
| 2095 | 2127 |
| 2128 class HIsObject: public HUnaryPredicate { |
| 2129 public: |
| 2130 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } |
| 2131 |
| 2132 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object") |
| 2133 }; |
| 2134 |
| 2135 |
| 2096 class HIsSmi: public HUnaryPredicate { | 2136 class HIsSmi: public HUnaryPredicate { |
| 2097 public: | 2137 public: |
| 2098 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } | 2138 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } |
| 2099 | 2139 |
| 2100 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") | 2140 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") |
| 2101 }; | 2141 }; |
| 2102 | 2142 |
| 2103 | 2143 |
| 2104 class HHasInstanceType: public HUnaryPredicate { | 2144 class HHasInstanceType: public HUnaryPredicate { |
| 2105 public: | 2145 public: |
| 2106 HHasInstanceType(HValue* value, InstanceType type) | 2146 HHasInstanceType(HValue* value, InstanceType type) |
| 2107 : HUnaryPredicate(value), from_(type), to_(type) { } | 2147 : HUnaryPredicate(value), from_(type), to_(type) { } |
| 2108 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) | 2148 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) |
| 2109 : HUnaryPredicate(value), from_(from), to_(to) { | 2149 : HUnaryPredicate(value), from_(from), to_(to) { |
| 2110 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 2150 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
| 2111 } | 2151 } |
| 2112 | 2152 |
| 2113 InstanceType from() { return from_; } | 2153 InstanceType from() { return from_; } |
| 2114 InstanceType to() { return to_; } | 2154 InstanceType to() { return to_; } |
| 2115 | 2155 |
| 2116 virtual void PrintDataTo(StringStream* stream) const; | 2156 virtual void PrintDataTo(StringStream* stream) const; |
| 2117 | 2157 |
| 2118 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has_instance_type") | 2158 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has_instance_type") |
| 2119 | 2159 |
| 2160 protected: |
| 2161 virtual bool DataEquals(HValue* other) const { |
| 2162 HHasInstanceType* b = HHasInstanceType::cast(other); |
| 2163 return (from_ == b->from()) && (to_ == b->to()); |
| 2164 } |
| 2165 |
| 2120 private: | 2166 private: |
| 2121 InstanceType from_; | 2167 InstanceType from_; |
| 2122 InstanceType to_; // Inclusive range, not all combinations work. | 2168 InstanceType to_; // Inclusive range, not all combinations work. |
| 2123 }; | 2169 }; |
| 2124 | 2170 |
| 2125 | 2171 |
| 2126 class HHasCachedArrayIndex: public HUnaryPredicate { | 2172 class HHasCachedArrayIndex: public HUnaryPredicate { |
| 2127 public: | 2173 public: |
| 2128 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } | 2174 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } |
| 2129 | 2175 |
| 2130 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") | 2176 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") |
| 2131 }; | 2177 }; |
| 2132 | 2178 |
| 2133 | 2179 |
| 2134 class HClassOfTest: public HUnaryPredicate { | 2180 class HClassOfTest: public HUnaryPredicate { |
| 2135 public: | 2181 public: |
| 2136 HClassOfTest(HValue* value, Handle<String> class_name) | 2182 HClassOfTest(HValue* value, Handle<String> class_name) |
| 2137 : HUnaryPredicate(value), class_name_(class_name) { } | 2183 : HUnaryPredicate(value), class_name_(class_name) { } |
| 2138 | 2184 |
| 2139 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") | 2185 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") |
| 2140 | 2186 |
| 2141 virtual void PrintDataTo(StringStream* stream) const; | 2187 virtual void PrintDataTo(StringStream* stream) const; |
| 2142 | 2188 |
| 2143 Handle<String> class_name() const { return class_name_; } | 2189 Handle<String> class_name() const { return class_name_; } |
| 2144 | 2190 |
| 2191 protected: |
| 2192 virtual bool DataEquals(HValue* other) const { |
| 2193 HClassOfTest* b = HClassOfTest::cast(other); |
| 2194 return class_name_.is_identical_to(b->class_name_); |
| 2195 } |
| 2196 |
| 2145 private: | 2197 private: |
| 2146 Handle<String> class_name_; | 2198 Handle<String> class_name_; |
| 2147 }; | 2199 }; |
| 2148 | 2200 |
| 2149 | 2201 |
| 2150 class HTypeofIs: public HUnaryPredicate { | 2202 class HTypeofIs: public HUnaryPredicate { |
| 2151 public: | 2203 public: |
| 2152 HTypeofIs(HValue* value, Handle<String> type_literal) | 2204 HTypeofIs(HValue* value, Handle<String> type_literal) |
| 2153 : HUnaryPredicate(value), type_literal_(type_literal) { } | 2205 : HUnaryPredicate(value), type_literal_(type_literal) { } |
| 2154 | 2206 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2178 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2230 virtual bool EmitAtUses() const { return uses()->length() <= 1; } |
| 2179 | 2231 |
| 2180 virtual Representation RequiredInputRepresentation(int index) const { | 2232 virtual Representation RequiredInputRepresentation(int index) const { |
| 2181 return Representation::Tagged(); | 2233 return Representation::Tagged(); |
| 2182 } | 2234 } |
| 2183 | 2235 |
| 2184 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") | 2236 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") |
| 2185 }; | 2237 }; |
| 2186 | 2238 |
| 2187 | 2239 |
| 2240 class HPower: public HBinaryOperation { |
| 2241 public: |
| 2242 HPower(HValue* left, HValue* right) |
| 2243 : HBinaryOperation(left, right) { |
| 2244 set_representation(Representation::Double()); |
| 2245 SetFlag(kUseGVN); |
| 2246 } |
| 2247 |
| 2248 virtual Representation RequiredInputRepresentation(int index) const { |
| 2249 return (index == 1) ? Representation::None() : Representation::Double(); |
| 2250 } |
| 2251 |
| 2252 DECLARE_CONCRETE_INSTRUCTION(Power, "power") |
| 2253 }; |
| 2254 |
| 2255 |
| 2188 class HAdd: public HArithmeticBinaryOperation { | 2256 class HAdd: public HArithmeticBinaryOperation { |
| 2189 public: | 2257 public: |
| 2190 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2258 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| 2191 SetFlag(kCanOverflow); | 2259 SetFlag(kCanOverflow); |
| 2192 } | 2260 } |
| 2193 | 2261 |
| 2194 // Add is only commutative if two integer values are added and not if two | 2262 // Add is only commutative if two integer values are added and not if two |
| 2195 // tagged values are added (because it might be a String concatenation). | 2263 // tagged values are added (because it might be a String concatenation). |
| 2196 virtual bool IsCommutative() const { | 2264 virtual bool IsCommutative() const { |
| 2197 return !representation().IsTagged(); | 2265 return !representation().IsTagged(); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2877 HValue* object() const { return left(); } | 2945 HValue* object() const { return left(); } |
| 2878 HValue* key() const { return right(); } | 2946 HValue* key() const { return right(); } |
| 2879 }; | 2947 }; |
| 2880 | 2948 |
| 2881 #undef DECLARE_INSTRUCTION | 2949 #undef DECLARE_INSTRUCTION |
| 2882 #undef DECLARE_CONCRETE_INSTRUCTION | 2950 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2883 | 2951 |
| 2884 } } // namespace v8::internal | 2952 } } // namespace v8::internal |
| 2885 | 2953 |
| 2886 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 2954 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |