From: erik.corry@gmail.com Date: Wed, 22 Apr 2009 09:25:41 +0000 (+0000) Subject: Abolish kDebug and use ifdef DEBUG throughout for consistency. X-Git-Tag: upstream/4.7.83~24271 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f78fbf0c560411509746921da693844279dce6c8;p=platform%2Fupstream%2Fv8.git 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 --- diff --git a/src/assembler-ia32.cc b/src/assembler-ia32.cc index a0d45a6dd..3a2d3f82d 100644 --- a/src/assembler-ia32.cc +++ b/src/assembler-ia32.cc @@ -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_; diff --git a/src/codegen-arm.cc b/src/codegen-arm.cc index acedac354..9337454bb 100644 --- a/src/codegen-arm.cc +++ b/src/codegen-arm.cc @@ -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); } diff --git a/src/frames.cc b/src/frames.cc index 88c723d69..1eedbf640 100644 --- a/src/frames.cc +++ b/src/frames.cc @@ -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 } diff --git a/src/globals.h b/src/globals.h index 0a8e3729b..fbbe7c91d 100644 --- a/src/globals.h +++ b/src/globals.h @@ -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; diff --git a/src/macro-assembler-arm.cc b/src/macro-assembler-arm.cc index b2994c952..365c1ad7f 100644 --- a/src/macro-assembler-arm.cc +++ b/src/macro-assembler-arm.cc @@ -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; diff --git a/src/macro-assembler-ia32.cc b/src/macro-assembler-ia32.cc index 8b8e6fdc0..d6d5800fe 100644 --- a/src/macro-assembler-ia32.cc +++ b/src/macro-assembler-ia32.cc @@ -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);