Reviewers: danno, Mads Ager,
Message:
I'm not sure about this one, but the old code wasn't clear either and had a
TODO.
Description:
simplification to HClampToUint8
* src/hydrogen-instructions.h (HClampToUint8): Don't mark as having
flexible representation; instead the output is always an Integer32.
There is no input representation restriction, so we can still perform
input-specific truncation.
I tested by looking at the --print-code of
var a = PixelArray(1000000)
function fill(a,x) { for (var i=0; i<a.len; i++) a[i] = x; }
Seems to optimize fine both for double and integer inputs. But perhaps
there is a better test, for which the original code does better, and
this is a bogus patch.
Please review this at http://codereview.chromium.org/7357003/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/hydrogen-instructions.h
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
46d5393c5aef052fba48aef048529fd1123ffffc..93a7073b6ad14a1b3f16c4d481eeb5f4328a1ad4
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -1123,40 +1123,19 @@ class HChange: public HUnaryOperation {
class HClampToUint8: public HUnaryOperation {
public:
explicit HClampToUint8(HValue* value)
- : HUnaryOperation(value),
- input_rep_(Representation::None()) {
- SetFlag(kFlexibleRepresentation);
- set_representation(Representation::Tagged());
+ : HUnaryOperation(value) {
+ set_representation(Representation::Integer32());
SetFlag(kUseGVN);
}
virtual Representation RequiredInputRepresentation(int index) const {
- return input_rep_;
- }
-
- virtual Representation InferredRepresentation() {
- // TODO(danno): Inference on input types should happen separately from
- // return representation.
- Representation new_rep = value()->representation();
- if (input_rep_.IsNone()) {
- if (!new_rep.IsNone()) {
- input_rep_ = new_rep;
- return Representation::Integer32();
- } else {
- return Representation::None();
- }
- } else {
- return Representation::Integer32();
- }
+ return Representation::None();
}
DECLARE_CONCRETE_INSTRUCTION(ClampToUint8)
protected:
virtual bool DataEquals(HValue* other) { return true; }
-
- private:
- Representation input_rep_;
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev