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

Side by Side Diff: src/arm/macro-assembler-arm.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/arm/macro-assembler-arm.h ('k') | src/ia32/code-stubs-ia32.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 3017 matching lines...) Expand 10 before | Expand all | Expand 10 after
3028 void MacroAssembler::JumpIfEitherSmi(Register reg1, 3028 void MacroAssembler::JumpIfEitherSmi(Register reg1,
3029 Register reg2, 3029 Register reg2,
3030 Label* on_either_smi) { 3030 Label* on_either_smi) {
3031 STATIC_ASSERT(kSmiTag == 0); 3031 STATIC_ASSERT(kSmiTag == 0);
3032 tst(reg1, Operand(kSmiTagMask)); 3032 tst(reg1, Operand(kSmiTagMask));
3033 tst(reg2, Operand(kSmiTagMask), ne); 3033 tst(reg2, Operand(kSmiTagMask), ne);
3034 b(eq, on_either_smi); 3034 b(eq, on_either_smi);
3035 } 3035 }
3036 3036
3037 3037
3038 void MacroAssembler::AbortIfSmi(Register object) { 3038 void MacroAssembler::AssertNotSmi(Register object) {
3039 STATIC_ASSERT(kSmiTag == 0); 3039 if (emit_debug_code()) {
3040 tst(object, Operand(kSmiTagMask)); 3040 STATIC_ASSERT(kSmiTag == 0);
3041 Assert(ne, "Operand is a smi"); 3041 tst(object, Operand(kSmiTagMask));
3042 Check(ne, "Operand is a smi");
3043 }
3042 } 3044 }
3043 3045
3044 3046
3045 void MacroAssembler::AbortIfNotSmi(Register object) { 3047 void MacroAssembler::AssertSmi(Register object) {
3046 STATIC_ASSERT(kSmiTag == 0); 3048 if (emit_debug_code()) {
3047 tst(object, Operand(kSmiTagMask)); 3049 STATIC_ASSERT(kSmiTag == 0);
3048 Assert(eq, "Operand is not smi"); 3050 tst(object, Operand(kSmiTagMask));
3051 Check(eq, "Operand is not smi");
3052 }
3049 } 3053 }
3050 3054
3051 3055
3052 void MacroAssembler::AbortIfNotString(Register object) { 3056 void MacroAssembler::AssertString(Register object) {
3053 STATIC_ASSERT(kSmiTag == 0); 3057 if (emit_debug_code()) {
3054 tst(object, Operand(kSmiTagMask)); 3058 STATIC_ASSERT(kSmiTag == 0);
3055 Assert(ne, "Operand is not a string"); 3059 tst(object, Operand(kSmiTagMask));
3056 push(object); 3060 Check(ne, "Operand is a smi and not a string");
3057 ldr(object, FieldMemOperand(object, HeapObject::kMapOffset)); 3061 push(object);
3058 CompareInstanceType(object, object, FIRST_NONSTRING_TYPE); 3062 ldr(object, FieldMemOperand(object, HeapObject::kMapOffset));
3059 pop(object); 3063 CompareInstanceType(object, object, FIRST_NONSTRING_TYPE);
3060 Assert(lo, "Operand is not a string"); 3064 pop(object);
3065 Check(lo, "Operand is not a string");
3066 }
3061 } 3067 }
3062 3068
3063 3069
3064 3070
3065 void MacroAssembler::AbortIfNotRootValue(Register src, 3071 void MacroAssembler::AssertRootValue(Register src,
3066 Heap::RootListIndex root_value_index, 3072 Heap::RootListIndex root_value_index,
3067 const char* message) { 3073 const char* message) {
3068 CompareRoot(src, root_value_index); 3074 if (emit_debug_code()) {
3069 Assert(eq, message); 3075 CompareRoot(src, root_value_index);
3076 Check(eq, message);
3077 }
3070 } 3078 }
3071 3079
3072 3080
3073 void MacroAssembler::JumpIfNotHeapNumber(Register object, 3081 void MacroAssembler::JumpIfNotHeapNumber(Register object,
3074 Register heap_number_map, 3082 Register heap_number_map,
3075 Register scratch, 3083 Register scratch,
3076 Label* on_not_heap_number) { 3084 Label* on_not_heap_number) {
3077 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); 3085 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
3078 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); 3086 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
3079 cmp(scratch, heap_number_map); 3087 cmp(scratch, heap_number_map);
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
3854 void CodePatcher::EmitCondition(Condition cond) { 3862 void CodePatcher::EmitCondition(Condition cond) {
3855 Instr instr = Assembler::instr_at(masm_.pc_); 3863 Instr instr = Assembler::instr_at(masm_.pc_);
3856 instr = (instr & ~kCondMask) | cond; 3864 instr = (instr & ~kCondMask) | cond;
3857 masm_.emit(instr); 3865 masm_.emit(instr);
3858 } 3866 }
3859 3867
3860 3868
3861 } } // namespace v8::internal 3869 } } // namespace v8::internal
3862 3870
3863 #endif // V8_TARGET_ARCH_ARM 3871 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698