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

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

Issue 5278003: Fix crashes during GC caused by partially initialized objects. The... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 1 month 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/ia32/stub-cache-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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 mov(scratch, FieldOperand(scratch, token_offset)); 530 mov(scratch, FieldOperand(scratch, token_offset));
531 cmp(scratch, FieldOperand(holder_reg, token_offset)); 531 cmp(scratch, FieldOperand(holder_reg, token_offset));
532 pop(holder_reg); 532 pop(holder_reg);
533 j(not_equal, miss, not_taken); 533 j(not_equal, miss, not_taken);
534 534
535 bind(&same_contexts); 535 bind(&same_contexts);
536 } 536 }
537 537
538 538
539 void MacroAssembler::LoadAllocationTopHelper(Register result, 539 void MacroAssembler::LoadAllocationTopHelper(Register result,
540 Register result_end,
541 Register scratch, 540 Register scratch,
542 AllocationFlags flags) { 541 AllocationFlags flags) {
543 ExternalReference new_space_allocation_top = 542 ExternalReference new_space_allocation_top =
544 ExternalReference::new_space_allocation_top_address(); 543 ExternalReference::new_space_allocation_top_address();
545 544
546 // Just return if allocation top is already known. 545 // Just return if allocation top is already known.
547 if ((flags & RESULT_CONTAINS_TOP) != 0) { 546 if ((flags & RESULT_CONTAINS_TOP) != 0) {
548 // No use of scratch if allocation top is provided. 547 // No use of scratch if allocation top is provided.
549 ASSERT(scratch.is(no_reg)); 548 ASSERT(scratch.is(no_reg));
550 #ifdef DEBUG 549 #ifdef DEBUG
551 // Assert that result actually contains top on entry. 550 // Assert that result actually contains top on entry.
552 cmp(result, Operand::StaticVariable(new_space_allocation_top)); 551 cmp(result, Operand::StaticVariable(new_space_allocation_top));
553 Check(equal, "Unexpected allocation top"); 552 Check(equal, "Unexpected allocation top");
554 #endif 553 #endif
555 return; 554 return;
556 } 555 }
557 556
558 // Move address of new object to result. Use scratch register if available. 557 // Move address of new object to result. Use scratch register if available.
559 if (scratch.is(no_reg)) { 558 if (scratch.is(no_reg)) {
560 mov(result, Operand::StaticVariable(new_space_allocation_top)); 559 mov(result, Operand::StaticVariable(new_space_allocation_top));
561 } else { 560 } else {
562 ASSERT(!scratch.is(result_end));
563 mov(Operand(scratch), Immediate(new_space_allocation_top)); 561 mov(Operand(scratch), Immediate(new_space_allocation_top));
564 mov(result, Operand(scratch, 0)); 562 mov(result, Operand(scratch, 0));
565 } 563 }
566 } 564 }
567 565
568 566
569 void MacroAssembler::UpdateAllocationTopHelper(Register result_end, 567 void MacroAssembler::UpdateAllocationTopHelper(Register result_end,
570 Register scratch) { 568 Register scratch) {
571 if (FLAG_debug_code) { 569 if (FLAG_debug_code) {
572 test(result_end, Immediate(kObjectAlignmentMask)); 570 test(result_end, Immediate(kObjectAlignmentMask));
(...skipping 28 matching lines...) Expand all
601 if (scratch.is_valid()) { 599 if (scratch.is_valid()) {
602 mov(scratch, Immediate(0x7291)); 600 mov(scratch, Immediate(0x7291));
603 } 601 }
604 } 602 }
605 jmp(gc_required); 603 jmp(gc_required);
606 return; 604 return;
607 } 605 }
608 ASSERT(!result.is(result_end)); 606 ASSERT(!result.is(result_end));
609 607
610 // Load address of new object into result. 608 // Load address of new object into result.
611 LoadAllocationTopHelper(result, result_end, scratch, flags); 609 LoadAllocationTopHelper(result, scratch, flags);
612 610
613 Register top_reg = result_end.is_valid() ? result_end : result; 611 Register top_reg = result_end.is_valid() ? result_end : result;
614 612
615 // Calculate new top and bail out if new space is exhausted. 613 // Calculate new top and bail out if new space is exhausted.
616 ExternalReference new_space_allocation_limit = 614 ExternalReference new_space_allocation_limit =
617 ExternalReference::new_space_allocation_limit_address(); 615 ExternalReference::new_space_allocation_limit_address();
618 616
619 if (top_reg.is(result)) { 617 if (top_reg.is(result)) {
620 add(Operand(top_reg), Immediate(object_size)); 618 add(Operand(top_reg), Immediate(object_size));
621 } else { 619 } else {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 mov(scratch, Immediate(0x7291)); 655 mov(scratch, Immediate(0x7291));
658 } 656 }
659 // Register element_count is not modified by the function. 657 // Register element_count is not modified by the function.
660 } 658 }
661 jmp(gc_required); 659 jmp(gc_required);
662 return; 660 return;
663 } 661 }
664 ASSERT(!result.is(result_end)); 662 ASSERT(!result.is(result_end));
665 663
666 // Load address of new object into result. 664 // Load address of new object into result.
667 LoadAllocationTopHelper(result, result_end, scratch, flags); 665 LoadAllocationTopHelper(result, scratch, flags);
668 666
669 // Calculate new top and bail out if new space is exhausted. 667 // Calculate new top and bail out if new space is exhausted.
670 ExternalReference new_space_allocation_limit = 668 ExternalReference new_space_allocation_limit =
671 ExternalReference::new_space_allocation_limit_address(); 669 ExternalReference::new_space_allocation_limit_address();
672 lea(result_end, Operand(result, element_count, element_size, header_size)); 670 lea(result_end, Operand(result, element_count, element_size, header_size));
673 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); 671 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit));
674 j(above, gc_required); 672 j(above, gc_required);
675 673
676 // Tag result if requested. 674 // Tag result if requested.
677 if ((flags & TAG_OBJECT) != 0) { 675 if ((flags & TAG_OBJECT) != 0) {
(...skipping 20 matching lines...) Expand all
698 mov(scratch, Immediate(0x7291)); 696 mov(scratch, Immediate(0x7291));
699 } 697 }
700 // object_size is left unchanged by this function. 698 // object_size is left unchanged by this function.
701 } 699 }
702 jmp(gc_required); 700 jmp(gc_required);
703 return; 701 return;
704 } 702 }
705 ASSERT(!result.is(result_end)); 703 ASSERT(!result.is(result_end));
706 704
707 // Load address of new object into result. 705 // Load address of new object into result.
708 LoadAllocationTopHelper(result, result_end, scratch, flags); 706 LoadAllocationTopHelper(result, scratch, flags);
709 707
710 // Calculate new top and bail out if new space is exhausted. 708 // Calculate new top and bail out if new space is exhausted.
711 ExternalReference new_space_allocation_limit = 709 ExternalReference new_space_allocation_limit =
712 ExternalReference::new_space_allocation_limit_address(); 710 ExternalReference::new_space_allocation_limit_address();
713 if (!object_size.is(result_end)) { 711 if (!object_size.is(result_end)) {
714 mov(result_end, object_size); 712 mov(result_end, object_size);
715 } 713 }
716 add(result_end, Operand(result)); 714 add(result_end, Operand(result));
717 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); 715 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit));
718 j(above, gc_required, not_taken); 716 j(above, gc_required, not_taken);
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 1857
1860 // Check that the code was patched as expected. 1858 // Check that the code was patched as expected.
1861 ASSERT(masm_.pc_ == address_ + size_); 1859 ASSERT(masm_.pc_ == address_ + size_);
1862 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1860 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1863 } 1861 }
1864 1862
1865 1863
1866 } } // namespace v8::internal 1864 } } // namespace v8::internal
1867 1865
1868 #endif // V8_TARGET_ARCH_IA32 1866 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698