Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: src/hydrogen-instructions.cc

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/hydrogen-load-elimination.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 value()->PrintNameTo(stream); 1372 value()->PrintNameTo(stream);
1373 } 1373 }
1374 1374
1375 1375
1376 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, 1376 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context,
1377 HValue* value, Representation required_representation) { 1377 HValue* value, Representation required_representation) {
1378 if (FLAG_fold_constants && value->IsConstant()) { 1378 if (FLAG_fold_constants && value->IsConstant()) {
1379 HConstant* c = HConstant::cast(value); 1379 HConstant* c = HConstant::cast(value);
1380 if (c->HasNumberValue()) { 1380 if (c->HasNumberValue()) {
1381 double double_res = c->DoubleValue(); 1381 double double_res = c->DoubleValue();
1382 if (TypeInfo::IsInt32Double(double_res)) { 1382 if (IsInt32Double(double_res)) {
1383 return HConstant::New(zone, context, 1383 return HConstant::New(zone, context,
1384 static_cast<int32_t>(double_res), 1384 static_cast<int32_t>(double_res),
1385 required_representation); 1385 required_representation);
1386 } 1386 }
1387 } 1387 }
1388 } 1388 }
1389 return new(zone) HForceRepresentation(value, required_representation); 1389 return new(zone) HForceRepresentation(value, required_representation);
1390 } 1390 }
1391 1391
1392 1392
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 1528
1529 1529
1530 void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) { 1530 void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) {
1531 ASSERT(!is_interval_check()); 1531 ASSERT(!is_interval_check());
1532 switch (check_) { 1532 switch (check_) {
1533 case IS_STRING: 1533 case IS_STRING:
1534 *mask = kIsNotStringMask; 1534 *mask = kIsNotStringMask;
1535 *tag = kStringTag; 1535 *tag = kStringTag;
1536 return; 1536 return;
1537 case IS_INTERNALIZED_STRING: 1537 case IS_INTERNALIZED_STRING:
1538 *mask = kIsNotInternalizedMask; 1538 *mask = kIsNotStringMask | kIsNotInternalizedMask;
1539 *tag = kInternalizedTag; 1539 *tag = kInternalizedTag;
1540 return; 1540 return;
1541 default: 1541 default:
1542 UNREACHABLE(); 1542 UNREACHABLE();
1543 } 1543 }
1544 } 1544 }
1545 1545
1546 1546
1547 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, 1547 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect,
1548 HValue* dominator) { 1548 HValue* dominator) {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 1771
1772 1772
1773 Range* HDiv::InferRange(Zone* zone) { 1773 Range* HDiv::InferRange(Zone* zone) {
1774 if (representation().IsInteger32()) { 1774 if (representation().IsInteger32()) {
1775 Range* a = left()->range(); 1775 Range* a = left()->range();
1776 Range* b = right()->range(); 1776 Range* b = right()->range();
1777 Range* result = new(zone) Range(); 1777 Range* result = new(zone) Range();
1778 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && 1778 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) &&
1779 (a->CanBeMinusZero() || 1779 (a->CanBeMinusZero() ||
1780 (a->CanBeZero() && b->CanBeNegative()))); 1780 (a->CanBeZero() && b->CanBeNegative())));
1781 if (!a->Includes(kMinInt) || 1781 if (!a->Includes(kMinInt) || !b->Includes(-1)) {
1782 !b->Includes(-1) ||
1783 CheckFlag(kAllUsesTruncatingToInt32)) {
1784 // It is safe to clear kCanOverflow when kAllUsesTruncatingToInt32.
1785 ClearFlag(HValue::kCanOverflow); 1782 ClearFlag(HValue::kCanOverflow);
1786 } 1783 }
1787 1784
1788 if (!b->CanBeZero()) { 1785 if (!b->CanBeZero()) {
1789 ClearFlag(HValue::kCanBeDivByZero); 1786 ClearFlag(HValue::kCanBeDivByZero);
1790 } 1787 }
1791 return result; 1788 return result;
1792 } else { 1789 } else {
1793 return HValue::InferRange(zone); 1790 return HValue::InferRange(zone);
1794 } 1791 }
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 2490
2494 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, 2491 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target,
2495 Zone* zone) { 2492 Zone* zone) {
2496 ASSERT(return_target->IsInlineReturnTarget()); 2493 ASSERT(return_target->IsInlineReturnTarget());
2497 return_targets_.Add(return_target, zone); 2494 return_targets_.Add(return_target, zone);
2498 } 2495 }
2499 2496
2500 2497
2501 void HEnterInlined::PrintDataTo(StringStream* stream) { 2498 void HEnterInlined::PrintDataTo(StringStream* stream) {
2502 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); 2499 SmartArrayPointer<char> name = function()->debug_name()->ToCString();
2503 stream->Add("%s, id=%d", *name, function()->id().ToInt()); 2500 stream->Add("%s, id=%d", name.get(), function()->id().ToInt());
2504 } 2501 }
2505 2502
2506 2503
2507 static bool IsInteger32(double value) { 2504 static bool IsInteger32(double value) {
2508 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value)); 2505 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value));
2509 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); 2506 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value);
2510 } 2507 }
2511 2508
2512 2509
2513 HConstant::HConstant(Handle<Object> handle, Representation r) 2510 HConstant::HConstant(Handle<Object> handle, Representation r)
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 DependentCode::kPrototypeCheckGroup, info); 3101 DependentCode::kPrototypeCheckGroup, info);
3105 } 3102 }
3106 } 3103 }
3107 return check_map; 3104 return check_map;
3108 } 3105 }
3109 3106
3110 3107
3111 void HLoadNamedGeneric::PrintDataTo(StringStream* stream) { 3108 void HLoadNamedGeneric::PrintDataTo(StringStream* stream) {
3112 object()->PrintNameTo(stream); 3109 object()->PrintNameTo(stream);
3113 stream->Add("."); 3110 stream->Add(".");
3114 stream->Add(*String::cast(*name())->ToCString()); 3111 stream->Add(String::cast(*name())->ToCString().get());
3115 } 3112 }
3116 3113
3117 3114
3118 void HLoadKeyed::PrintDataTo(StringStream* stream) { 3115 void HLoadKeyed::PrintDataTo(StringStream* stream) {
3119 if (!is_external()) { 3116 if (!is_external()) {
3120 elements()->PrintNameTo(stream); 3117 elements()->PrintNameTo(stream);
3121 } else { 3118 } else {
3122 ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && 3119 ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND &&
3123 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); 3120 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND);
3124 elements()->PrintNameTo(stream); 3121 elements()->PrintNameTo(stream);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 } 3239 }
3243 3240
3244 return this; 3241 return this;
3245 } 3242 }
3246 3243
3247 3244
3248 void HStoreNamedGeneric::PrintDataTo(StringStream* stream) { 3245 void HStoreNamedGeneric::PrintDataTo(StringStream* stream) {
3249 object()->PrintNameTo(stream); 3246 object()->PrintNameTo(stream);
3250 stream->Add("."); 3247 stream->Add(".");
3251 ASSERT(name()->IsString()); 3248 ASSERT(name()->IsString());
3252 stream->Add(*String::cast(*name())->ToCString()); 3249 stream->Add(String::cast(*name())->ToCString().get());
3253 stream->Add(" = "); 3250 stream->Add(" = ");
3254 value()->PrintNameTo(stream); 3251 value()->PrintNameTo(stream);
3255 } 3252 }
3256 3253
3257 3254
3258 void HStoreNamedField::PrintDataTo(StringStream* stream) { 3255 void HStoreNamedField::PrintDataTo(StringStream* stream) {
3259 object()->PrintNameTo(stream); 3256 object()->PrintNameTo(stream);
3260 access_.PrintTo(stream); 3257 access_.PrintTo(stream);
3261 stream->Add(" = "); 3258 stream->Add(" = ");
3262 value()->PrintNameTo(stream); 3259 value()->PrintNameTo(stream);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3490 // TODO(hpayer): This is a short-term hack to make allocation mementos 3487 // TODO(hpayer): This is a short-term hack to make allocation mementos
3491 // work again in new space. 3488 // work again in new space.
3492 dominator_allocate->ClearNextMapWord(original_object_size); 3489 dominator_allocate->ClearNextMapWord(original_object_size);
3493 } 3490 }
3494 #else 3491 #else
3495 // TODO(hpayer): This is a short-term hack to make allocation mementos 3492 // TODO(hpayer): This is a short-term hack to make allocation mementos
3496 // work again in new space. 3493 // work again in new space.
3497 dominator_allocate->ClearNextMapWord(original_object_size); 3494 dominator_allocate->ClearNextMapWord(original_object_size);
3498 #endif 3495 #endif
3499 3496
3500 dominator_allocate->clear_next_map_word_ = clear_next_map_word_; 3497 dominator_allocate->UpdateClearNextMapWord(MustClearNextMapWord());
3501 3498
3502 // After that replace the dominated allocate instruction. 3499 // After that replace the dominated allocate instruction.
3500 HInstruction* inner_offset = HConstant::CreateAndInsertBefore(
3501 zone,
3502 context(),
3503 dominator_size_constant,
3504 Representation::None(),
3505 this);
3506
3503 HInstruction* dominated_allocate_instr = 3507 HInstruction* dominated_allocate_instr =
3504 HInnerAllocatedObject::New(zone, 3508 HInnerAllocatedObject::New(zone,
3505 context(), 3509 context(),
3506 dominator_allocate, 3510 dominator_allocate,
3507 dominator_size, 3511 inner_offset,
3508 type()); 3512 type());
3509 dominated_allocate_instr->InsertBefore(this); 3513 dominated_allocate_instr->InsertBefore(this);
3510 DeleteAndReplaceWith(dominated_allocate_instr); 3514 DeleteAndReplaceWith(dominated_allocate_instr);
3511 if (FLAG_trace_allocation_folding) { 3515 if (FLAG_trace_allocation_folding) {
3512 PrintF("#%d (%s) folded into #%d (%s)\n", 3516 PrintF("#%d (%s) folded into #%d (%s)\n",
3513 id(), Mnemonic(), dominator_allocate->id(), 3517 id(), Mnemonic(), dominator_allocate->id(),
3514 dominator_allocate->Mnemonic()); 3518 dominator_allocate->Mnemonic());
3515 } 3519 }
3516 } 3520 }
3517 3521
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 Representation::Smi()); 3630 Representation::Smi());
3627 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), 3631 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(),
3628 free_space_instr, access, filler_size); 3632 free_space_instr, access, filler_size);
3629 store_size->SetFlag(HValue::kHasNoObservableSideEffects); 3633 store_size->SetFlag(HValue::kHasNoObservableSideEffects);
3630 store_size->InsertAfter(filler_size); 3634 store_size->InsertAfter(filler_size);
3631 filler_free_space_size_ = store_size; 3635 filler_free_space_size_ = store_size;
3632 } 3636 }
3633 3637
3634 3638
3635 void HAllocate::ClearNextMapWord(int offset) { 3639 void HAllocate::ClearNextMapWord(int offset) {
3636 if (clear_next_map_word_) { 3640 if (MustClearNextMapWord()) {
3637 Zone* zone = block()->zone(); 3641 Zone* zone = block()->zone();
3638 HObjectAccess access = HObjectAccess::ForJSObjectOffset(offset); 3642 HObjectAccess access = HObjectAccess::ForJSObjectOffset(offset);
3639 HStoreNamedField* clear_next_map = 3643 HStoreNamedField* clear_next_map =
3640 HStoreNamedField::New(zone, context(), this, access, 3644 HStoreNamedField::New(zone, context(), this, access,
3641 block()->graph()->GetConstantNull()); 3645 block()->graph()->GetConstant0());
3642 clear_next_map->ClearAllSideEffects(); 3646 clear_next_map->ClearAllSideEffects();
3643 clear_next_map->InsertAfter(this); 3647 clear_next_map->InsertAfter(this);
3644 } 3648 }
3645 } 3649 }
3646 3650
3647 3651
3648 void HAllocate::PrintDataTo(StringStream* stream) { 3652 void HAllocate::PrintDataTo(StringStream* stream) {
3649 size()->PrintNameTo(stream); 3653 size()->PrintNameTo(stream);
3650 stream->Add(" ("); 3654 stream->Add(" (");
3651 if (IsNewSpaceAllocation()) stream->Add("N"); 3655 if (IsNewSpaceAllocation()) stream->Add("N");
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3785 HConstant::New(zone, context, static_cast<double>(val)) 3789 HConstant::New(zone, context, static_cast<double>(val))
3786 3790
3787 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ 3791 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \
3788 HInstruction* HInstr::New( \ 3792 HInstruction* HInstr::New( \
3789 Zone* zone, HValue* context, HValue* left, HValue* right) { \ 3793 Zone* zone, HValue* context, HValue* left, HValue* right) { \
3790 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \ 3794 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \
3791 HConstant* c_left = HConstant::cast(left); \ 3795 HConstant* c_left = HConstant::cast(left); \
3792 HConstant* c_right = HConstant::cast(right); \ 3796 HConstant* c_right = HConstant::cast(right); \
3793 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ 3797 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \
3794 double double_res = c_left->DoubleValue() op c_right->DoubleValue(); \ 3798 double double_res = c_left->DoubleValue() op c_right->DoubleValue(); \
3795 if (TypeInfo::IsInt32Double(double_res)) { \ 3799 if (IsInt32Double(double_res)) { \
3796 return H_CONSTANT_INT(double_res); \ 3800 return H_CONSTANT_INT(double_res); \
3797 } \ 3801 } \
3798 return H_CONSTANT_DOUBLE(double_res); \ 3802 return H_CONSTANT_DOUBLE(double_res); \
3799 } \ 3803 } \
3800 } \ 3804 } \
3801 return new(zone) HInstr(context, left, right); \ 3805 return new(zone) HInstr(context, left, right); \
3802 } 3806 }
3803 3807
3804 3808
3805 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +) 3809 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +)
3806 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *) 3810 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *)
3807 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) 3811 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -)
3808 3812
3809 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR 3813 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR
3810 3814
3811 3815
3812 HInstruction* HStringAdd::New(Zone* zone, 3816 HInstruction* HStringAdd::New(Zone* zone,
3813 HValue* context, 3817 HValue* context,
3814 HValue* left, 3818 HValue* left,
3815 HValue* right, 3819 HValue* right,
3816 StringAddFlags flags) { 3820 PretenureFlag pretenure_flag,
3821 StringAddFlags flags,
3822 Handle<AllocationSite> allocation_site) {
3817 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3823 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3818 HConstant* c_right = HConstant::cast(right); 3824 HConstant* c_right = HConstant::cast(right);
3819 HConstant* c_left = HConstant::cast(left); 3825 HConstant* c_left = HConstant::cast(left);
3820 if (c_left->HasStringValue() && c_right->HasStringValue()) { 3826 if (c_left->HasStringValue() && c_right->HasStringValue()) {
3821 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( 3827 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString(
3822 c_left->StringValue(), c_right->StringValue()); 3828 c_left->StringValue(), c_right->StringValue());
3823 return HConstant::New(zone, context, concat); 3829 return HConstant::New(zone, context, concat);
3824 } 3830 }
3825 } 3831 }
3826 return new(zone) HStringAdd(context, left, right, flags); 3832 return new(zone) HStringAdd(
3833 context, left, right, pretenure_flag, flags, allocation_site);
3827 } 3834 }
3828 3835
3829 3836
3837 void HStringAdd::PrintDataTo(StringStream* stream) {
3838 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
3839 stream->Add("_CheckBoth");
3840 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_LEFT) {
3841 stream->Add("_CheckLeft");
3842 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_RIGHT) {
3843 stream->Add("_CheckRight");
3844 }
3845 stream->Add(" (");
3846 if (pretenure_flag() == NOT_TENURED) stream->Add("N");
3847 else if (pretenure_flag() == TENURED) stream->Add("D");
3848 stream->Add(")");
3849 }
3850
3851
3830 HInstruction* HStringCharFromCode::New( 3852 HInstruction* HStringCharFromCode::New(
3831 Zone* zone, HValue* context, HValue* char_code) { 3853 Zone* zone, HValue* context, HValue* char_code) {
3832 if (FLAG_fold_constants && char_code->IsConstant()) { 3854 if (FLAG_fold_constants && char_code->IsConstant()) {
3833 HConstant* c_code = HConstant::cast(char_code); 3855 HConstant* c_code = HConstant::cast(char_code);
3834 Isolate* isolate = zone->isolate(); 3856 Isolate* isolate = zone->isolate();
3835 if (c_code->HasNumberValue()) { 3857 if (c_code->HasNumberValue()) {
3836 if (std::isfinite(c_code->DoubleValue())) { 3858 if (std::isfinite(c_code->DoubleValue())) {
3837 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff; 3859 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff;
3838 return HConstant::New(zone, context, 3860 return HConstant::New(zone, context,
3839 LookupSingleCharacterStringFromCode(isolate, code)); 3861 LookupSingleCharacterStringFromCode(isolate, code));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3871 return H_CONSTANT_DOUBLE(d); 3893 return H_CONSTANT_DOUBLE(d);
3872 default: 3894 default:
3873 UNREACHABLE(); 3895 UNREACHABLE();
3874 break; 3896 break;
3875 } 3897 }
3876 } 3898 }
3877 switch (op) { 3899 switch (op) {
3878 case kMathExp: 3900 case kMathExp:
3879 return H_CONSTANT_DOUBLE(fast_exp(d)); 3901 return H_CONSTANT_DOUBLE(fast_exp(d));
3880 case kMathLog: 3902 case kMathLog:
3881 return H_CONSTANT_DOUBLE(fast_log(d)); 3903 return H_CONSTANT_DOUBLE(log(d));
3882 case kMathSqrt: 3904 case kMathSqrt:
3883 return H_CONSTANT_DOUBLE(fast_sqrt(d)); 3905 return H_CONSTANT_DOUBLE(fast_sqrt(d));
3884 case kMathPowHalf: 3906 case kMathPowHalf:
3885 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); 3907 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5));
3886 case kMathAbs: 3908 case kMathAbs:
3887 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); 3909 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d);
3888 case kMathRound: 3910 case kMathRound:
3889 // -0.5 .. -0.0 round to -0.0. 3911 // -0.5 .. -0.0 round to -0.0.
3890 if ((d >= -0.5 && Double(d).Sign() < 0)) return H_CONSTANT_DOUBLE(-0.0); 3912 if ((d >= -0.5 && Double(d).Sign() < 0)) return H_CONSTANT_DOUBLE(-0.0);
3891 // Doubles are represented as Significant * 2 ^ Exponent. If the 3913 // Doubles are represented as Significant * 2 ^ Exponent. If the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3981 4003
3982 HInstruction* HDiv::New( 4004 HInstruction* HDiv::New(
3983 Zone* zone, HValue* context, HValue* left, HValue* right) { 4005 Zone* zone, HValue* context, HValue* left, HValue* right) {
3984 // If left and right are constant values, try to return a constant value. 4006 // If left and right are constant values, try to return a constant value.
3985 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 4007 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3986 HConstant* c_left = HConstant::cast(left); 4008 HConstant* c_left = HConstant::cast(left);
3987 HConstant* c_right = HConstant::cast(right); 4009 HConstant* c_right = HConstant::cast(right);
3988 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { 4010 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
3989 if (c_right->DoubleValue() != 0) { 4011 if (c_right->DoubleValue() != 0) {
3990 double double_res = c_left->DoubleValue() / c_right->DoubleValue(); 4012 double double_res = c_left->DoubleValue() / c_right->DoubleValue();
3991 if (TypeInfo::IsInt32Double(double_res)) { 4013 if (IsInt32Double(double_res)) {
3992 return H_CONSTANT_INT(double_res); 4014 return H_CONSTANT_INT(double_res);
3993 } 4015 }
3994 return H_CONSTANT_DOUBLE(double_res); 4016 return H_CONSTANT_DOUBLE(double_res);
3995 } else { 4017 } else {
3996 int sign = Double(c_left->DoubleValue()).Sign() * 4018 int sign = Double(c_left->DoubleValue()).Sign() *
3997 Double(c_right->DoubleValue()).Sign(); // Right could be -0. 4019 Double(c_right->DoubleValue()).Sign(); // Right could be -0.
3998 return H_CONSTANT_DOUBLE(sign * V8_INFINITY); 4020 return H_CONSTANT_DOUBLE(sign * V8_INFINITY);
3999 } 4021 }
4000 } 4022 }
4001 } 4023 }
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
4407 stream->Add("%length"); 4429 stream->Add("%length");
4408 break; 4430 break;
4409 case kElementsPointer: 4431 case kElementsPointer:
4410 stream->Add("%elements"); 4432 stream->Add("%elements");
4411 break; 4433 break;
4412 case kMaps: 4434 case kMaps:
4413 stream->Add("%map"); 4435 stream->Add("%map");
4414 break; 4436 break;
4415 case kDouble: // fall through 4437 case kDouble: // fall through
4416 case kInobject: 4438 case kInobject:
4417 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 4439 if (!name_.is_null()) {
4440 stream->Add(String::cast(*name_)->ToCString().get());
4441 }
4418 stream->Add("[in-object]"); 4442 stream->Add("[in-object]");
4419 break; 4443 break;
4420 case kBackingStore: 4444 case kBackingStore:
4421 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 4445 if (!name_.is_null()) {
4446 stream->Add(String::cast(*name_)->ToCString().get());
4447 }
4422 stream->Add("[backing-store]"); 4448 stream->Add("[backing-store]");
4423 break; 4449 break;
4424 case kExternalMemory: 4450 case kExternalMemory:
4425 stream->Add("[external-memory]"); 4451 stream->Add("[external-memory]");
4426 break; 4452 break;
4427 } 4453 }
4428 4454
4429 stream->Add("@%d", offset()); 4455 stream->Add("@%d", offset());
4430 } 4456 }
4431 4457
4432 } } // namespace v8::internal 4458 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/hydrogen-load-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698