Commit f78fbf0c authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Abolish kDebug and use ifdef DEBUG throughout for consistency.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1761 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3b84a19b
......@@ -319,9 +319,11 @@ Assembler::Assembler(void* buffer, int buffer_size) {
// Clear the buffer in debug mode unless it was provided by the
// caller in which case we can't be sure it's okay to overwrite
// existing code in it; see CodePatcher::CodePatcher(...).
if (kDebug && own_buffer_) {
#ifdef DEBUG
if (own_buffer_) {
memset(buffer_, 0xCC, buffer_size); // int3
}
#endif
// setup buffer pointers
ASSERT(buffer_ != NULL);
......@@ -2080,9 +2082,9 @@ void Assembler::GrowBuffer() {
// Clear the buffer in debug mode. Use 'int3' instructions to make
// sure to get into problems if we ever run uninitialized code.
if (kDebug) {
memset(desc.buffer, 0xCC, desc.buffer_size);
}
#ifdef DEBUG
memset(desc.buffer, 0xCC, desc.buffer_size);
#endif
// copy the data
int pc_delta = desc.buffer - buffer_;
......
......@@ -147,13 +147,13 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) {
frame_->EmitPush(r0);
frame_->CallRuntime(Runtime::kNewContext, 1); // r0 holds the result
if (kDebug) {
JumpTarget verified_true(this);
__ cmp(r0, Operand(cp));
verified_true.Branch(eq);
__ stop("NewContext: r0 is expected to be the same as cp");
verified_true.Bind();
}
#ifdef DEBUG
JumpTarget verified_true(this);
__ cmp(r0, Operand(cp));
verified_true.Branch(eq);
__ stop("NewContext: r0 is expected to be the same as cp");
verified_true.Bind();
#endif
// Update context local.
__ str(cp, frame_->Context());
}
......@@ -1423,13 +1423,13 @@ void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) {
} else {
frame_->CallRuntime(Runtime::kPushContext, 1);
}
if (kDebug) {
JumpTarget verified_true(this);
__ cmp(r0, Operand(cp));
verified_true.Branch(eq);
__ stop("PushContext: r0 is expected to be the same as cp");
verified_true.Bind();
}
#ifdef DEBUG
JumpTarget verified_true(this);
__ cmp(r0, Operand(cp));
verified_true.Branch(eq);
__ stop("PushContext: r0 is expected to be the same as cp");
verified_true.Bind();
#endif
// Update context local.
__ str(cp, frame_->Context());
ASSERT(frame_->height() == original_height);
......@@ -4656,9 +4656,11 @@ void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
__ mov(cp, Operand(0), LeaveCC, eq);
// Restore cp otherwise.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne);
if (kDebug && FLAG_debug_code) {
#ifdef DEBUG
if (FLAG_debug_code) {
__ mov(lr, Operand(pc));
}
#endif
__ pop(pc);
}
......@@ -4721,9 +4723,11 @@ void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) {
__ mov(cp, Operand(0), LeaveCC, eq);
// Restore cp otherwise.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne);
if (kDebug && FLAG_debug_code) {
#ifdef DEBUG
if (FLAG_debug_code) {
__ mov(lr, Operand(pc));
}
#endif
__ pop(pc);
}
......
......@@ -647,10 +647,10 @@ void EntryFrame::Iterate(ObjectVisitor* v) const {
handler->Iterate(v);
// Make sure that there's the entry frame does not contain more than
// one stack handler.
if (kDebug) {
it.Advance();
ASSERT(it.done());
}
#ifdef DEBUG
it.Advance();
ASSERT(it.done());
#endif
}
......
......@@ -80,12 +80,6 @@ typedef signed int uc32;
// -----------------------------------------------------------------------------
// Constants
#ifdef DEBUG
const bool kDebug = true;
#else
const bool kDebug = false;
#endif // DEBUG
const int KB = 1024;
const int MB = KB * KB;
const int GB = KB * KB * KB;
......
......@@ -352,9 +352,9 @@ void MacroAssembler::LeaveExitFrame(StackFrame::Type type) {
// Restore current context from top and clear it in debug mode.
mov(ip, Operand(ExternalReference(Top::k_context_address)));
ldr(cp, MemOperand(ip));
if (kDebug) {
str(r3, MemOperand(ip));
}
#ifdef DEBUG
str(r3, MemOperand(ip));
#endif
// Pop the arguments, restore registers, and return.
mov(sp, Operand(fp)); // respect ABI stack constraint
......@@ -679,10 +679,10 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
// Load current lexical context from the stack frame.
ldr(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset));
// In debug mode, make sure the lexical context is set.
if (kDebug) {
cmp(scratch, Operand(0));
Check(ne, "we should not have an empty lexical context");
}
#ifdef DEBUG
cmp(scratch, Operand(0));
Check(ne, "we should not have an empty lexical context");
#endif
// Load the global context of the current context.
int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
......
......@@ -432,9 +432,9 @@ void MacroAssembler::LeaveExitFrame(StackFrame::Type type) {
// Restore current context from top and clear it in debug mode.
ExternalReference context_address(Top::k_context_address);
mov(esi, Operand::StaticVariable(context_address));
if (kDebug) {
mov(Operand::StaticVariable(context_address), Immediate(0));
}
#ifdef DEBUG
mov(Operand::StaticVariable(context_address), Immediate(0));
#endif
// Push the return address to get ready to return.
push(ecx);
......
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