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

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

Issue 6461022: Merge a number of assertion failure fixes to the 3.0 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.0/
Patch Set: '' Created 9 years, 10 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 // Load address of new object into result. 598 // Load address of new object into result.
599 LoadAllocationTopHelper(result, scratch, flags); 599 LoadAllocationTopHelper(result, scratch, flags);
600 600
601 Register top_reg = result_end.is_valid() ? result_end : result; 601 Register top_reg = result_end.is_valid() ? result_end : result;
602 602
603 // Calculate new top and bail out if new space is exhausted. 603 // Calculate new top and bail out if new space is exhausted.
604 ExternalReference new_space_allocation_limit = 604 ExternalReference new_space_allocation_limit =
605 ExternalReference::new_space_allocation_limit_address(); 605 ExternalReference::new_space_allocation_limit_address();
606 606
607 if (top_reg.is(result)) { 607 if (!top_reg.is(result)) {
608 add(Operand(top_reg), Immediate(object_size)); 608 mov(top_reg, result);
609 } else {
610 lea(top_reg, Operand(result, object_size));
611 } 609 }
610 add(Operand(top_reg), Immediate(object_size));
611 j(carry, gc_required, not_taken);
612 cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit)); 612 cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit));
613 j(above, gc_required, not_taken); 613 j(above, gc_required, not_taken);
614 614
615 // Update allocation top. 615 // Update allocation top.
616 UpdateAllocationTopHelper(top_reg, scratch); 616 UpdateAllocationTopHelper(top_reg, scratch);
617 617
618 // Tag result if requested. 618 // Tag result if requested.
619 if (top_reg.is(result)) { 619 if (top_reg.is(result)) {
620 if ((flags & TAG_OBJECT) != 0) { 620 if ((flags & TAG_OBJECT) != 0) {
621 sub(Operand(result), Immediate(object_size - kHeapObjectTag)); 621 sub(Operand(result), Immediate(object_size - kHeapObjectTag));
(...skipping 28 matching lines...) Expand all
650 return; 650 return;
651 } 651 }
652 ASSERT(!result.is(result_end)); 652 ASSERT(!result.is(result_end));
653 653
654 // Load address of new object into result. 654 // Load address of new object into result.
655 LoadAllocationTopHelper(result, scratch, flags); 655 LoadAllocationTopHelper(result, scratch, flags);
656 656
657 // Calculate new top and bail out if new space is exhausted. 657 // Calculate new top and bail out if new space is exhausted.
658 ExternalReference new_space_allocation_limit = 658 ExternalReference new_space_allocation_limit =
659 ExternalReference::new_space_allocation_limit_address(); 659 ExternalReference::new_space_allocation_limit_address();
660 lea(result_end, Operand(result, element_count, element_size, header_size)); 660
661 // We assume that element_count*element_size + header_size does not
662 // overflow.
663 lea(result_end, Operand(element_count, element_size, header_size));
664 add(result_end, Operand(result));
665 j(carry, gc_required);
661 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); 666 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit));
662 j(above, gc_required); 667 j(above, gc_required);
663 668
664 // Tag result if requested. 669 // Tag result if requested.
665 if ((flags & TAG_OBJECT) != 0) { 670 if ((flags & TAG_OBJECT) != 0) {
666 lea(result, Operand(result, kHeapObjectTag)); 671 lea(result, Operand(result, kHeapObjectTag));
667 } 672 }
668 673
669 // Update allocation top. 674 // Update allocation top.
670 UpdateAllocationTopHelper(result_end, scratch); 675 UpdateAllocationTopHelper(result_end, scratch);
(...skipping 24 matching lines...) Expand all
695 // Load address of new object into result. 700 // Load address of new object into result.
696 LoadAllocationTopHelper(result, scratch, flags); 701 LoadAllocationTopHelper(result, scratch, flags);
697 702
698 // Calculate new top and bail out if new space is exhausted. 703 // Calculate new top and bail out if new space is exhausted.
699 ExternalReference new_space_allocation_limit = 704 ExternalReference new_space_allocation_limit =
700 ExternalReference::new_space_allocation_limit_address(); 705 ExternalReference::new_space_allocation_limit_address();
701 if (!object_size.is(result_end)) { 706 if (!object_size.is(result_end)) {
702 mov(result_end, object_size); 707 mov(result_end, object_size);
703 } 708 }
704 add(result_end, Operand(result)); 709 add(result_end, Operand(result));
710 j(carry, gc_required, not_taken);
705 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); 711 cmp(result_end, Operand::StaticVariable(new_space_allocation_limit));
706 j(above, gc_required, not_taken); 712 j(above, gc_required, not_taken);
707 713
708 // Tag result if requested. 714 // Tag result if requested.
709 if ((flags & TAG_OBJECT) != 0) { 715 if ((flags & TAG_OBJECT) != 0) {
710 lea(result, Operand(result, kHeapObjectTag)); 716 lea(result, Operand(result, kHeapObjectTag));
711 } 717 }
712 718
713 // Update allocation top. 719 // Update allocation top.
714 UpdateAllocationTopHelper(result_end, scratch); 720 UpdateAllocationTopHelper(result_end, scratch);
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); 1570 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters);
1565 return kNumSafepointRegisters - reg_code - 1; 1571 return kNumSafepointRegisters - reg_code - 1;
1566 } 1572 }
1567 1573
1568 1574
1569 void MacroAssembler::Ret() { 1575 void MacroAssembler::Ret() {
1570 ret(0); 1576 ret(0);
1571 } 1577 }
1572 1578
1573 1579
1580 void MacroAssembler::Ret(int bytes_dropped, Register scratch) {
1581 if (is_uint16(bytes_dropped)) {
1582 ret(bytes_dropped);
1583 } else {
1584 pop(scratch);
1585 add(Operand(esp), Immediate(bytes_dropped));
1586 push(scratch);
1587 ret(0);
1588 }
1589 }
1590
1591
Rico 2011/02/10 06:58:20 Remove two blank lines
1592
1593
1574 void MacroAssembler::Drop(int stack_elements) { 1594 void MacroAssembler::Drop(int stack_elements) {
1575 if (stack_elements > 0) { 1595 if (stack_elements > 0) {
1576 add(Operand(esp), Immediate(stack_elements * kPointerSize)); 1596 add(Operand(esp), Immediate(stack_elements * kPointerSize));
1577 } 1597 }
1578 } 1598 }
1579 1599
1580 1600
1581 void MacroAssembler::Move(Register dst, Register src) { 1601 void MacroAssembler::Move(Register dst, Register src) {
1582 if (!dst.is(src)) { 1602 if (!dst.is(src)) {
1583 mov(dst, src); 1603 mov(dst, src);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 1909
1890 // Check that the code was patched as expected. 1910 // Check that the code was patched as expected.
1891 ASSERT(masm_.pc_ == address_ + size_); 1911 ASSERT(masm_.pc_ == address_ + size_);
1892 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1912 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1893 } 1913 }
1894 1914
1895 1915
1896 } } // namespace v8::internal 1916 } } // namespace v8::internal
1897 1917
1898 #endif // V8_TARGET_ARCH_IA32 1918 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698