| 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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 HControlInstruction::PrintDataTo(stream); | 1114 HControlInstruction::PrintDataTo(stream); |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 | 1117 |
| 1118 const char* HUnaryMathOperation::OpName() const { | 1118 const char* HUnaryMathOperation::OpName() const { |
| 1119 switch (op()) { | 1119 switch (op()) { |
| 1120 case kMathFloor: return "floor"; | 1120 case kMathFloor: return "floor"; |
| 1121 case kMathRound: return "round"; | 1121 case kMathRound: return "round"; |
| 1122 case kMathAbs: return "abs"; | 1122 case kMathAbs: return "abs"; |
| 1123 case kMathLog: return "log"; | 1123 case kMathLog: return "log"; |
| 1124 case kMathSin: return "sin"; | |
| 1125 case kMathCos: return "cos"; | |
| 1126 case kMathTan: return "tan"; | |
| 1127 case kMathExp: return "exp"; | 1124 case kMathExp: return "exp"; |
| 1128 case kMathSqrt: return "sqrt"; | 1125 case kMathSqrt: return "sqrt"; |
| 1129 case kMathPowHalf: return "pow-half"; | 1126 case kMathPowHalf: return "pow-half"; |
| 1130 default: | 1127 default: |
| 1131 UNREACHABLE(); | 1128 UNREACHABLE(); |
| 1132 return NULL; | 1129 return NULL; |
| 1133 } | 1130 } |
| 1134 } | 1131 } |
| 1135 | 1132 |
| 1136 | 1133 |
| (...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3500 dominator_allocate->ClearNextMapWord(original_object_size); | 3497 dominator_allocate->ClearNextMapWord(original_object_size); |
| 3501 #endif | 3498 #endif |
| 3502 | 3499 |
| 3503 dominator_allocate->clear_next_map_word_ = clear_next_map_word_; | 3500 dominator_allocate->clear_next_map_word_ = clear_next_map_word_; |
| 3504 | 3501 |
| 3505 // After that replace the dominated allocate instruction. | 3502 // After that replace the dominated allocate instruction. |
| 3506 HInstruction* dominated_allocate_instr = | 3503 HInstruction* dominated_allocate_instr = |
| 3507 HInnerAllocatedObject::New(zone, | 3504 HInnerAllocatedObject::New(zone, |
| 3508 context(), | 3505 context(), |
| 3509 dominator_allocate, | 3506 dominator_allocate, |
| 3510 dominator_size_constant, | 3507 dominator_size, |
| 3511 type()); | 3508 type()); |
| 3512 dominated_allocate_instr->InsertBefore(this); | 3509 dominated_allocate_instr->InsertBefore(this); |
| 3513 DeleteAndReplaceWith(dominated_allocate_instr); | 3510 DeleteAndReplaceWith(dominated_allocate_instr); |
| 3514 if (FLAG_trace_allocation_folding) { | 3511 if (FLAG_trace_allocation_folding) { |
| 3515 PrintF("#%d (%s) folded into #%d (%s)\n", | 3512 PrintF("#%d (%s) folded into #%d (%s)\n", |
| 3516 id(), Mnemonic(), dominator_allocate->id(), | 3513 id(), Mnemonic(), dominator_allocate->id(), |
| 3517 dominator_allocate->Mnemonic()); | 3514 dominator_allocate->Mnemonic()); |
| 3518 } | 3515 } |
| 3519 } | 3516 } |
| 3520 | 3517 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3596 free_space_size, | 3593 free_space_size, |
| 3597 Representation::Smi(), | 3594 Representation::Smi(), |
| 3598 filler_free_space_size_); | 3595 filler_free_space_size_); |
| 3599 filler_free_space_size_->UpdateValue(new_free_space_size); | 3596 filler_free_space_size_->UpdateValue(new_free_space_size); |
| 3600 } | 3597 } |
| 3601 | 3598 |
| 3602 | 3599 |
| 3603 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { | 3600 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { |
| 3604 ASSERT(filler_free_space_size_ == NULL); | 3601 ASSERT(filler_free_space_size_ == NULL); |
| 3605 Zone* zone = block()->zone(); | 3602 Zone* zone = block()->zone(); |
| 3606 int32_t dominator_size = | |
| 3607 HConstant::cast(dominating_allocate_->size())->GetInteger32Constant(); | |
| 3608 HInstruction* free_space_instr = | 3603 HInstruction* free_space_instr = |
| 3609 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, | 3604 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, |
| 3610 dominator_size, type()); | 3605 dominating_allocate_->size(), type()); |
| 3611 free_space_instr->InsertBefore(this); | 3606 free_space_instr->InsertBefore(this); |
| 3612 HConstant* filler_map = HConstant::New( | 3607 HConstant* filler_map = HConstant::New( |
| 3613 zone, | 3608 zone, |
| 3614 context(), | 3609 context(), |
| 3615 isolate()->factory()->free_space_map()); | 3610 isolate()->factory()->free_space_map()); |
| 3616 filler_map->FinalizeUniqueness(); // TODO(titzer): should be init'd a'ready | 3611 filler_map->FinalizeUniqueness(); // TODO(titzer): should be init'd a'ready |
| 3617 filler_map->InsertAfter(free_space_instr); | 3612 filler_map->InsertAfter(free_space_instr); |
| 3618 HInstruction* store_map = HStoreNamedField::New(zone, context(), | 3613 HInstruction* store_map = HStoreNamedField::New(zone, context(), |
| 3619 free_space_instr, HObjectAccess::ForMap(), filler_map); | 3614 free_space_instr, HObjectAccess::ForMap(), filler_map); |
| 3620 store_map->SetFlag(HValue::kHasNoObservableSideEffects); | 3615 store_map->SetFlag(HValue::kHasNoObservableSideEffects); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3856 if (!FLAG_fold_constants) break; | 3851 if (!FLAG_fold_constants) break; |
| 3857 if (!value->IsConstant()) break; | 3852 if (!value->IsConstant()) break; |
| 3858 HConstant* constant = HConstant::cast(value); | 3853 HConstant* constant = HConstant::cast(value); |
| 3859 if (!constant->HasNumberValue()) break; | 3854 if (!constant->HasNumberValue()) break; |
| 3860 double d = constant->DoubleValue(); | 3855 double d = constant->DoubleValue(); |
| 3861 if (std::isnan(d)) { // NaN poisons everything. | 3856 if (std::isnan(d)) { // NaN poisons everything. |
| 3862 return H_CONSTANT_DOUBLE(OS::nan_value()); | 3857 return H_CONSTANT_DOUBLE(OS::nan_value()); |
| 3863 } | 3858 } |
| 3864 if (std::isinf(d)) { // +Infinity and -Infinity. | 3859 if (std::isinf(d)) { // +Infinity and -Infinity. |
| 3865 switch (op) { | 3860 switch (op) { |
| 3866 case kMathSin: | |
| 3867 case kMathCos: | |
| 3868 case kMathTan: | |
| 3869 return H_CONSTANT_DOUBLE(OS::nan_value()); | |
| 3870 case kMathExp: | 3861 case kMathExp: |
| 3871 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); | 3862 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); |
| 3872 case kMathLog: | 3863 case kMathLog: |
| 3873 case kMathSqrt: | 3864 case kMathSqrt: |
| 3874 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value()); | 3865 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value()); |
| 3875 case kMathPowHalf: | 3866 case kMathPowHalf: |
| 3876 case kMathAbs: | 3867 case kMathAbs: |
| 3877 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d); | 3868 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d); |
| 3878 case kMathRound: | 3869 case kMathRound: |
| 3879 case kMathFloor: | 3870 case kMathFloor: |
| 3880 return H_CONSTANT_DOUBLE(d); | 3871 return H_CONSTANT_DOUBLE(d); |
| 3881 default: | 3872 default: |
| 3882 UNREACHABLE(); | 3873 UNREACHABLE(); |
| 3883 break; | 3874 break; |
| 3884 } | 3875 } |
| 3885 } | 3876 } |
| 3886 switch (op) { | 3877 switch (op) { |
| 3887 case kMathSin: | |
| 3888 return H_CONSTANT_DOUBLE(fast_sin(d)); | |
| 3889 case kMathCos: | |
| 3890 return H_CONSTANT_DOUBLE(fast_cos(d)); | |
| 3891 case kMathTan: | |
| 3892 return H_CONSTANT_DOUBLE(fast_tan(d)); | |
| 3893 case kMathExp: | 3878 case kMathExp: |
| 3894 return H_CONSTANT_DOUBLE(fast_exp(d)); | 3879 return H_CONSTANT_DOUBLE(fast_exp(d)); |
| 3895 case kMathLog: | 3880 case kMathLog: |
| 3896 return H_CONSTANT_DOUBLE(fast_log(d)); | 3881 return H_CONSTANT_DOUBLE(fast_log(d)); |
| 3897 case kMathSqrt: | 3882 case kMathSqrt: |
| 3898 return H_CONSTANT_DOUBLE(fast_sqrt(d)); | 3883 return H_CONSTANT_DOUBLE(fast_sqrt(d)); |
| 3899 case kMathPowHalf: | 3884 case kMathPowHalf: |
| 3900 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); | 3885 return H_CONSTANT_DOUBLE(power_double_double(d, 0.5)); |
| 3901 case kMathAbs: | 3886 case kMathAbs: |
| 3902 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); | 3887 return H_CONSTANT_DOUBLE((d >= 0.0) ? d + 0.0 : -d); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4266 | 4251 |
| 4267 if (offset == JSObject::kElementsOffset) { | 4252 if (offset == JSObject::kElementsOffset) { |
| 4268 portion = kElementsPointer; | 4253 portion = kElementsPointer; |
| 4269 } else if (offset == JSObject::kMapOffset) { | 4254 } else if (offset == JSObject::kMapOffset) { |
| 4270 portion = kMaps; | 4255 portion = kMaps; |
| 4271 } | 4256 } |
| 4272 return HObjectAccess(portion, offset, representation); | 4257 return HObjectAccess(portion, offset, representation); |
| 4273 } | 4258 } |
| 4274 | 4259 |
| 4275 | 4260 |
| 4261 HObjectAccess HObjectAccess::ForAllocationSiteOffset(int offset) { |
| 4262 switch (offset) { |
| 4263 case AllocationSite::kTransitionInfoOffset: |
| 4264 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4265 case AllocationSite::kNestedSiteOffset: |
| 4266 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4267 case AllocationSite::kMementoFoundCountOffset: |
| 4268 return HObjectAccess(kInobject, offset, Representation::Smi()); |
| 4269 case AllocationSite::kMementoCreateCountOffset: |
| 4270 return HObjectAccess(kInobject, offset, Representation::Smi()); |
| 4271 case AllocationSite::kPretenureDecisionOffset: |
| 4272 return HObjectAccess(kInobject, offset, Representation::Smi()); |
| 4273 case AllocationSite::kDependentCodeOffset: |
| 4274 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4275 case AllocationSite::kWeakNextOffset: |
| 4276 return HObjectAccess(kInobject, offset, Representation::Tagged()); |
| 4277 default: |
| 4278 UNREACHABLE(); |
| 4279 } |
| 4280 return HObjectAccess(kInobject, offset); |
| 4281 } |
| 4282 |
| 4283 |
| 4276 HObjectAccess HObjectAccess::ForContextSlot(int index) { | 4284 HObjectAccess HObjectAccess::ForContextSlot(int index) { |
| 4277 ASSERT(index >= 0); | 4285 ASSERT(index >= 0); |
| 4278 Portion portion = kInobject; | 4286 Portion portion = kInobject; |
| 4279 int offset = Context::kHeaderSize + index * kPointerSize; | 4287 int offset = Context::kHeaderSize + index * kPointerSize; |
| 4280 ASSERT_EQ(offset, Context::SlotOffset(index) + kHeapObjectTag); | 4288 ASSERT_EQ(offset, Context::SlotOffset(index) + kHeapObjectTag); |
| 4281 return HObjectAccess(portion, offset, Representation::Tagged()); | 4289 return HObjectAccess(portion, offset, Representation::Tagged()); |
| 4282 } | 4290 } |
| 4283 | 4291 |
| 4284 | 4292 |
| 4285 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { | 4293 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4415 break; | 4423 break; |
| 4416 case kExternalMemory: | 4424 case kExternalMemory: |
| 4417 stream->Add("[external-memory]"); | 4425 stream->Add("[external-memory]"); |
| 4418 break; | 4426 break; |
| 4419 } | 4427 } |
| 4420 | 4428 |
| 4421 stream->Add("@%d", offset()); | 4429 stream->Add("@%d", offset()); |
| 4422 } | 4430 } |
| 4423 | 4431 |
| 4424 } } // namespace v8::internal | 4432 } } // namespace v8::internal |
| OLD | NEW |