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 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2225 if (!observed_output_representation_.IsNone()) return; | 2225 if (!observed_output_representation_.IsNone()) return; |
| 2226 new_rep = RepresentationFromUses(); | 2226 new_rep = RepresentationFromUses(); |
| 2227 UpdateRepresentation(new_rep, h_infer, "uses"); | 2227 UpdateRepresentation(new_rep, h_infer, "uses"); |
| 2228 } | 2228 } |
| 2229 | 2229 |
| 2230 | 2230 |
| 2231 Representation HBinaryOperation::RepresentationFromInputs() { | 2231 Representation HBinaryOperation::RepresentationFromInputs() { |
| 2232 // Determine the worst case of observed input representations and | 2232 // Determine the worst case of observed input representations and |
| 2233 // the currently assumed output representation. | 2233 // the currently assumed output representation. |
| 2234 Representation rep = representation(); | 2234 Representation rep = representation(); |
| 2235 if (observed_output_representation_.is_more_general_than(rep)) { | |
| 2236 rep = observed_output_representation_; | |
| 2237 } | |
| 2238 for (int i = 1; i <= 2; ++i) { | 2235 for (int i = 1; i <= 2; ++i) { |
| 2239 Representation input_rep = observed_input_representation(i); | 2236 Representation input_rep = observed_input_representation(i); |
| 2240 if (input_rep.is_more_general_than(rep)) rep = input_rep; | 2237 if (input_rep.is_more_general_than(rep)) rep = input_rep; |
| 2241 } | 2238 } |
| 2242 // If any of the actual input representation is more general than what we | 2239 // If any of the actual input representation is more general than what we |
| 2243 // have so far but not Tagged, use that representation instead. | 2240 // have so far but not Tagged, use that representation instead. |
| 2244 Representation left_rep = left()->representation(); | 2241 Representation left_rep = left()->representation(); |
| 2245 Representation right_rep = right()->representation(); | 2242 Representation right_rep = right()->representation(); |
| 2246 | 2243 |
| 2247 if (left_rep.is_more_general_than(rep) && | 2244 if (left_rep.is_more_general_than(rep) && |
| 2248 left()->CheckFlag(kFlexibleRepresentation)) { | 2245 left()->CheckFlag(kFlexibleRepresentation)) { |
| 2249 rep = left_rep; | 2246 rep = left_rep; |
| 2250 } | 2247 } |
| 2251 if (right_rep.is_more_general_than(rep) && | 2248 if (right_rep.is_more_general_than(rep) && |
| 2252 right()->CheckFlag(kFlexibleRepresentation)) { | 2249 right()->CheckFlag(kFlexibleRepresentation)) { |
| 2253 rep = right_rep; | 2250 rep = right_rep; |
| 2254 } | 2251 } |
| 2252 // Consider observed output representation, but ignore it if it's Double, | |
| 2253 // this instruction is not a division, and all its uses are truncating | |
| 2254 // to Integer32. | |
| 2255 if (observed_output_representation_.is_more_general_than(rep)) { | |
|
Sven Panne
2013/04/22 13:52:29
Simplifying this a bit and extracting a predicate
Jakob Kummerow
2013/04/22 15:24:41
Done.
| |
| 2256 bool ignore = false; | |
| 2257 if (observed_output_representation_.IsDouble() && | |
| 2258 rep.IsInteger32() && | |
| 2259 // TODO(jkummerow): remove the Div blacklisting when the Div | |
| 2260 // instruction has learned not to deopt when the remainder is | |
| 2261 // non-zero but all uses are truncating. | |
| 2262 !this->IsDiv()) { | |
| 2263 ignore = CheckUsesForFlag(kTruncatingToInt32); | |
| 2264 } | |
| 2265 if (!ignore) rep = observed_output_representation_; | |
| 2266 } | |
| 2255 return rep; | 2267 return rep; |
| 2256 } | 2268 } |
| 2257 | 2269 |
| 2258 | 2270 |
| 2259 void HBinaryOperation::AssumeRepresentation(Representation r) { | 2271 void HBinaryOperation::AssumeRepresentation(Representation r) { |
| 2260 set_observed_input_representation(r, r); | 2272 set_observed_input_representation(r, r); |
| 2261 HValue::AssumeRepresentation(r); | 2273 HValue::AssumeRepresentation(r); |
| 2262 } | 2274 } |
| 2263 | 2275 |
| 2264 | 2276 |
| (...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3597 | 3609 |
| 3598 | 3610 |
| 3599 void HCheckFunction::Verify() { | 3611 void HCheckFunction::Verify() { |
| 3600 HInstruction::Verify(); | 3612 HInstruction::Verify(); |
| 3601 ASSERT(HasNoUses()); | 3613 ASSERT(HasNoUses()); |
| 3602 } | 3614 } |
| 3603 | 3615 |
| 3604 #endif | 3616 #endif |
| 3605 | 3617 |
| 3606 } } // namespace v8::internal | 3618 } } // namespace v8::internal |
| OLD | NEW |