Revision: 2605
Author: [email protected]
Date: Mon Aug  3 03:53:45 2009
Log: Fix debug printing of pointers, and a keyed store with smi index  
error, in X64
Review URL: http://codereview.chromium.org/160452
http://code.google.com/p/v8/source/detail?r=2605

Modified:
  /branches/bleeding_edge/src/string-stream.cc
  /branches/bleeding_edge/src/string-stream.h
  /branches/bleeding_edge/src/x64/ic-x64.cc
  /branches/bleeding_edge/test/cctest/cctest.status

=======================================
--- /branches/bleeding_edge/src/string-stream.cc        Wed Jul 22 03:23:19 2009
+++ /branches/bleeding_edge/src/string-stream.cc        Mon Aug  3 03:53:45 2009
@@ -153,7 +153,7 @@
        }
        break;
      }
-    case 'i': case 'd': case 'u': case 'x': case 'c': case 'p': case 'X': {
+    case 'i': case 'd': case 'u': case 'x': case 'c': case 'X': {
        int value = current.data_.u_int_;
        EmbeddedVector<char, 24> formatted;
        int length = OS::SNPrintF(formatted, temp.start(), value);
@@ -167,6 +167,13 @@
        Add(formatted.start());
        break;
      }
+    case 'p': {
+      void* value = current.data_.u_pointer_;
+      EmbeddedVector<char, 20> formatted;
+      OS::SNPrintF(formatted, temp.start(), value);
+      Add(formatted.start());
+      break;
+    }
      default:
        UNREACHABLE();
        break;
=======================================
--- /branches/bleeding_edge/src/string-stream.h Wed Jul 22 03:23:19 2009
+++ /branches/bleeding_edge/src/string-stream.h Mon Aug  3 03:53:45 2009
@@ -90,21 +90,12 @@
    FmtElm(Handle<Object> value) : type_(HANDLE) {  // NOLINT
      data_.u_handle_ = value.location();
    }
-  FmtElm(void* value) : type_(INT) {  // NOLINT
-#if V8_HOST_ARCH_64_BIT
-    // TODO(x64): FmtElm needs to treat pointers as pointers, and not as
-    // ints.  This will require adding a pointer type, etc.  For now just
-    // hack it and truncate the pointer.
-    // http://code.google.com/p/v8/issues/detail?id=335
-    data_.u_int_ = 0;
-    UNIMPLEMENTED();
-#else
-    data_.u_int_ = reinterpret_cast<int>(value);
-#endif
+  FmtElm(void* value) : type_(POINTER) {  // NOLINT
+    data_.u_pointer_ = value;
    }
   private:
    friend class StringStream;
-  enum Type { INT, DOUBLE, C_STR, LC_STR, OBJ, HANDLE };
+  enum Type { INT, DOUBLE, C_STR, LC_STR, OBJ, HANDLE, POINTER };
    Type type_;
    union {
      int u_int_;
@@ -113,6 +104,7 @@
      const Vector<const uc16>* u_lc_str_;
      Object* u_obj_;
      Object** u_handle_;
+    void* u_pointer_;
    } data_;
  };

=======================================
--- /branches/bleeding_edge/src/x64/ic-x64.cc   Thu Jul 30 02:18:14 2009
+++ /branches/bleeding_edge/src/x64/ic-x64.cc   Mon Aug  3 03:53:45 2009
@@ -424,6 +424,9 @@
    // Check that the key is a smi.
    __ testl(rbx, Immediate(kSmiTagMask));
    __ j(not_zero, &slow);
+  // If it is a smi, make sure it is zero-extended, so it can be
+  // used as an index in a memory operand.
+  __ movl(rbx, rbx);  // Clear the high bits of rbx.

    __ CmpInstanceType(rcx, JS_ARRAY_TYPE);
    __ j(equal, &array);
@@ -434,7 +437,7 @@
    // Object case: Check key against length in the elements array.
    // rax: value
    // rdx: JSObject
-  // rbx: index (as a smi)
+  // rbx: index (as a smi), zero-extended.
    __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset));
    // Check that the object is in fast mode (not dictionary).
    __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset),  
Factory::fixed_array_map());
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.status   Thu Jul 30 02:18:14  
2009
+++ /branches/bleeding_edge/test/cctest/cctest.status   Mon Aug  3 03:53:45  
2009
@@ -63,7 +63,6 @@


  [ $arch == x64 ]
-test-regexp/Graph: PASS || CRASH || FAIL
  test-decls/Present: CRASH || FAIL
  test-decls/Unknown: CRASH || FAIL
  test-decls/Appearing: CRASH || FAIL

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to