Chromium Code Reviews| 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 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3714 } | 3714 } |
| 3715 | 3715 |
| 3716 | 3716 |
| 3717 HType HChange::CalculateInferredType() { | 3717 HType HChange::CalculateInferredType() { |
| 3718 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber(); | 3718 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber(); |
| 3719 return type(); | 3719 return type(); |
| 3720 } | 3720 } |
| 3721 | 3721 |
| 3722 | 3722 |
| 3723 Representation HUnaryMathOperation::RepresentationFromInputs() { | 3723 Representation HUnaryMathOperation::RepresentationFromInputs() { |
| 3724 if (SupportsFlexibleFloorAndRound() && | |
| 3725 (op_ == kMathFloor || op_ == kMathRound)) { | |
| 3726 // Floor and Round always take a double input. The integral result can be | |
| 3727 // used as an integer or a double. Infer the representation from the uses. | |
| 3728 return Representation::None(); | |
| 3729 } | |
| 3724 Representation rep = representation(); | 3730 Representation rep = representation(); |
| 3725 // If any of the actual input representation is more general than what we | 3731 // If any of the actual input representation is more general than what we |
| 3726 // have so far but not Tagged, use that representation instead. | 3732 // have so far but not Tagged, use that representation instead. |
| 3727 Representation input_rep = value()->representation(); | 3733 Representation input_rep = value()->representation(); |
| 3728 if (!input_rep.IsTagged()) { | 3734 if (!input_rep.IsTagged()) { |
| 3729 rep = rep.generalize(input_rep); | 3735 rep = rep.generalize(input_rep); |
| 3730 } | 3736 } |
| 3731 return rep; | 3737 return rep; |
| 3732 } | 3738 } |
| 3733 | 3739 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4182 } | 4188 } |
| 4183 default: | 4189 default: |
| 4184 UNREACHABLE(); | 4190 UNREACHABLE(); |
| 4185 break; | 4191 break; |
| 4186 } | 4192 } |
| 4187 } while (false); | 4193 } while (false); |
| 4188 return new(zone) HUnaryMathOperation(context, value, op); | 4194 return new(zone) HUnaryMathOperation(context, value, op); |
| 4189 } | 4195 } |
| 4190 | 4196 |
| 4191 | 4197 |
| 4198 Representation HUnaryMathOperation::RepresentationFromUses() { | |
| 4199 if (op_ != kMathFloor && op_ != kMathRound) { | |
| 4200 return HValue::RepresentationFromUses(); | |
| 4201 } | |
| 4202 | |
| 4203 // The instruction can have an int32 or double output. Prefer a double | |
| 4204 // representation if there are double uses. | |
| 4205 bool has_double_use = false; | |
| 4206 | |
| 4207 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | |
| 4208 HValue* use = it.value(); | |
| 4209 Representation rep = use->RequiredInputRepresentation(it.index()); | |
| 4210 bool rep_required = !rep.IsNone(); | |
| 4211 if (!rep_required) { | |
|
Jakob Kummerow
2014/04/25 14:12:03
I'm not sure I like the way you're prioritizing re
Alexandre Rames
2014/04/25 16:05:26
Removed consideration of the required representati
Jakob Kummerow
2014/04/28 13:53:32
Any reason you're not looking at both required and
| |
| 4212 rep = use->observed_input_representation(it.index()); | |
| 4213 } | |
| 4214 if (FLAG_trace_representation && !rep.IsNone()) { | |
| 4215 PrintF("#%d %s is %s by #%d %s as %s%s\n", | |
| 4216 id(), Mnemonic(), | |
| 4217 rep_required ? "required" : "used", | |
| 4218 use->id(), use->Mnemonic(), rep.Mnemonic(), | |
| 4219 (use->CheckFlag(kTruncatingToInt32) ? "-trunc" : "")); | |
| 4220 } | |
| 4221 if (rep.IsDouble()) { | |
| 4222 has_double_use = true; | |
| 4223 if (!FLAG_trace_representation) { | |
| 4224 break; | |
|
Jakob Kummerow
2014/04/25 14:12:03
nit: indentation. Also, a comment would be nice (e
Alexandre Rames
2014/04/25 16:05:26
Done.
| |
| 4225 } | |
| 4226 } | |
| 4227 } | |
| 4228 return has_double_use ? Representation::Double() | |
| 4229 : Representation::Integer32(); | |
| 4230 } | |
| 4231 | |
| 4232 | |
| 4192 HInstruction* HPower::New(Zone* zone, | 4233 HInstruction* HPower::New(Zone* zone, |
| 4193 HValue* context, | 4234 HValue* context, |
| 4194 HValue* left, | 4235 HValue* left, |
| 4195 HValue* right) { | 4236 HValue* right) { |
| 4196 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 4237 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
| 4197 HConstant* c_left = HConstant::cast(left); | 4238 HConstant* c_left = HConstant::cast(left); |
| 4198 HConstant* c_right = HConstant::cast(right); | 4239 HConstant* c_right = HConstant::cast(right); |
| 4199 if (c_left->HasNumberValue() && c_right->HasNumberValue()) { | 4240 if (c_left->HasNumberValue() && c_right->HasNumberValue()) { |
| 4200 double result = power_helper(c_left->DoubleValue(), | 4241 double result = power_helper(c_left->DoubleValue(), |
| 4201 c_right->DoubleValue()); | 4242 c_right->DoubleValue()); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4744 break; | 4785 break; |
| 4745 case kExternalMemory: | 4786 case kExternalMemory: |
| 4746 stream->Add("[external-memory]"); | 4787 stream->Add("[external-memory]"); |
| 4747 break; | 4788 break; |
| 4748 } | 4789 } |
| 4749 | 4790 |
| 4750 stream->Add("@%d", offset()); | 4791 stream->Add("@%d", offset()); |
| 4751 } | 4792 } |
| 4752 | 4793 |
| 4753 } } // namespace v8::internal | 4794 } } // namespace v8::internal |
| OLD | NEW |