Reviewers: Sven Panne,

Description:
[turbofan] Workaround inconsistency of the type system.

[email protected]

Please review this at https://codereview.chromium.org/770193002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+16, -4 lines):
  M src/compiler/js-typed-lowering.cc


Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc index 275dcd74c0a67f8f8ab9fece7716d0a5887898ca..00155044d4c1016636bf77d6f753a86c3117879d 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -39,10 +39,22 @@ JSTypedLowering::JSTypedLowering(JSGraph* jsgraph)
   one_range_ = Type::Range(one, one, zone());
   Handle<Object> thirtyone = factory->NewNumber(31.0);
   zero_thirtyone_range_ = Type::Range(zero, thirtyone, zone());
-  for (size_t k = 0; k < arraysize(shifted_int32_ranges_); ++k) {
-    Handle<Object> min = factory->NewNumber(kMinInt / (1 << k));
-    Handle<Object> max = factory->NewNumber(kMaxInt / (1 << k));
-    shifted_int32_ranges_[k] = Type::Range(min, max, zone());
+  // TODO(jarin): Can we have a correctification of the stupid type system?
+  // These stupid work-arounds are just stupid!
+  shifted_int32_ranges_[0] = Type::Signed32();
+  if (SmiValuesAre31Bits()) {
+    shifted_int32_ranges_[1] = Type::SignedSmall();
+    for (size_t k = 2; k < arraysize(shifted_int32_ranges_); ++k) {
+      Handle<Object> min = factory->NewNumber(kMinInt / (1 << k));
+      Handle<Object> max = factory->NewNumber(kMaxInt / (1 << k));
+      shifted_int32_ranges_[k] = Type::Range(min, max, zone());
+    }
+  } else {
+    for (size_t k = 1; k < arraysize(shifted_int32_ranges_); ++k) {
+      Handle<Object> min = factory->NewNumber(kMinInt / (1 << k));
+      Handle<Object> max = factory->NewNumber(kMaxInt / (1 << k));
+      shifted_int32_ranges_[k] = Type::Range(min, max, zone());
+    }
   }
 }



--
--
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/d/optout.

Reply via email to