| 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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 length_rep = Representation::Smi(); | 940 length_rep = Representation::Smi(); |
| 941 } | 941 } |
| 942 Representation r = index_rep.generalize(length_rep); | 942 Representation r = index_rep.generalize(length_rep); |
| 943 if (r.is_more_general_than(Representation::Integer32())) { | 943 if (r.is_more_general_than(Representation::Integer32())) { |
| 944 r = Representation::Integer32(); | 944 r = Representation::Integer32(); |
| 945 } | 945 } |
| 946 UpdateRepresentation(r, h_infer, "boundscheck"); | 946 UpdateRepresentation(r, h_infer, "boundscheck"); |
| 947 } | 947 } |
| 948 | 948 |
| 949 | 949 |
| 950 Range* HBoundsCheck::InferRange(Zone* zone) { |
| 951 Representation r = representation(); |
| 952 if (r.IsSmiOrInteger32() && length()->HasRange()) { |
| 953 int upper = length()->range()->upper() - (allow_equality() ? 0 : 1); |
| 954 int lower = 0; |
| 955 |
| 956 Range* result = new(zone) Range(lower, upper); |
| 957 if (index()->HasRange()) { |
| 958 result->Intersect(index()->range()); |
| 959 } |
| 960 |
| 961 // In case of Smi representation, clamp result to Smi::kMaxValue. |
| 962 if (r.IsSmi()) result->ClampToSmi(); |
| 963 return result; |
| 964 } |
| 965 return HValue::InferRange(zone); |
| 966 } |
| 967 |
| 968 |
| 950 void HBoundsCheckBaseIndexInformation::PrintDataTo(StringStream* stream) { | 969 void HBoundsCheckBaseIndexInformation::PrintDataTo(StringStream* stream) { |
| 951 stream->Add("base: "); | 970 stream->Add("base: "); |
| 952 base_index()->PrintNameTo(stream); | 971 base_index()->PrintNameTo(stream); |
| 953 stream->Add(", check: "); | 972 stream->Add(", check: "); |
| 954 base_index()->PrintNameTo(stream); | 973 base_index()->PrintNameTo(stream); |
| 955 } | 974 } |
| 956 | 975 |
| 957 | 976 |
| 958 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 977 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 959 if (IsApplyFunction()) { | 978 if (IsApplyFunction()) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 HControlInstruction::PrintDataTo(stream); | 1112 HControlInstruction::PrintDataTo(stream); |
| 1094 } | 1113 } |
| 1095 | 1114 |
| 1096 | 1115 |
| 1097 const char* HUnaryMathOperation::OpName() const { | 1116 const char* HUnaryMathOperation::OpName() const { |
| 1098 switch (op()) { | 1117 switch (op()) { |
| 1099 case kMathFloor: return "floor"; | 1118 case kMathFloor: return "floor"; |
| 1100 case kMathRound: return "round"; | 1119 case kMathRound: return "round"; |
| 1101 case kMathAbs: return "abs"; | 1120 case kMathAbs: return "abs"; |
| 1102 case kMathLog: return "log"; | 1121 case kMathLog: return "log"; |
| 1103 case kMathSin: return "sin"; | |
| 1104 case kMathCos: return "cos"; | |
| 1105 case kMathTan: return "tan"; | |
| 1106 case kMathExp: return "exp"; | 1122 case kMathExp: return "exp"; |
| 1107 case kMathSqrt: return "sqrt"; | 1123 case kMathSqrt: return "sqrt"; |
| 1108 case kMathPowHalf: return "pow-half"; | 1124 case kMathPowHalf: return "pow-half"; |
| 1109 default: | 1125 default: |
| 1110 UNREACHABLE(); | 1126 UNREACHABLE(); |
| 1111 return NULL; | 1127 return NULL; |
| 1112 } | 1128 } |
| 1113 } | 1129 } |
| 1114 | 1130 |
| 1115 | 1131 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 } | 1271 } |
| 1256 // Optimize double negation, a common pattern used for ToInt32(x). | 1272 // Optimize double negation, a common pattern used for ToInt32(x). |
| 1257 HValue* arg; | 1273 HValue* arg; |
| 1258 if (MatchDoubleNegation(this, &arg) && !arg->CheckFlag(kUint32)) { | 1274 if (MatchDoubleNegation(this, &arg) && !arg->CheckFlag(kUint32)) { |
| 1259 return arg; | 1275 return arg; |
| 1260 } | 1276 } |
| 1261 return this; | 1277 return this; |
| 1262 } | 1278 } |
| 1263 | 1279 |
| 1264 | 1280 |
| 1281 Representation HAdd::RepresentationFromInputs() { |
| 1282 Representation left_rep = left()->representation(); |
| 1283 if (left_rep.IsExternal()) { |
| 1284 return Representation::External(); |
| 1285 } |
| 1286 return HArithmeticBinaryOperation::RepresentationFromInputs(); |
| 1287 } |
| 1288 |
| 1289 |
| 1290 Representation HAdd::RequiredInputRepresentation(int index) { |
| 1291 if (index == 2) { |
| 1292 Representation left_rep = left()->representation(); |
| 1293 if (left_rep.IsExternal()) { |
| 1294 return Representation::Integer32(); |
| 1295 } |
| 1296 } |
| 1297 return HArithmeticBinaryOperation::RequiredInputRepresentation(index); |
| 1298 } |
| 1299 |
| 1300 |
| 1265 static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) { | 1301 static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) { |
| 1266 return arg1->representation().IsSpecialization() && | 1302 return arg1->representation().IsSpecialization() && |
| 1267 arg2->EqualsInteger32Constant(identity); | 1303 arg2->EqualsInteger32Constant(identity); |
| 1268 } | 1304 } |
| 1269 | 1305 |
| 1270 | 1306 |
| 1271 HValue* HAdd::Canonicalize() { | 1307 HValue* HAdd::Canonicalize() { |
| 1272 // Adding 0 is an identity operation except in case of -0: -0 + 0 = +0 | 1308 // Adding 0 is an identity operation except in case of -0: -0 + 0 = +0 |
| 1273 if (IsIdentityOperation(left(), right(), 0) && | 1309 if (IsIdentityOperation(left(), right(), 0) && |
| 1274 !left()->representation().IsDouble()) { // Left could be -0. | 1310 !left()->representation().IsDouble()) { // Left could be -0. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 | 1526 |
| 1491 | 1527 |
| 1492 void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) { | 1528 void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) { |
| 1493 ASSERT(!is_interval_check()); | 1529 ASSERT(!is_interval_check()); |
| 1494 switch (check_) { | 1530 switch (check_) { |
| 1495 case IS_STRING: | 1531 case IS_STRING: |
| 1496 *mask = kIsNotStringMask; | 1532 *mask = kIsNotStringMask; |
| 1497 *tag = kStringTag; | 1533 *tag = kStringTag; |
| 1498 return; | 1534 return; |
| 1499 case IS_INTERNALIZED_STRING: | 1535 case IS_INTERNALIZED_STRING: |
| 1500 *mask = kIsNotInternalizedMask; | 1536 *mask = kIsNotStringMask | kIsNotInternalizedMask; |
| 1501 *tag = kInternalizedTag; | 1537 *tag = kInternalizedTag; |
| 1502 return; | 1538 return; |
| 1503 default: | 1539 default: |
| 1504 UNREACHABLE(); | 1540 UNREACHABLE(); |
| 1505 } | 1541 } |
| 1506 } | 1542 } |
| 1507 | 1543 |
| 1508 | 1544 |
| 1509 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, | 1545 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, |
| 1510 HValue* dominator) { | 1546 HValue* dominator) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 | 1769 |
| 1734 | 1770 |
| 1735 Range* HDiv::InferRange(Zone* zone) { | 1771 Range* HDiv::InferRange(Zone* zone) { |
| 1736 if (representation().IsInteger32()) { | 1772 if (representation().IsInteger32()) { |
| 1737 Range* a = left()->range(); | 1773 Range* a = left()->range(); |
| 1738 Range* b = right()->range(); | 1774 Range* b = right()->range(); |
| 1739 Range* result = new(zone) Range(); | 1775 Range* result = new(zone) Range(); |
| 1740 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && | 1776 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && |
| 1741 (a->CanBeMinusZero() || | 1777 (a->CanBeMinusZero() || |
| 1742 (a->CanBeZero() && b->CanBeNegative()))); | 1778 (a->CanBeZero() && b->CanBeNegative()))); |
| 1743 if (!a->Includes(kMinInt) || | 1779 if (!a->Includes(kMinInt) || !b->Includes(-1)) { |
| 1744 !b->Includes(-1) || | |
| 1745 CheckFlag(kAllUsesTruncatingToInt32)) { | |
| 1746 // It is safe to clear kCanOverflow when kAllUsesTruncatingToInt32. | |
| 1747 ClearFlag(HValue::kCanOverflow); | 1780 ClearFlag(HValue::kCanOverflow); |
| 1748 } | 1781 } |
| 1749 | 1782 |
| 1750 if (!b->CanBeZero()) { | 1783 if (!b->CanBeZero()) { |
| 1751 ClearFlag(HValue::kCanBeDivByZero); | 1784 ClearFlag(HValue::kCanBeDivByZero); |
| 1752 } | 1785 } |
| 1753 return result; | 1786 return result; |
| 1754 } else { | 1787 } else { |
| 1755 return HValue::InferRange(zone); | 1788 return HValue::InferRange(zone); |
| 1756 } | 1789 } |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2455 | 2488 |
| 2456 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, | 2489 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, |
| 2457 Zone* zone) { | 2490 Zone* zone) { |
| 2458 ASSERT(return_target->IsInlineReturnTarget()); | 2491 ASSERT(return_target->IsInlineReturnTarget()); |
| 2459 return_targets_.Add(return_target, zone); | 2492 return_targets_.Add(return_target, zone); |
| 2460 } | 2493 } |
| 2461 | 2494 |
| 2462 | 2495 |
| 2463 void HEnterInlined::PrintDataTo(StringStream* stream) { | 2496 void HEnterInlined::PrintDataTo(StringStream* stream) { |
| 2464 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); | 2497 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); |
| 2465 stream->Add("%s, id=%d", *name, function()->id().ToInt()); | 2498 stream->Add("%s, id=%d", name.get(), function()->id().ToInt()); |
| 2466 } | 2499 } |
| 2467 | 2500 |
| 2468 | 2501 |
| 2469 static bool IsInteger32(double value) { | 2502 static bool IsInteger32(double value) { |
| 2470 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value)); | 2503 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value)); |
| 2471 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); | 2504 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); |
| 2472 } | 2505 } |
| 2473 | 2506 |
| 2474 | 2507 |
| 2475 HConstant::HConstant(Handle<Object> handle, Representation r) | 2508 HConstant::HConstant(Handle<Object> handle, Representation r) |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3066 DependentCode::kPrototypeCheckGroup, info); | 3099 DependentCode::kPrototypeCheckGroup, info); |
| 3067 } | 3100 } |
| 3068 } | 3101 } |
| 3069 return check_map; | 3102 return check_map; |
| 3070 } | 3103 } |
| 3071 | 3104 |
| 3072 | 3105 |
| 3073 void HLoadNamedGeneric::PrintDataTo(StringStream* stream) { | 3106 void HLoadNamedGeneric::PrintDataTo(StringStream* stream) { |
| 3074 object()->PrintNameTo(stream); | 3107 object()->PrintNameTo(stream); |
| 3075 stream->Add("."); | 3108 stream->Add("."); |
| 3076 stream->Add(*String::cast(*name())->ToCString()); | 3109 stream->Add(String::cast(*name())->ToCString().get()); |
| 3077 } | 3110 } |
| 3078 | 3111 |
| 3079 | 3112 |
| 3080 void HLoadKeyed::PrintDataTo(StringStream* stream) { | 3113 void HLoadKeyed::PrintDataTo(StringStream* stream) { |
| 3081 if (!is_external()) { | 3114 if (!is_external()) { |
| 3082 elements()->PrintNameTo(stream); | 3115 elements()->PrintNameTo(stream); |
| 3083 } else { | 3116 } else { |
| 3084 ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && | 3117 ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
| 3085 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); | 3118 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); |
| 3086 elements()->PrintNameTo(stream); | 3119 elements()->PrintNameTo(stream); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3204 } | 3237 } |
| 3205 | 3238 |
| 3206 return this; | 3239 return this; |
| 3207 } | 3240 } |
| 3208 | 3241 |
| 3209 | 3242 |
| 3210 void HStoreNamedGeneric::PrintDataTo(StringStream* stream) { | 3243 void HStoreNamedGeneric::PrintDataTo(StringStream* stream) { |
| 3211 object()->PrintNameTo(stream); | 3244 object()->PrintNameTo(stream); |
| 3212 stream->Add("."); | 3245 stream->Add("."); |
| 3213 ASSERT(name()->IsString()); | 3246 ASSERT(name()->IsString()); |
| 3214 stream->Add(*String::cast(*name())->ToCString()); | 3247 stream->Add(String::cast(*name())->ToCString().get()); |
| 3215 stream->Add(" = "); | 3248 stream->Add(" = "); |
| 3216 value()->PrintNameTo(stream); | 3249 value()->PrintNameTo(stream); |
| 3217 } | 3250 } |
| 3218 | 3251 |
| 3219 | 3252 |
| 3220 void HStoreNamedField::PrintDataTo(StringStream* stream) { | 3253 void HStoreNamedField::PrintDataTo(StringStream* stream) { |
| 3221 object()->PrintNameTo(stream); | 3254 object()->PrintNameTo(stream); |
| 3222 access_.PrintTo(stream); | 3255 access_.PrintTo(stream); |
| 3223 stream->Add(" = "); | 3256 stream->Add(" = "); |
| 3224 value()->PrintNameTo(stream); | 3257 value()->PrintNameTo(stream); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3459 dominator_allocate->ClearNextMapWord(original_object_size); | 3492 dominator_allocate->ClearNextMapWord(original_object_size); |
| 3460 #endif | 3493 #endif |
| 3461 | 3494 |
| 3462 dominator_allocate->clear_next_map_word_ = clear_next_map_word_; | 3495 dominator_allocate->clear_next_map_word_ = clear_next_map_word_; |
| 3463 | 3496 |
| 3464 // After that replace the dominated allocate instruction. | 3497 // After that replace the dominated allocate instruction. |
| 3465 HInstruction* dominated_allocate_instr = | 3498 HInstruction* dominated_allocate_instr = |
| 3466 HInnerAllocatedObject::New(zone, | 3499 HInnerAllocatedObject::New(zone, |
| 3467 context(), | 3500 context(), |
| 3468 dominator_allocate, | 3501 dominator_allocate, |
| 3469 dominator_size_constant, | 3502 dominator_size, |
| 3470 type()); | 3503 type()); |
| 3471 dominated_allocate_instr->InsertBefore(this); | 3504 dominated_allocate_instr->InsertBefore(this); |
| 3472 DeleteAndReplaceWith(dominated_allocate_instr); | 3505 DeleteAndReplaceWith(dominated_allocate_instr); |
| 3473 if (FLAG_trace_allocation_folding) { | 3506 if (FLAG_trace_allocation_folding) { |
| 3474 PrintF("#%d (%s) folded into #%d (%s)\n", | 3507 PrintF("#%d (%s) folded into #%d (%s)\n", |
| 3475 id(), Mnemonic(), dominator_allocate->id(), | 3508 id(), Mnemonic(), dominator_allocate->id(), |
| 3476 dominator_allocate->Mnemonic()); | 3509 dominator_allocate->Mnemonic()); |
| 3477 } | 3510 } |
| 3478 } | 3511 } |
| 3479 | 3512 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3555 free_space_size, | 3588 free_space_size, |
| 3556 Representation::Smi(), | 3589 Representation::Smi(), |
| 3557 filler_free_space_size_); | 3590 filler_free_space_size_); |
| 3558 filler_free_space_size_->UpdateValue(new_free_space_size); | 3591 filler_free_space_size_->UpdateValue(new_free_space_size); |
| 3559 } | 3592 } |
| 3560 | 3593 |
| 3561 | 3594 |
| 3562 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { | 3595 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { |
| 3563 ASSERT(filler_free_space_size_ == NULL); | 3596 ASSERT(filler_free_space_size_ == NULL); |
| 3564 Zone* zone = block()->zone(); | 3597 Zone* zone = block()->zone(); |
| 3565 int32_t dominator_size = | |
| 3566 HConstant::cast(dominating_allocate_->size())->GetInteger32Constant(); | |
| 3567 HInstruction* free_space_instr = | 3598 HInstruction* free_space_instr = |
| 3568 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, | 3599 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, |
| 3569 dominator_size, type()); | 3600 dominating_allocate_->size(), type()); |
| 3570 free_space_instr->InsertBefore(this); | 3601 free_space_instr->InsertBefore(this); |
| 3571 HConstant* filler_map = HConstant::New( | 3602 HConstant* filler_map = HConstant::New( |
| 3572 zone, | 3603 zone, |
| 3573 context(), | 3604 context(), |
| 3574 isolate()->factory()->free_space_map()); | 3605 isolate()->factory()->free_space_map()); |
| 3575 filler_map->FinalizeUniqueness(); // TODO(titzer): should be init'd a'ready | 3606 filler_map->FinalizeUniqueness(); // TODO(titzer): should be init'd a'ready |
| 3576 filler_map->InsertAfter(free_space_instr); | 3607 filler_map->InsertAfter(free_space_instr); |
| 3577 HInstruction* store_map = HStoreNamedField::New(zone, context(), | 3608 HInstruction* store_map = HStoreNamedField::New(zone, context(), |
| 3578 free_space_instr, HObjectAccess::ForMap(), filler_map); | 3609 free_space_instr, HObjectAccess::ForMap(), filler_map); |
| 3579 store_map->SetFlag(HValue::kHasNoObservableSideEffects); | 3610 store_map->SetFlag(HValue::kHasNoObservableSideEffects); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3815 if (!FLAG_fold_constants) break; | 3846 if (!FLAG_fold_constants) break; |
| 3816 if (!value->IsConstant()) break; | 3847 if (!value->IsConstant()) break; |
| 3817 HConstant* constant = HConstant::cast(value); | 3848 HConstant* constant = HConstant::cast(value); |
| 3818 if (!constant->HasNumberValue()) break; | 3849 if (!constant->HasNumberValue()) break; |
| 3819 double d = constant->DoubleValue(); | 3850 double d = constant->DoubleValue(); |
| 3820 if (std::isnan(d)) { // NaN poisons everything. | 3851 if (std::isnan(d)) { // NaN poisons everything. |
| 3821 return H_CONSTANT_DOUBLE(OS::nan_value()); | 3852 return H_CONSTANT_DOUBLE(OS::nan_value()); |
| 3822 } | 3853 } |
| 3823 if (std::isinf(d)) { // +Infinity and -Infinity. | 3854 if (std::isinf(d)) { // +Infinity and -Infinity. |
| 3824 switch (op) { | 3855 switch (op) { |
| 3825 case kMathSin: | |
| 3826 case kMathCos: | |
| 3827 case kMathTan: | |
| 3828 return H_CONSTANT_DOUBLE(OS::nan_value()); | |
| 3829 case kMathExp: | 3856 case kMathExp: |
| 3830 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); | 3857 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); |
| 3831 case kMathLog: | 3858 case kMathLog: |
| 3832 case kMathSqrt: | 3859 case kMathSqrt: |
| 3833 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value()); | 3860 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value()); |
| 3834 case kMathPowHalf: | 3861 case kMathPowHalf: |
| 3835 case kMathAbs: | 3862 case kMathAbs: |
| 3836 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d); | 3863 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d); |
| 3837 case kMathRound: | 3864 case kMathRound: |
| 3838 case kMathFloor: | 3865 case kMathFloor: |
| 3839 return H_CONSTANT_DOUBLE(d); | 3866 return H_CONSTANT_DOUBLE(d); |
| 3840 default: | 3867 default: |
| 3841 UNREACHABLE(); | 3868 UNREACHABLE(); |
| 3842 break; | 3869 break; |
| 3843 } | 3870 } |
| 3844 } | 3871 } |
| 3845 switch (op) { | 3872 switch (op) { |
| 3846 case kMathSin: | |
| 3847 return H_CONSTANT_DOUBLE(fast_sin(d)); | |
| 3848 case kMathCos: | |
| 3849 return H_CONSTANT_DOUBLE(fast_cos(d)); | |
| 3850 case kMathTan: | |
| 3851 return H_CONSTANT_DOUBLE(fast_tan(d)); | |
| 3852 case kMathExp: | 3873 case kMathExp: |
| 3853 return H_CONSTANT_DOUBLE(fast_exp(d)); | 3874 return H_CONSTANT_DOUBLE(fast_exp(d)); |
| 3854 case kMathLog: | 3875 case kMathLog: |
| 3855 return H_CONSTANT_DOUBLE(fast_log(d)); | 3876 return H_CONSTANT_DOUBLE(fast_log(d)); |
| 3856 case kMathSqrt: | 3877 case kMathSqrt: |
| 3857 return H_CONSTANT_DOUBLE(fast_sqrt(d)); | 3878 return H_CONSTANT_DOUBLE(fast_sqrt(d)); |
| 3858 case kMathPowHalf: | 3879 case kMathPowHalf: |
| 3859 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); | 3880 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); |
| 3860 case kMathAbs: | 3881 case kMathAbs: |
| 3861 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); | 3882 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4225 | 4246 |
| 4226 if (offset == JSObject::kElementsOffset) { | 4247 if (offset == JSObject::kElementsOffset) { |
| 4227 portion = kElementsPointer; | 4248 portion = kElementsPointer; |
| 4228 } else if (offset == JSObject::kMapOffset) { | 4249 } else if (offset == JSObject::kMapOffset) { |
| 4229 portion = kMaps; | 4250 portion = kMaps; |
| 4230 } | 4251 } |
| 4231 return HObjectAccess(portion, offset, representation); | 4252 return HObjectAccess(portion, offset, representation); |
| 4232 } | 4253 } |
| 4233 | 4254 |
| 4234 | 4255 |
| 4256 HObjectAccess HObjectAccess::ForAllocationSiteOffset(int offset) { |
| 4257 switch (offset) { |
| 4258 case AllocationSite::kTransitionInfoOffset: |
| 4259 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4260 case AllocationSite::kNestedSiteOffset: |
| 4261 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4262 case AllocationSite::kMementoFoundCountOffset: |
| 4263 return HObjectAccess(kInobject, offset, Representation::Smi()); |
| 4264 case AllocationSite::kMementoCreateCountOffset: |
| 4265 return HObjectAccess(kInobject, offset, Representation::Smi()); |
| 4266 case AllocationSite::kPretenureDecisionOffset: |
| 4267 return HObjectAccess(kInobject, offset, Representation::Smi()); |
| 4268 case AllocationSite::kDependentCodeOffset: |
| 4269 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4270 case AllocationSite::kWeakNextOffset: |
| 4271 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4272 default: |
| 4273 UNREACHABLE(); |
| 4274 } |
| 4275 return HObjectAccess(kInobject, offset); |
| 4276 } |
| 4277 |
| 4278 |
| 4235 HObjectAccess HObjectAccess::ForContextSlot(int index) { | 4279 HObjectAccess HObjectAccess::ForContextSlot(int index) { |
| 4236 ASSERT(index >= 0); | 4280 ASSERT(index >= 0); |
| 4237 Portion portion = kInobject; | 4281 Portion portion = kInobject; |
| 4238 int offset = Context::kHeaderSize + index * kPointerSize; | 4282 int offset = Context::kHeaderSize + index * kPointerSize; |
| 4239 ASSERT_EQ(offset, Context::SlotOffset(index) + kHeapObjectTag); | 4283 ASSERT_EQ(offset, Context::SlotOffset(index) + kHeapObjectTag); |
| 4240 return HObjectAccess(portion, offset, Representation::Tagged()); | 4284 return HObjectAccess(portion, offset, Representation::Tagged()); |
| 4241 } | 4285 } |
| 4242 | 4286 |
| 4243 | 4287 |
| 4244 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { | 4288 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4358 stream->Add("%length"); | 4402 stream->Add("%length"); |
| 4359 break; | 4403 break; |
| 4360 case kElementsPointer: | 4404 case kElementsPointer: |
| 4361 stream->Add("%elements"); | 4405 stream->Add("%elements"); |
| 4362 break; | 4406 break; |
| 4363 case kMaps: | 4407 case kMaps: |
| 4364 stream->Add("%map"); | 4408 stream->Add("%map"); |
| 4365 break; | 4409 break; |
| 4366 case kDouble: // fall through | 4410 case kDouble: // fall through |
| 4367 case kInobject: | 4411 case kInobject: |
| 4368 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 4412 if (!name_.is_null()) { |
| 4413 stream->Add(String::cast(*name_)->ToCString().get()); |
| 4414 } |
| 4369 stream->Add("[in-object]"); | 4415 stream->Add("[in-object]"); |
| 4370 break; | 4416 break; |
| 4371 case kBackingStore: | 4417 case kBackingStore: |
| 4372 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 4418 if (!name_.is_null()) { |
| 4419 stream->Add(String::cast(*name_)->ToCString().get()); |
| 4420 } |
| 4373 stream->Add("[backing-store]"); | 4421 stream->Add("[backing-store]"); |
| 4374 break; | 4422 break; |
| 4375 case kExternalMemory: | 4423 case kExternalMemory: |
| 4376 stream->Add("[external-memory]"); | 4424 stream->Add("[external-memory]"); |
| 4377 break; | 4425 break; |
| 4378 } | 4426 } |
| 4379 | 4427 |
| 4380 stream->Add("@%d", offset()); | 4428 stream->Add("@%d", offset()); |
| 4381 } | 4429 } |
| 4382 | 4430 |
| 4383 } } // namespace v8::internal | 4431 } } // namespace v8::internal |
| OLD | NEW |