Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Unified Diff: src/hydrogen-instructions.cc

Issue 6461021: Add a genuine unary minus instruction to Crankshaft.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/hydrogen-instructions.cc
===================================================================
--- src/hydrogen-instructions.cc (revision 6698)
+++ src/hydrogen-instructions.cc (working copy)
@@ -680,6 +680,12 @@
}
+void HNeg::PrintDataTo(StringStream* stream) const {
+ HUnaryOperation::PrintDataTo(stream);
+ if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
+}
+
+
HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction(
HValue* value) {
STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE);
@@ -874,6 +880,22 @@
}
+Range* HNeg::InferRange() {
+ if (representation().IsInteger32()) {
+ Range* input_range = value()->range();
+ Range* result = input_range->Copy();
+ Range neg_one(-1, -1);
+ if (!result->MulAndCheckOverflow(&neg_one)) {
+ ClearFlag(HValue::kCanOverflow);
+ }
+ result->set_can_be_minus_zero(input_range->CanBeZero());
+ return result;
+ } else {
+ return HValue::InferRange();
+ }
+}
+
+
void HPhi::PrintTo(StringStream* stream) const {
stream->Add("[");
for (int i = 0; i < OperandCount(); ++i) {
@@ -1288,6 +1310,11 @@
}
+HType HNeg::CalculateInferredType() const {
+ return HType::TaggedNumber();
+}
+
+
HType HUnaryMathOperation::CalculateInferredType() const {
return HType::TaggedNumber();
}
@@ -1366,6 +1393,15 @@
}
+HValue* HNeg::EnsureAndPropagateNotMinusZero(BitVector* visited) {
+ visited->Add(id());
+ if (range() == NULL || range()->CanBeMinusZero()) {
+ SetFlag(kBailoutOnMinusZero);
+ }
+ return NULL;
+}
+
+
HValue* HSub::EnsureAndPropagateNotMinusZero(BitVector* visited) {
visited->Add(id());
// Propagate to the left argument. If the left argument cannot be -0, then

Powered by Google App Engine
This is Rietveld 408576698