Revision: 16365
Author:   [email protected]
Date:     Tue Aug 27 14:13:40 2013 UTC
Log: Introduce SmiValuesAre31Bits and SmiValuesAre32Bits global predicate functions

[email protected]

Review URL: https://codereview.chromium.org/22350005
http://code.google.com/p/v8/source/detail?r=16365

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Tue Aug 27 11:47:52 2013 UTC
+++ /branches/bleeding_edge/include/v8.h        Tue Aug 27 14:13:40 2013 UTC
@@ -5383,6 +5383,8 @@
 typedef SmiTagging<kApiPointerSize> PlatformSmiTagging;
 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
+V8_INLINE(static bool SmiValuesAre31Bits()) { return kSmiValueSize == 31; }
+V8_INLINE(static bool SmiValuesAre32Bits()) { return kSmiValueSize == 32; }

 /**
  * This class exports constants and functionality from within v8 that
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Aug 27 14:09:26 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Aug 27 14:13:40 2013 UTC
@@ -2496,7 +2496,7 @@

 void HConstant::Initialize(Representation r) {
   if (r.IsNone()) {
-    if (has_smi_value_ && kSmiValueSize == 31) {
+    if (has_smi_value_ && SmiValuesAre31Bits()) {
       r = Representation::Smi();
     } else if (has_int32_value_) {
       r = Representation::Integer32();
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Tue Aug 27 13:55:00 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Tue Aug 27 14:13:40 2013 UTC
@@ -3335,7 +3335,7 @@
   }

   virtual Representation KnownOptimalRepresentation() V8_OVERRIDE {
-    if (HasSmiValue() && kSmiValueSize == 31) return Representation::Smi();
+ if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi();
     if (HasInteger32Value()) return Representation::Integer32();
     if (HasNumberValue()) return Representation::Double();
     if (HasExternalReferenceValue()) return Representation::External();
@@ -5841,7 +5841,7 @@
   virtual ~ArrayInstructionInterface() { };

   static Representation KeyedAccessIndexRequirement(Representation r) {
-    return r.IsInteger32() || kSmiValueSize != 31
+    return r.IsInteger32() || SmiValuesAre32Bits()
         ? Representation::Integer32() : Representation::Smi();
   }
 };
=======================================
--- /branches/bleeding_edge/src/ic.cc   Thu Aug 22 13:43:06 2013 UTC
+++ /branches/bleeding_edge/src/ic.cc   Tue Aug 27 14:13:40 2013 UTC
@@ -2581,7 +2581,7 @@
   v8::internal::TypeInfo type = v8::internal::TypeInfo::FromValue(value);
   if (type.IsSmi()) return BinaryOpIC::SMI;
   if (type.IsInteger32()) {
-    if (kSmiValueSize == 32) return BinaryOpIC::SMI;
+    if (SmiValuesAre32Bits()) return BinaryOpIC::SMI;
     return BinaryOpIC::INT32;
   }
   if (type.IsNumber()) return BinaryOpIC::NUMBER;
@@ -2593,7 +2593,7 @@
         op == Token::SAR ||
         op == Token::SHL ||
         op == Token::SHR) {
-      if (kSmiValueSize == 32) return BinaryOpIC::SMI;
+      if (SmiValuesAre32Bits()) return BinaryOpIC::SMI;
       return BinaryOpIC::INT32;
     }
     return BinaryOpIC::ODDBALL;
@@ -2671,7 +2671,7 @@
       if (op == Token::DIV ||
           op == Token::MUL ||
           op == Token::SHR ||
-          kSmiValueSize == 32) {
+          SmiValuesAre32Bits()) {
         // Arithmetic on two Smi inputs has yielded a heap number.
         // That is the only way to get here from the Smi stub.
         // With 32-bit Smis, all overflows give heap numbers, but with
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Aug 27 13:41:44 2013 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Aug 27 14:13:40 2013 UTC
@@ -966,7 +966,7 @@

 void MacroAssembler::SafeMove(Register dst, Smi* src) {
   ASSERT(!dst.is(kScratchRegister));
-  ASSERT(kSmiValueSize == 32);  // JIT cookie can be converted to Smi.
+  ASSERT(SmiValuesAre32Bits());  // JIT cookie can be converted to Smi.
   if (IsUnsafeInt(src->value()) && jit_cookie() != 0) {
     Move(dst, Smi::FromInt(src->value() ^ jit_cookie()));
     Move(kScratchRegister, Smi::FromInt(jit_cookie()));
@@ -978,7 +978,7 @@


 void MacroAssembler::SafePush(Smi* src) {
-  ASSERT(kSmiValueSize == 32);  // JIT cookie can be converted to Smi.
+  ASSERT(SmiValuesAre32Bits());  // JIT cookie can be converted to Smi.
   if (IsUnsafeInt(src->value()) && jit_cookie() != 0) {
     Push(Smi::FromInt(src->value() ^ jit_cookie()));
     Move(kScratchRegister, Smi::FromInt(jit_cookie()));
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Tue Aug 27 11:47:52 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Tue Aug 27 14:13:40 2013 UTC
@@ -1358,7 +1358,7 @@

   int32_t value = i::Smi::kMaxValue;
   // We cannot add one to a Smi::kMaxValue without wrapping.
-  if (i::kSmiValueSize < 32) {
+  if (i::SmiValuesAre31Bits()) {
     CHECK(i::Smi::IsValid(value));
     CHECK(!i::Smi::IsValid(value + 1));

@@ -1377,7 +1377,7 @@
   v8::Isolate* isolate = v8::Isolate::GetCurrent();

   // We cannot add one to a Smi::kMaxValue without wrapping.
-  if (i::kSmiValueSize < 32) {
+  if (i::SmiValuesAre31Bits()) {
     // The casts allow this to compile, even if Smi::kMaxValue is 2^31-1.
     // The code will not be run in that case, due to the "if" guard.
     int32_t value =

--
--
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.

Reply via email to