Commit 118d5e17 authored by whesse@chromium.org's avatar whesse@chromium.org

Fix debug printing of pointers, and a keyed store with smi index error, in X64

Review URL: http://codereview.chromium.org/160452

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2605 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 67a61e96
...@@ -153,7 +153,7 @@ void StringStream::Add(Vector<const char> format, Vector<FmtElm> elms) { ...@@ -153,7 +153,7 @@ void StringStream::Add(Vector<const char> format, Vector<FmtElm> elms) {
} }
break; 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_; int value = current.data_.u_int_;
EmbeddedVector<char, 24> formatted; EmbeddedVector<char, 24> formatted;
int length = OS::SNPrintF(formatted, temp.start(), value); int length = OS::SNPrintF(formatted, temp.start(), value);
...@@ -167,6 +167,13 @@ void StringStream::Add(Vector<const char> format, Vector<FmtElm> elms) { ...@@ -167,6 +167,13 @@ void StringStream::Add(Vector<const char> format, Vector<FmtElm> elms) {
Add(formatted.start()); Add(formatted.start());
break; break;
} }
case 'p': {
void* value = current.data_.u_pointer_;
EmbeddedVector<char, 20> formatted;
OS::SNPrintF(formatted, temp.start(), value);
Add(formatted.start());
break;
}
default: default:
UNREACHABLE(); UNREACHABLE();
break; break;
......
...@@ -90,21 +90,12 @@ class FmtElm { ...@@ -90,21 +90,12 @@ class FmtElm {
FmtElm(Handle<Object> value) : type_(HANDLE) { // NOLINT FmtElm(Handle<Object> value) : type_(HANDLE) { // NOLINT
data_.u_handle_ = value.location(); data_.u_handle_ = value.location();
} }
FmtElm(void* value) : type_(INT) { // NOLINT FmtElm(void* value) : type_(POINTER) { // NOLINT
#if V8_HOST_ARCH_64_BIT data_.u_pointer_ = value;
// 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
} }
private: private:
friend class StringStream; 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_; Type type_;
union { union {
int u_int_; int u_int_;
...@@ -113,6 +104,7 @@ class FmtElm { ...@@ -113,6 +104,7 @@ class FmtElm {
const Vector<const uc16>* u_lc_str_; const Vector<const uc16>* u_lc_str_;
Object* u_obj_; Object* u_obj_;
Object** u_handle_; Object** u_handle_;
void* u_pointer_;
} data_; } data_;
}; };
......
...@@ -424,6 +424,9 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { ...@@ -424,6 +424,9 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
// Check that the key is a smi. // Check that the key is a smi.
__ testl(rbx, Immediate(kSmiTagMask)); __ testl(rbx, Immediate(kSmiTagMask));
__ j(not_zero, &slow); __ 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); __ CmpInstanceType(rcx, JS_ARRAY_TYPE);
__ j(equal, &array); __ j(equal, &array);
...@@ -434,7 +437,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { ...@@ -434,7 +437,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
// Object case: Check key against length in the elements array. // Object case: Check key against length in the elements array.
// rax: value // rax: value
// rdx: JSObject // rdx: JSObject
// rbx: index (as a smi) // rbx: index (as a smi), zero-extended.
__ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset));
// Check that the object is in fast mode (not dictionary). // Check that the object is in fast mode (not dictionary).
__ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::fixed_array_map()); __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::fixed_array_map());
......
...@@ -63,7 +63,6 @@ test-api/TryCatchInTryFinally: FAIL ...@@ -63,7 +63,6 @@ test-api/TryCatchInTryFinally: FAIL
[ $arch == x64 ] [ $arch == x64 ]
test-regexp/Graph: PASS || CRASH || FAIL
test-decls/Present: CRASH || FAIL test-decls/Present: CRASH || FAIL
test-decls/Unknown: CRASH || FAIL test-decls/Unknown: CRASH || FAIL
test-decls/Appearing: CRASH || FAIL test-decls/Appearing: CRASH || FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment