Revision: 5543
Author: [email protected]
Date: Tue Sep 28 04:44:30 2010
Log: More correctness around PrintF and 32/64 bit values.
Fix test after 64 bit heap size change.
Review URL: http://codereview.chromium.org/3432032
http://code.google.com/p/v8/source/detail?r=5543
Modified:
/branches/bleeding_edge/src/arm/simulator-arm.cc
/branches/bleeding_edge/src/assembler.cc
/branches/bleeding_edge/src/contexts.cc
/branches/bleeding_edge/src/data-flow.cc
/branches/bleeding_edge/src/disassembler.cc
/branches/bleeding_edge/src/global-handles.cc
/branches/bleeding_edge/src/heap-inl.h
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/mark-compact.cc
/branches/bleeding_edge/src/objects-debug.cc
/branches/bleeding_edge/src/regexp-macro-assembler-tracer.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/spaces.h
/branches/bleeding_edge/src/utils.h
/branches/bleeding_edge/test/mjsunit/binary-op-newspace.js
=======================================
--- /branches/bleeding_edge/src/arm/simulator-arm.cc Thu Aug 26 01:53:00
2010
+++ /branches/bleeding_edge/src/arm/simulator-arm.cc Tue Sep 28 04:44:30
2010
@@ -294,7 +294,7 @@
} else if (GetVFPSingleValue(arg1, &svalue)) {
PrintF("%s: %f \n", arg1, svalue);
} else if (GetVFPDoubleValue(arg1, &dvalue)) {
- PrintF("%s: %lf \n", arg1, dvalue);
+ PrintF("%s: %f \n", arg1, dvalue);
} else {
PrintF("%s unrecognized\n", arg1);
}
@@ -349,7 +349,8 @@
end = cur + words;
while (cur < end) {
- PrintF(" 0x%08x: 0x%08x %10d\n", cur, *cur, *cur);
+ PrintF(" 0x%08x: 0x%08x %10d\n",
+ reinterpret_cast<intptr_t>(cur), *cur, *cur);
cur++;
}
} else if (strcmp(cmd, "disasm") == 0) {
@@ -382,7 +383,8 @@
while (cur < end) {
dasm.InstructionDecode(buffer, cur);
- PrintF(" 0x%08x %s\n", cur, buffer.start());
+ PrintF(" 0x%08x %s\n",
+ reinterpret_cast<intptr_t>(cur), buffer.start());
cur += Instr::kInstrSize;
}
} else if (strcmp(cmd, "gdb") == 0) {
@@ -1061,7 +1063,7 @@
// Unsupported instructions use Format to print an error and stop
execution.
void Simulator::Format(Instr* instr, const char* format) {
PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n",
- instr, format);
+ reinterpret_cast<intptr_t>(instr), format);
UNIMPLEMENTED();
}
@@ -2650,7 +2652,7 @@
v8::internal::EmbeddedVector<char, 256> buffer;
dasm.InstructionDecode(buffer,
reinterpret_cast<byte*>(instr));
- PrintF(" 0x%08x %s\n", instr, buffer.start());
+ PrintF(" 0x%08x %s\n", reinterpret_cast<intptr_t>(instr),
buffer.start());
}
if (instr->ConditionField() == special_condition) {
DecodeUnconditional(instr);
=======================================
--- /branches/bleeding_edge/src/assembler.cc Tue Jun 8 05:04:49 2010
+++ /branches/bleeding_edge/src/assembler.cc Tue Sep 28 04:44:30 2010
@@ -465,7 +465,7 @@
void RelocInfo::Print() {
PrintF("%p %s", pc_, RelocModeName(rmode_));
if (IsComment(rmode_)) {
- PrintF(" (%s)", data_);
+ PrintF(" (%s)", reinterpret_cast<char*>(data_));
} else if (rmode_ == EMBEDDED_OBJECT) {
PrintF(" (");
target_object()->ShortPrint();
@@ -479,7 +479,7 @@
Code* code = Code::GetCodeFromTargetAddress(target_address());
PrintF(" (%s) (%p)", Code::Kind2String(code->kind()),
target_address());
} else if (IsPosition(rmode_)) {
- PrintF(" (%d)", data());
+ PrintF(" (%" V8_PTR_PREFIX "d)", data());
}
PrintF("\n");
=======================================
--- /branches/bleeding_edge/src/contexts.cc Wed Jul 14 04:18:09 2010
+++ /branches/bleeding_edge/src/contexts.cc Tue Sep 28 04:44:30 2010
@@ -90,7 +90,7 @@
do {
if (FLAG_trace_contexts) {
- PrintF(" - looking in context %p", *context);
+ PrintF(" - looking in context %p",
reinterpret_cast<void*>(*context));
if (context->IsGlobalContext()) PrintF(" (global context)");
PrintF("\n");
}
@@ -110,7 +110,8 @@
if (*attributes != ABSENT) {
// property found
if (FLAG_trace_contexts) {
- PrintF("=> found property in context object %p\n", *extension);
+ PrintF("=> found property in context object %p\n",
+ reinterpret_cast<void*>(*extension));
}
return extension;
}
=======================================
--- /branches/bleeding_edge/src/data-flow.cc Fri Sep 24 00:53:59 2010
+++ /branches/bleeding_edge/src/data-flow.cc Tue Sep 28 04:44:30 2010
@@ -42,7 +42,7 @@
if (Contains(i)) {
if (!first) PrintF(",");
first = false;
- PrintF("%d");
+ PrintF("%d", i);
}
}
PrintF("}");
=======================================
--- /branches/bleeding_edge/src/disassembler.cc Mon Aug 30 04:48:07 2010
+++ /branches/bleeding_edge/src/disassembler.cc Tue Sep 28 04:44:30 2010
@@ -44,7 +44,10 @@
void Disassembler::Dump(FILE* f, byte* begin, byte* end) {
for (byte* pc = begin; pc < end; pc++) {
if (f == NULL) {
- PrintF("%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", pc, pc - begin,
*pc);
+ PrintF("%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n",
+ reinterpret_cast<intptr_t>(pc),
+ pc - begin,
+ *pc);
} else {
fprintf(f, "%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n",
reinterpret_cast<uintptr_t>(pc), pc - begin, *pc);
=======================================
--- /branches/bleeding_edge/src/global-handles.cc Tue Sep 14 10:48:56 2010
+++ /branches/bleeding_edge/src/global-handles.cc Tue Sep 28 04:44:30 2010
@@ -486,7 +486,7 @@
}
PrintF("Global Handle Statistics:\n");
- PrintF(" allocated memory = %dB\n", sizeof(Node) * total);
+ PrintF(" allocated memory = %" V8_PTR_PREFIX "dB\n", sizeof(Node) *
total);
PrintF(" # weak = %d\n", weak);
PrintF(" # pending = %d\n", pending);
PrintF(" # near_death = %d\n", near_death);
@@ -497,8 +497,10 @@
void GlobalHandles::Print() {
PrintF("Global handles:\n");
for (Node* current = head_; current != NULL; current = current->next()) {
- PrintF(" handle %p to %p (weak=%d)\n", current->handle().location(),
- *current->handle(), current->state_ == Node::WEAK);
+ PrintF(" handle %p to %p (weak=%d)\n",
+ reinterpret_cast<void*>(current->handle().location()),
+ reinterpret_cast<void*>(*current->handle()),
+ current->state_ == Node::WEAK);
}
}
=======================================
--- /branches/bleeding_edge/src/heap-inl.h Thu Sep 23 05:23:35 2010
+++ /branches/bleeding_edge/src/heap-inl.h Tue Sep 28 04:44:30 2010
@@ -36,7 +36,7 @@
namespace internal {
void Heap::UpdateOldSpaceLimits() {
- int old_gen_size = PromotedSpaceSize();
+ intptr_t old_gen_size = PromotedSpaceSize();
old_gen_promotion_limit_ =
old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3);
old_gen_allocation_limit_ =
=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Sep 28 03:35:47 2010
+++ /branches/bleeding_edge/src/heap.cc Tue Sep 28 04:44:30 2010
@@ -77,17 +77,17 @@
int Heap::max_semispace_size_ = 2*MB;
intptr_t Heap::max_old_generation_size_ = 192*MB;
int Heap::initial_semispace_size_ = 128*KB;
-size_t Heap::code_range_size_ = 0;
+intptr_t Heap::code_range_size_ = 0;
#elif defined(V8_TARGET_ARCH_X64)
int Heap::max_semispace_size_ = 16*MB;
intptr_t Heap::max_old_generation_size_ = 1*GB;
int Heap::initial_semispace_size_ = 1*MB;
-size_t Heap::code_range_size_ = 512*MB;
+intptr_t Heap::code_range_size_ = 512*MB;
#else
int Heap::max_semispace_size_ = 8*MB;
intptr_t Heap::max_old_generation_size_ = 512*MB;
int Heap::initial_semispace_size_ = 512*KB;
-size_t Heap::code_range_size_ = 0;
+intptr_t Heap::code_range_size_ = 0;
#endif
// The snapshot semispace size will be the default semispace size if
=======================================
--- /branches/bleeding_edge/src/heap.h Tue Sep 28 03:35:47 2010
+++ /branches/bleeding_edge/src/heap.h Tue Sep 28 04:44:30 2010
@@ -251,7 +251,7 @@
static int MaxSemiSpaceSize() { return max_semispace_size_; }
static int ReservedSemiSpaceSize() { return reserved_semispace_size_; }
static int InitialSemiSpaceSize() { return initial_semispace_size_; }
- static int MaxOldGenerationSize() { return max_old_generation_size_; }
+ static intptr_t MaxOldGenerationSize() { return
max_old_generation_size_; }
// Returns the capacity of the heap in bytes w/o growing. Heap grows when
// more spaces are needed until it reaches the limit.
@@ -1070,7 +1070,7 @@
static int max_semispace_size_;
static int initial_semispace_size_;
static intptr_t max_old_generation_size_;
- static size_t code_range_size_;
+ static intptr_t code_range_size_;
// For keeping track of how much data has survived
// scavenge since last new space expansion.
@@ -1231,8 +1231,8 @@
GCTracer* tracer,
CollectionPolicy collectionPolicy);
- static const int kMinimumPromotionLimit = 2 * MB;
- static const int kMinimumAllocationLimit = 8 * MB;
+ static const intptr_t kMinimumPromotionLimit = 2 * MB;
+ static const intptr_t kMinimumAllocationLimit = 8 * MB;
inline static void UpdateOldSpaceLimits();
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Fri Sep 24 04:45:12 2010
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Sep 28 04:44:30 2010
@@ -2008,8 +2008,10 @@
#ifdef DEBUG
if (FLAG_gc_verbose) {
- PrintF("update %p : %p -> %p\n", obj->address(),
- map, new_map);
+ PrintF("update %p : %p -> %p\n",
+ obj->address(),
+ reinterpret_cast<void*>(map),
+ reinterpret_cast<void*>(new_map));
}
#endif
}
=======================================
--- /branches/bleeding_edge/src/objects-debug.cc Fri Sep 24 14:48:44 2010
+++ /branches/bleeding_edge/src/objects-debug.cc Tue Sep 28 04:44:30 2010
@@ -89,7 +89,7 @@
void HeapObject::PrintHeader(const char* id) {
- PrintF("%p: [%s]\n", this, id);
+ PrintF("%p: [%s]\n", reinterpret_cast<void*>(this), id);
}
@@ -522,9 +522,9 @@
void JSObject::JSObjectPrint() {
- PrintF("%p: [JSObject]\n", this);
- PrintF(" - map = %p\n", map());
- PrintF(" - prototype = %p\n", GetPrototype());
+ PrintF("%p: [JSObject]\n", reinterpret_cast<void*>(this));
+ PrintF(" - map = %p\n", reinterpret_cast<void*>(map()));
+ PrintF(" - prototype = %p\n", reinterpret_cast<void*>(GetPrototype()));
PrintF(" {\n");
PrintProperties();
PrintElements();
@@ -744,7 +744,7 @@
void JSFunction::JSFunctionPrint() {
HeapObject::PrintHeader("Function");
- PrintF(" - map = 0x%p\n", map());
+ PrintF(" - map = 0x%p\n", reinterpret_cast<void*>(map()));
PrintF(" - initial_map = ");
if (has_initial_map()) {
initial_map()->ShortPrint();
@@ -1224,9 +1224,9 @@
void BreakPointInfo::BreakPointInfoPrint() {
HeapObject::PrintHeader("BreakPointInfo");
- PrintF("\n - code_position: %d", code_position());
- PrintF("\n - source_position: %d", source_position());
- PrintF("\n - statement_position: %d", statement_position());
+ PrintF("\n - code_position: %d", code_position()->value());
+ PrintF("\n - source_position: %d", source_position()->value());
+ PrintF("\n - statement_position: %d", statement_position()->value());
PrintF("\n - break_point_objects: ");
break_point_objects()->ShortPrint();
}
=======================================
--- /branches/bleeding_edge/src/regexp-macro-assembler-tracer.cc Mon Apr 26
08:34:25 2010
+++ /branches/bleeding_edge/src/regexp-macro-assembler-tracer.cc Tue Sep 28
04:44:30 2010
@@ -45,10 +45,17 @@
RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() {
}
+
+
+// This is used for printing out debugging information. It makes an
integer
+// that is closely related to the address of an object.
+static int IntForLabel(Label* label) {
+ return static_cast<int>(reinterpret_cast<intptr_t>(label));
+}
void RegExpMacroAssemblerTracer::Bind(Label* label) {
- PrintF("label[%08x]: (Bind)\n", label, label);
+ PrintF("label[%08x]: (Bind)\n", IntForLabel(label));
assembler_->Bind(label);
}
@@ -60,7 +67,7 @@
void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) {
- PrintF(" CheckGreedyLoop(label[%08x]);\n\n", label);
+ PrintF(" CheckGreedyLoop(label[%08x]);\n\n", IntForLabel(label));
assembler_->CheckGreedyLoop(label);
}
@@ -84,14 +91,13 @@
void RegExpMacroAssemblerTracer::GoTo(Label* label) {
- PrintF(" GoTo(label[%08x]);\n\n", label);
+ PrintF(" GoTo(label[%08x]);\n\n", IntForLabel(label));
assembler_->GoTo(label);
}
void RegExpMacroAssemblerTracer::PushBacktrack(Label* label) {
- PrintF(" PushBacktrack(label[%08x]);\n",
- label);
+ PrintF(" PushBacktrack(label[%08x]);\n", IntForLabel(label));
assembler_->PushBacktrack(label);
}
@@ -176,7 +182,7 @@
const char* check_msg = check_bounds ? "" : " (unchecked)";
PrintF(" LoadCurrentCharacter(cp_offset=%d, label[%08x]%s (%d
chars));\n",
cp_offset,
- on_end_of_input,
+ IntForLabel(on_end_of_input),
check_msg,
characters);
assembler_->LoadCurrentCharacter(cp_offset,
@@ -187,39 +193,43 @@
void RegExpMacroAssemblerTracer::CheckCharacterLT(uc16 limit, Label*
on_less) {
- PrintF(" CheckCharacterLT(c='u%04x', label[%08x]);\n", limit, on_less);
+ PrintF(" CheckCharacterLT(c='u%04x', label[%08x]);\n",
+ limit, IntForLabel(on_less));
assembler_->CheckCharacterLT(limit, on_less);
}
void RegExpMacroAssemblerTracer::CheckCharacterGT(uc16 limit,
Label* on_greater) {
- PrintF(" CheckCharacterGT(c='u%04x', label[%08x]);\n", limit,
on_greater);
+ PrintF(" CheckCharacterGT(c='u%04x', label[%08x]);\n",
+ limit, IntForLabel(on_greater));
assembler_->CheckCharacterGT(limit, on_greater);
}
void RegExpMacroAssemblerTracer::CheckCharacter(uint32_t c, Label*
on_equal) {
- PrintF(" CheckCharacter(c='u%04x', label[%08x]);\n", c, on_equal);
+ PrintF(" CheckCharacter(c='u%04x', label[%08x]);\n",
+ c, IntForLabel(on_equal));
assembler_->CheckCharacter(c, on_equal);
}
void RegExpMacroAssemblerTracer::CheckAtStart(Label* on_at_start) {
- PrintF(" CheckAtStart(label[%08x]);\n", on_at_start);
+ PrintF(" CheckAtStart(label[%08x]);\n", IntForLabel(on_at_start));
assembler_->CheckAtStart(on_at_start);
}
void RegExpMacroAssemblerTracer::CheckNotAtStart(Label* on_not_at_start) {
- PrintF(" CheckNotAtStart(label[%08x]);\n", on_not_at_start);
+ PrintF(" CheckNotAtStart(label[%08x]);\n", IntForLabel(on_not_at_start));
assembler_->CheckNotAtStart(on_not_at_start);
}
void RegExpMacroAssemblerTracer::CheckNotCharacter(uint32_t c,
Label* on_not_equal) {
- PrintF(" CheckNotCharacter(c='u%04x', label[%08x]);\n", c, on_not_equal);
+ PrintF(" CheckNotCharacter(c='u%04x', label[%08x]);\n",
+ c, IntForLabel(on_not_equal));
assembler_->CheckNotCharacter(c, on_not_equal);
}
@@ -231,7 +241,7 @@
PrintF(" CheckCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
c,
mask,
- on_equal);
+ IntForLabel(on_equal));
assembler_->CheckCharacterAfterAnd(c, mask, on_equal);
}
@@ -243,7 +253,7 @@
PrintF(" CheckNotCharacterAfterAnd(c='u%04x', mask=0x%04x,
label[%08x]);\n",
c,
mask,
- on_not_equal);
+ IntForLabel(on_not_equal));
assembler_->CheckNotCharacterAfterAnd(c, mask, on_not_equal);
}
@@ -258,7 +268,7 @@
c,
minus,
mask,
- on_not_equal);
+ IntForLabel(on_not_equal));
assembler_->CheckNotCharacterAfterMinusAnd(c, minus, mask, on_not_equal);
}
@@ -266,7 +276,7 @@
void RegExpMacroAssemblerTracer::CheckNotBackReference(int start_reg,
Label* on_no_match)
{
PrintF(" CheckNotBackReference(register=%d, label[%08x]);\n", start_reg,
- on_no_match);
+ IntForLabel(on_no_match));
assembler_->CheckNotBackReference(start_reg, on_no_match);
}
@@ -275,7 +285,7 @@
int start_reg,
Label* on_no_match) {
PrintF(" CheckNotBackReferenceIgnoreCase(register=%d, label[%08x]);\n",
- start_reg, on_no_match);
+ start_reg, IntForLabel(on_no_match));
assembler_->CheckNotBackReferenceIgnoreCase(start_reg, on_no_match);
}
@@ -286,7 +296,7 @@
PrintF(" CheckNotRegistersEqual(reg1=%d, reg2=%d, label[%08x]);\n",
reg1,
reg2,
- on_not_equal);
+ IntForLabel(on_not_equal));
assembler_->CheckNotRegistersEqual(reg1, reg2, on_not_equal);
}
@@ -300,7 +310,8 @@
for (int i = 0; i < str.length(); i++) {
PrintF("u%04x", str[i]);
}
- PrintF("\", cp_offset=%d, label[%08x])\n", cp_offset, on_failure);
+ PrintF("\", cp_offset=%d, label[%08x])\n",
+ cp_offset, IntForLabel(on_failure));
assembler_->CheckCharacters(str, cp_offset, on_failure,
check_end_of_string);
}
@@ -312,7 +323,7 @@
on_no_match);
PrintF(" CheckSpecialCharacterClass(type='%c', label[%08x]): %s;\n",
type,
- on_no_match,
+ IntForLabel(on_no_match),
supported ? "true" : "false");
return supported;
}
@@ -321,7 +332,7 @@
void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index,
int comparand, Label* if_lt)
{
PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n",
- register_index, comparand, if_lt);
+ register_index, comparand, IntForLabel(if_lt));
assembler_->IfRegisterLT(register_index, comparand, if_lt);
}
@@ -329,7 +340,7 @@
void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index,
Label* if_eq) {
PrintF(" IfRegisterEqPos(register=%d, label[%08x]);\n",
- register_index, if_eq);
+ register_index, IntForLabel(if_eq));
assembler_->IfRegisterEqPos(register_index, if_eq);
}
@@ -337,7 +348,7 @@
void RegExpMacroAssemblerTracer::IfRegisterGE(int register_index,
int comparand, Label* if_ge)
{
PrintF(" IfRegisterGE(register=%d, number=%d, label[%08x]);\n",
- register_index, comparand, if_ge);
+ register_index, comparand, IntForLabel(if_ge));
assembler_->IfRegisterGE(register_index, comparand, if_ge);
}
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Sep 27 03:29:25 2010
+++ /branches/bleeding_edge/src/runtime.cc Tue Sep 28 04:44:30 2010
@@ -6801,7 +6801,7 @@
} else if (obj->IsFalse()) {
PrintF("<false>");
} else {
- PrintF("%p", obj);
+ PrintF("%p", reinterpret_cast<void*>(obj));
}
}
=======================================
--- /branches/bleeding_edge/src/spaces.h Tue Sep 28 03:35:47 2010
+++ /branches/bleeding_edge/src/spaces.h Tue Sep 28 04:44:30 2010
@@ -953,7 +953,7 @@
}
// Free allocated bytes, making them available (size -> available).
- void DeallocateBytes(int size_in_bytes) {
+ void DeallocateBytes(intptr_t size_in_bytes) {
size_ -= size_in_bytes;
available_ += size_in_bytes;
}
@@ -2133,7 +2133,7 @@
// Given a chunk size, returns the object size it can accommodate. Used
by
// LargeObjectSpace::Available.
- static int ObjectSizeFor(int chunk_size) {
+ static intptr_t ObjectSizeFor(intptr_t chunk_size) {
if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return
0;
return chunk_size - Page::kPageSize - Page::kObjectStartOffset;
}
=======================================
--- /branches/bleeding_edge/src/utils.h Wed Sep 15 03:54:35 2010
+++ /branches/bleeding_edge/src/utils.h Tue Sep 28 04:44:30 2010
@@ -222,11 +222,19 @@
//
----------------------------------------------------------------------------
// I/O support.
+#if __GNUC__ >= 4
+// On gcc we can ask the compiler to check the types of %d-style format
+// specifiers and their associated arguments.
+#define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2)))
+#else
+#define PRINTF_CHECKING
+#endif
+
// Our version of printf(). Avoids compilation errors that we get
// with standard printf when attempting to print pointers, etc.
// (the errors are due to the extra compilation flags, which we
// want elsewhere).
-void PrintF(const char* format, ...);
+void PRINTF_CHECKING PrintF(const char* format, ...);
// Our version of fflush.
void Flush();
=======================================
--- /branches/bleeding_edge/test/mjsunit/binary-op-newspace.js Fri Sep 3
05:10:44 2010
+++ /branches/bleeding_edge/test/mjsunit/binary-op-newspace.js Tue Sep 28
04:44:30 2010
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --max-new-space-size=262144
+// Flags: --max-new-space-size=256
// Check that a mod where the stub code hits a failure in heap number
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev