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

Side by Side Diff: src/ia32/macro-assembler-ia32.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/ia32/macro-assembler-ia32.h ('k') | src/mips/code-stubs-mips.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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 lea(address, FieldOperand(object, HeapObject::kMapOffset)); 267 lea(address, FieldOperand(object, HeapObject::kMapOffset));
268 test_b(address, (1 << kPointerSizeLog2) - 1); 268 test_b(address, (1 << kPointerSizeLog2) - 1);
269 j(zero, &ok, Label::kNear); 269 j(zero, &ok, Label::kNear);
270 int3(); 270 int3();
271 bind(&ok); 271 bind(&ok);
272 } 272 }
273 273
274 ASSERT(!object.is(value)); 274 ASSERT(!object.is(value));
275 ASSERT(!object.is(address)); 275 ASSERT(!object.is(address));
276 ASSERT(!value.is(address)); 276 ASSERT(!value.is(address));
277 if (emit_debug_code()) { 277 AssertNotSmi(object);
278 AbortIfSmi(object);
279 }
280 278
281 if (!FLAG_incremental_marking) { 279 if (!FLAG_incremental_marking) {
282 return; 280 return;
283 } 281 }
284 282
285 // A single check of the map's pages interesting flag suffices, since it is 283 // A single check of the map's pages interesting flag suffices, since it is
286 // only set during incremental collection, and then it's also guaranteed that 284 // only set during incremental collection, and then it's also guaranteed that
287 // the from object's page's interesting flag is also set. This optimization 285 // the from object's page's interesting flag is also set. This optimization
288 // relies on the fact that maps can never be in new space. 286 // relies on the fact that maps can never be in new space.
289 ASSERT(!isolate()->heap()->InNewSpace(*map)); 287 ASSERT(!isolate()->heap()->InNewSpace(*map));
(...skipping 26 matching lines...) Expand all
316 314
317 void MacroAssembler::RecordWrite(Register object, 315 void MacroAssembler::RecordWrite(Register object,
318 Register address, 316 Register address,
319 Register value, 317 Register value,
320 SaveFPRegsMode fp_mode, 318 SaveFPRegsMode fp_mode,
321 RememberedSetAction remembered_set_action, 319 RememberedSetAction remembered_set_action,
322 SmiCheck smi_check) { 320 SmiCheck smi_check) {
323 ASSERT(!object.is(value)); 321 ASSERT(!object.is(value));
324 ASSERT(!object.is(address)); 322 ASSERT(!object.is(address));
325 ASSERT(!value.is(address)); 323 ASSERT(!value.is(address));
326 if (emit_debug_code()) { 324 AssertNotSmi(object);
327 AbortIfSmi(object);
328 }
329 325
330 if (remembered_set_action == OMIT_REMEMBERED_SET && 326 if (remembered_set_action == OMIT_REMEMBERED_SET &&
331 !FLAG_incremental_marking) { 327 !FLAG_incremental_marking) {
332 return; 328 return;
333 } 329 }
334 330
335 if (emit_debug_code()) { 331 if (emit_debug_code()) {
336 Label ok; 332 Label ok;
337 cmp(value, Operand(address, 0)); 333 cmp(value, Operand(address, 0));
338 j(equal, &ok, Label::kNear); 334 j(equal, &ok, Label::kNear);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } else { 657 } else {
662 fucompp(); 658 fucompp();
663 push(eax); 659 push(eax);
664 fnstsw_ax(); 660 fnstsw_ax();
665 sahf(); 661 sahf();
666 pop(eax); 662 pop(eax);
667 } 663 }
668 } 664 }
669 665
670 666
671 void MacroAssembler::AbortIfNotNumber(Register object) { 667 void MacroAssembler::AssertNumber(Register object) {
672 Label ok; 668 if (emit_debug_code()) {
673 JumpIfSmi(object, &ok); 669 Label ok;
674 cmp(FieldOperand(object, HeapObject::kMapOffset), 670 JumpIfSmi(object, &ok);
675 isolate()->factory()->heap_number_map()); 671 cmp(FieldOperand(object, HeapObject::kMapOffset),
676 Assert(equal, "Operand not a number"); 672 isolate()->factory()->heap_number_map());
677 bind(&ok); 673 Check(equal, "Operand not a number");
674 bind(&ok);
675 }
678 } 676 }
679 677
680 678
681 void MacroAssembler::AbortIfNotSmi(Register object) { 679 void MacroAssembler::AssertSmi(Register object) {
682 test(object, Immediate(kSmiTagMask)); 680 if (emit_debug_code()) {
683 Assert(equal, "Operand is not a smi"); 681 test(object, Immediate(kSmiTagMask));
682 Check(equal, "Operand is not a smi");
683 }
684 } 684 }
685 685
686 686
687 void MacroAssembler::AbortIfNotString(Register object) { 687 void MacroAssembler::AssertString(Register object) {
688 test(object, Immediate(kSmiTagMask)); 688 if (emit_debug_code()) {
689 Assert(not_equal, "Operand is not a string"); 689 test(object, Immediate(kSmiTagMask));
690 push(object); 690 Check(not_equal, "Operand is a smi and not a string");
691 mov(object, FieldOperand(object, HeapObject::kMapOffset)); 691 push(object);
692 CmpInstanceType(object, FIRST_NONSTRING_TYPE); 692 mov(object, FieldOperand(object, HeapObject::kMapOffset));
693 pop(object); 693 CmpInstanceType(object, FIRST_NONSTRING_TYPE);
694 Assert(below, "Operand is not a string"); 694 pop(object);
695 Check(below, "Operand is not a string");
696 }
695 } 697 }
696 698
697 699
698 void MacroAssembler::AbortIfSmi(Register object) { 700 void MacroAssembler::AssertNotSmi(Register object) {
699 test(object, Immediate(kSmiTagMask)); 701 if (emit_debug_code()) {
700 Assert(not_equal, "Operand is a smi"); 702 test(object, Immediate(kSmiTagMask));
703 Check(not_equal, "Operand is a smi");
704 }
701 } 705 }
702 706
703 707
704 void MacroAssembler::EnterFrame(StackFrame::Type type) { 708 void MacroAssembler::EnterFrame(StackFrame::Type type) {
705 push(ebp); 709 push(ebp);
706 mov(ebp, esp); 710 mov(ebp, esp);
707 push(esi); 711 push(esi);
708 push(Immediate(Smi::FromInt(type))); 712 push(Immediate(Smi::FromInt(type)));
709 push(Immediate(CodeObject())); 713 push(Immediate(CodeObject()));
710 if (emit_debug_code()) { 714 if (emit_debug_code()) {
(...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 j(not_equal, call_runtime); 2990 j(not_equal, call_runtime);
2987 2991
2988 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 2992 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
2989 cmp(ecx, isolate()->factory()->null_value()); 2993 cmp(ecx, isolate()->factory()->null_value());
2990 j(not_equal, &next); 2994 j(not_equal, &next);
2991 } 2995 }
2992 2996
2993 } } // namespace v8::internal 2997 } } // namespace v8::internal
2994 2998
2995 #endif // V8_TARGET_ARCH_IA32 2999 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698