Abolish kDebug and use ifdef DEBUG throughout for consistency.
authorerik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 22 Apr 2009 09:25:41 +0000 (09:25 +0000)
committererik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 22 Apr 2009 09:25:41 +0000 (09:25 +0000)
Review URL: http://codereview.chromium.org/94001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1761 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/assembler-ia32.cc
src/codegen-arm.cc
src/frames.cc
src/globals.h
src/macro-assembler-arm.cc
src/macro-assembler-ia32.cc

index a0d45a6ddc3a1cb1f564a29ad73ab0290a00458d..3a2d3f82dd4f385f9dd04372470495d7987e6802 100644 (file)
@@ -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_;
index acedac3543d2af7d4c573922b9434464650ec57e..9337454bb8a4a3959cb64da79fadd2622c79578e 100644 (file)
@@ -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);
 }
 
index 88c723d6932d2eabae3a1bfd86c1604c81fa9d15..1eedbf64017fdea9d9734fb7d4f8c2c83110b140 100644 (file)
@@ -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
 }
 
 
index 0a8e3729b2fc0337f92bf95302f82f5ec0724cd3..fbbe7c91d957c94e1dd7524256dca8b6d4d8c466 100644 (file)
@@ -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;
index b2994c952361c1cae1cdc8d1bccd2130152542f9..365c1ad7f2e305cc0bd880eeb46bd9b4ffbc2edb 100644 (file)
@@ -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;
index 8b8e6fdc01c8248632b249d5451dc2d5deccf5a6..d6d5800fe6b87c3020971e31213fe5a6a49137f5 100644 (file)
@@ -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);