} 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);
}
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) {
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) {
// 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();
}
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);
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();
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");
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");
}
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;
}
if (Contains(i)) {
if (!first) PrintF(",");
first = false;
- PrintF("%d");
+ PrintF("%d", i);
}
}
PrintF("}");
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);
}
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);
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);
}
}
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_ =
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
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.
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.
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();
#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
}
void HeapObject::PrintHeader(const char* id) {
- PrintF("%p: [%s]\n", this, id);
+ PrintF("%p: [%s]\n", reinterpret_cast<void*>(this), id);
}
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();
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();
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();
}
}
+// 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);
}
void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) {
- PrintF(" CheckGreedyLoop(label[%08x]);\n\n", label);
+ PrintF(" CheckGreedyLoop(label[%08x]);\n\n", IntForLabel(label));
assembler_->CheckGreedyLoop(label);
}
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);
}
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,
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);
}
PrintF(" CheckCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
c,
mask,
- on_equal);
+ IntForLabel(on_equal));
assembler_->CheckCharacterAfterAnd(c, mask, on_equal);
}
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);
}
c,
minus,
mask,
- on_not_equal);
+ IntForLabel(on_not_equal));
assembler_->CheckNotCharacterAfterMinusAnd(c, minus, mask, on_not_equal);
}
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);
}
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);
}
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);
}
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);
}
on_no_match);
PrintF(" CheckSpecialCharacterClass(type='%c', label[%08x]): %s;\n",
type,
- on_no_match,
+ IntForLabel(on_no_match),
supported ? "true" : "false");
return supported;
}
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);
}
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);
}
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);
}
} else if (obj->IsFalse()) {
PrintF("<false>");
} else {
- PrintF("%p", obj);
+ PrintF("%p", reinterpret_cast<void*>(obj));
}
}
}
// 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;
}
// 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;
}
// ----------------------------------------------------------------------------
// 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();
// (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