Revert "Use Representation::Integer32() for smi types on 32-bit-tagged systems."
authorverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 7 Mar 2014 09:29:07 +0000 (09:29 +0000)
committerverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 7 Mar 2014 09:29:07 +0000 (09:29 +0000)
Due to performance regression.

BUG=
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/189843006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19709 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen-instructions.cc
src/hydrogen.cc
src/types.cc
test/mjsunit/regress/regress-crbug-349079.js

index b24b2f94f47c6906177eddd13e1f2c9c85ccee08..7b4f758998a764d21a72dc0bc7d183582cfef7ed 100644 (file)
@@ -2613,8 +2613,8 @@ HConstant::HConstant(ExternalReference reference)
 
 void HConstant::Initialize(Representation r) {
   if (r.IsNone()) {
-    if (has_smi_value_) {
-      r = Representation::FromType(Type::Smi());
+    if (has_smi_value_ && SmiValuesAre31Bits()) {
+      r = Representation::Smi();
     } else if (has_int32_value_) {
       r = Representation::Integer32();
     } else if (has_double_value_) {
index 5b73eb64931d4428d2ae5ddedbd92869fae6a9a8..aa77a93fe76b9845f107dc33986effe2cbac9d41 100644 (file)
@@ -8740,7 +8740,7 @@ HInstruction* HOptimizedGraphBuilder::BuildIncrement(
   // The input to the count operation is on top of the expression stack.
   Representation rep = Representation::FromType(expr->type());
   if (rep.IsNone() || rep.IsTagged()) {
-    rep = Representation::FromType(Type::Smi());
+    rep = Representation::Smi();
   }
 
   if (returns_original_input) {
@@ -8990,8 +8990,14 @@ bool CanBeZero(HValue* right) {
 
 HValue* HGraphBuilder::EnforceNumberType(HValue* number,
                                          Type* expected) {
-  return AddUncasted<HForceRepresentation>(
-      number, Representation::FromType(expected));
+  if (expected->Is(Type::Smi())) {
+    return AddUncasted<HForceRepresentation>(number, Representation::Smi());
+  }
+  if (expected->Is(Type::Signed32())) {
+    return AddUncasted<HForceRepresentation>(number,
+                                             Representation::Integer32());
+  }
+  return number;
 }
 
 
index dedfeadb46ac0003f032e9cc0276e8fd1a2171d3..3840e6fd223f72c0210b49a386e3ca4462ef4a0b 100644 (file)
@@ -568,8 +568,7 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Convert(
 // TODO(rossberg): this does not belong here.
 Representation Representation::FromType(Type* type) {
   if (type->Is(Type::None())) return Representation::None();
-  if (type->Is(Type::Smi())) return SmiValuesAre31Bits()
-      ? Representation::Smi() : Representation::Integer32();
+  if (type->Is(Type::Smi())) return Representation::Smi();
   if (type->Is(Type::Signed32())) return Representation::Integer32();
   if (type->Is(Type::Number())) return Representation::Double();
   return Representation::Tagged();
index 822941ae08d80fbe0f292370206f406e44b49987..b1076ea435c7d1e66c7bb906bf718b1ba1dc2a7b 100644 (file)
@@ -21,16 +21,3 @@ crash();
 crash();
 %OptimizeFunctionOnNextCall(crash);
 crash();
-
-function f() {
-  var v1 = 0;
-  var v2 = -0;
-  var t = v2++;
-  v2++;
-  return Math.max(v2++, v1++);
-}
-
-f();
-f();
-%OptimizeFunctionOnNextCall(f);
-f();