Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 11108011: Ensure that we do not accidentally emit debug code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed indentation Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4780 matching lines...) Expand 10 before | Expand all | Expand 10 after
4791 Register reg2, 4791 Register reg2,
4792 Label* on_either_smi) { 4792 Label* on_either_smi) {
4793 STATIC_ASSERT(kSmiTag == 0); 4793 STATIC_ASSERT(kSmiTag == 0);
4794 ASSERT_EQ(1, kSmiTagMask); 4794 ASSERT_EQ(1, kSmiTagMask);
4795 // Both Smi tags must be 1 (not Smi). 4795 // Both Smi tags must be 1 (not Smi).
4796 and_(at, reg1, reg2); 4796 and_(at, reg1, reg2);
4797 JumpIfSmi(at, on_either_smi); 4797 JumpIfSmi(at, on_either_smi);
4798 } 4798 }
4799 4799
4800 4800
4801 void MacroAssembler::AbortIfSmi(Register object) { 4801 void MacroAssembler::AssertNotSmi(Register object) {
4802 STATIC_ASSERT(kSmiTag == 0); 4802 if (emit_debug_code()) {
4803 andi(at, object, kSmiTagMask); 4803 STATIC_ASSERT(kSmiTag == 0);
4804 Assert(ne, "Operand is a smi", at, Operand(zero_reg)); 4804 andi(at, object, kSmiTagMask);
4805 Check(ne, "Operand is a smi", at, Operand(zero_reg));
4806 }
4805 } 4807 }
4806 4808
4807 4809
4808 void MacroAssembler::AbortIfNotSmi(Register object) { 4810 void MacroAssembler::AssertSmi(Register object) {
4809 STATIC_ASSERT(kSmiTag == 0); 4811 if (emit_debug_code()) {
4810 andi(at, object, kSmiTagMask); 4812 STATIC_ASSERT(kSmiTag == 0);
4811 Assert(eq, "Operand is a smi", at, Operand(zero_reg)); 4813 andi(at, object, kSmiTagMask);
4814 Check(eq, "Operand is a smi", at, Operand(zero_reg));
4815 }
4812 } 4816 }
4813 4817
4814 4818
4815 void MacroAssembler::AbortIfNotString(Register object) { 4819 void MacroAssembler::AssertString(Register object) {
4816 STATIC_ASSERT(kSmiTag == 0); 4820 if (emit_debug_code()) {
4817 And(t0, object, Operand(kSmiTagMask)); 4821 STATIC_ASSERT(kSmiTag == 0);
4818 Assert(ne, "Operand is not a string", t0, Operand(zero_reg)); 4822 And(t0, object, Operand(kSmiTagMask));
4819 push(object); 4823 Check(ne, "Operand is a smi and not a string", t0, Operand(zero_reg));
4820 lw(object, FieldMemOperand(object, HeapObject::kMapOffset)); 4824 push(object);
4821 lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset)); 4825 lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
4822 Assert(lo, "Operand is not a string", object, Operand(FIRST_NONSTRING_TYPE)); 4826 lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
4823 pop(object); 4827 Check(lo, "Operand is not a string", object, Operand(FIRST_NONSTRING_TYPE));
4828 pop(object);
4829 }
4824 } 4830 }
4825 4831
4826 4832
4827 void MacroAssembler::AbortIfNotRootValue(Register src, 4833 void MacroAssembler::AssertRootValue(Register src,
4828 Heap::RootListIndex root_value_index, 4834 Heap::RootListIndex root_value_index,
4829 const char* message) { 4835 const char* message) {
4830 ASSERT(!src.is(at)); 4836 if (emit_debug_code()) {
4831 LoadRoot(at, root_value_index); 4837 ASSERT(!src.is(at));
4832 Assert(eq, message, src, Operand(at)); 4838 LoadRoot(at, root_value_index);
4839 Check(eq, message, src, Operand(at));
4840 }
4833 } 4841 }
4834 4842
4835 4843
4836 void MacroAssembler::JumpIfNotHeapNumber(Register object, 4844 void MacroAssembler::JumpIfNotHeapNumber(Register object,
4837 Register heap_number_map, 4845 Register heap_number_map,
4838 Register scratch, 4846 Register scratch,
4839 Label* on_not_heap_number) { 4847 Label* on_not_heap_number) {
4840 lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); 4848 lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
4841 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); 4849 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
4842 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map)); 4850 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map));
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
5473 opcode == BGTZL); 5481 opcode == BGTZL);
5474 opcode = (cond == eq) ? BEQ : BNE; 5482 opcode = (cond == eq) ? BEQ : BNE;
5475 instr = (instr & ~kOpcodeMask) | opcode; 5483 instr = (instr & ~kOpcodeMask) | opcode;
5476 masm_.emit(instr); 5484 masm_.emit(instr);
5477 } 5485 }
5478 5486
5479 5487
5480 } } // namespace v8::internal 5488 } } // namespace v8::internal
5481 5489
5482 #endif // V8_TARGET_ARCH_MIPS 5490 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698