Revision: 15155
Author: [email protected]
Date: Fri Jun 14 07:13:48 2013
Log: Cleanup RepresentationFromUseRequirements, move it to HValue and
use it where relevant
BUG=
[email protected]
Review URL: https://chromiumcodereview.appspot.com/17005004
http://code.google.com/p/v8/source/detail?r=15155
Modified:
/branches/bleeding_edge/src/hydrogen-instructions.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Jun 11
04:43:57 2013
+++ /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Jun 14
07:13:48 2013
@@ -84,6 +84,10 @@
UpdateRepresentation(new_rep, h_infer, "inputs");
new_rep = RepresentationFromUses();
UpdateRepresentation(new_rep, h_infer, "uses");
+ new_rep = RepresentationFromUseRequirements();
+ if (new_rep.fits_into(Representation::Integer32())) {
+ UpdateRepresentation(new_rep, h_infer, "use requirements");
+ }
}
@@ -2304,6 +2308,10 @@
if (!observed_output_representation_.IsNone()) return;
new_rep = RepresentationFromUses();
UpdateRepresentation(new_rep, h_infer, "uses");
+ new_rep = RepresentationFromUseRequirements();
+ if (new_rep.fits_into(Representation::Integer32())) {
+ UpdateRepresentation(new_rep, h_infer, "use requirements");
+ }
}
@@ -3660,34 +3668,26 @@
}
-Representation HPhi::RepresentationFromUseRequirements() {
- Representation all_uses_require = Representation::None();
- bool all_uses_require_the_same = true;
+// Returns a representation if all uses agree on the same representation.
+// Integer32 is also returned when some uses are Smi but others are
Integer32.
+Representation HValue::RepresentationFromUseRequirements() {
+ Representation rep = Representation::None();
for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
// We check for observed_input_representation elsewhere.
Representation use_rep =
it.value()->RequiredInputRepresentation(it.index());
- // No useful info from this use -> look at the next one.
- if (use_rep.IsNone()) {
+ if (rep.IsNone()) {
+ rep = use_rep;
continue;
}
- if (use_rep.Equals(all_uses_require)) {
+ if (use_rep.IsNone() || rep.Equals(use_rep)) continue;
+ if (rep.generalize(use_rep).IsInteger32()) {
+ rep = Representation::Integer32();
continue;
}
- // This use's representation contradicts what we've seen so far.
- if (!all_uses_require.IsNone()) {
- ASSERT(!use_rep.Equals(all_uses_require));
- all_uses_require_the_same = false;
- break;
- }
- // Otherwise, initialize observed representation.
- all_uses_require = use_rep;
+ return Representation::None();
}
- if (all_uses_require_the_same) {
- return all_uses_require;
- }
-
- return Representation::None();
+ return rep;
}
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Thu Jun 13 10:38:10
2013
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Fri Jun 14 07:13:48
2013
@@ -1150,6 +1150,7 @@
return representation();
}
Representation RepresentationFromUses();
+ Representation RepresentationFromUseRequirements();
virtual void UpdateRepresentation(Representation new_rep,
HInferRepresentation* h_infer,
const char* reason);
@@ -3068,7 +3069,6 @@
virtual Range* InferRange(Zone* zone);
virtual void InferRepresentation(HInferRepresentation* h_infer);
- Representation RepresentationFromUseRequirements();
virtual Representation RequiredInputRepresentation(int index) {
return representation();
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.