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

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

Issue 23242006: Fix invalid out-of-bounds store in MacroAssembler::Allocate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix typo for MIPS. Created 7 years, 4 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 | « no previous file | src/ia32/macro-assembler-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 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 ldr(ip, MemOperand(topaddr)); 1725 ldr(ip, MemOperand(topaddr));
1726 cmp(result, ip); 1726 cmp(result, ip);
1727 Check(eq, kUnexpectedAllocationTop); 1727 Check(eq, kUnexpectedAllocationTop);
1728 } 1728 }
1729 // Load allocation limit into ip. Result already contains allocation top. 1729 // Load allocation limit into ip. Result already contains allocation top.
1730 ldr(ip, MemOperand(topaddr, limit - top)); 1730 ldr(ip, MemOperand(topaddr, limit - top));
1731 } 1731 }
1732 1732
1733 if ((flags & DOUBLE_ALIGNMENT) != 0) { 1733 if ((flags & DOUBLE_ALIGNMENT) != 0) {
1734 // Align the next allocation. Storing the filler map without checking top is 1734 // Align the next allocation. Storing the filler map without checking top is
1735 // always safe because the limit of the heap is always aligned. 1735 // safe in new-space because the limit of the heap is aligned there.
1736 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); 1736 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
1737 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); 1737 ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
1738 and_(scratch2, result, Operand(kDoubleAlignmentMask), SetCC); 1738 and_(scratch2, result, Operand(kDoubleAlignmentMask), SetCC);
1739 Label aligned; 1739 Label aligned;
1740 b(eq, &aligned); 1740 b(eq, &aligned);
1741 if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) {
1742 cmp(result, Operand(ip));
1743 b(hs, gc_required);
1744 }
1741 mov(scratch2, Operand(isolate()->factory()->one_pointer_filler_map())); 1745 mov(scratch2, Operand(isolate()->factory()->one_pointer_filler_map()));
1742 str(scratch2, MemOperand(result, kDoubleSize / 2, PostIndex)); 1746 str(scratch2, MemOperand(result, kDoubleSize / 2, PostIndex));
1743 bind(&aligned); 1747 bind(&aligned);
1744 } 1748 }
1745 1749
1746 // Calculate new top and bail out if new space is exhausted. Use result 1750 // Calculate new top and bail out if new space is exhausted. Use result
1747 // to calculate the new top. 1751 // to calculate the new top.
1748 if (obj_size_operand.is_single_instruction(this)) { 1752 if (obj_size_operand.is_single_instruction(this)) {
1749 // We can add the size as an immediate 1753 // We can add the size as an immediate
1750 add(scratch2, result, obj_size_operand, SetCC); 1754 add(scratch2, result, obj_size_operand, SetCC);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 ldr(ip, MemOperand(topaddr)); 1827 ldr(ip, MemOperand(topaddr));
1824 cmp(result, ip); 1828 cmp(result, ip);
1825 Check(eq, kUnexpectedAllocationTop); 1829 Check(eq, kUnexpectedAllocationTop);
1826 } 1830 }
1827 // Load allocation limit into ip. Result already contains allocation top. 1831 // Load allocation limit into ip. Result already contains allocation top.
1828 ldr(ip, MemOperand(topaddr, limit - top)); 1832 ldr(ip, MemOperand(topaddr, limit - top));
1829 } 1833 }
1830 1834
1831 if ((flags & DOUBLE_ALIGNMENT) != 0) { 1835 if ((flags & DOUBLE_ALIGNMENT) != 0) {
1832 // Align the next allocation. Storing the filler map without checking top is 1836 // Align the next allocation. Storing the filler map without checking top is
1833 // always safe because the limit of the heap is always aligned. 1837 // safe in new-space because the limit of the heap is aligned there.
1834 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); 1838 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
1835 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); 1839 ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
1836 and_(scratch2, result, Operand(kDoubleAlignmentMask), SetCC); 1840 and_(scratch2, result, Operand(kDoubleAlignmentMask), SetCC);
1837 Label aligned; 1841 Label aligned;
1838 b(eq, &aligned); 1842 b(eq, &aligned);
1843 if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) {
1844 cmp(result, Operand(ip));
1845 b(hs, gc_required);
1846 }
1839 mov(scratch2, Operand(isolate()->factory()->one_pointer_filler_map())); 1847 mov(scratch2, Operand(isolate()->factory()->one_pointer_filler_map()));
1840 str(scratch2, MemOperand(result, kDoubleSize / 2, PostIndex)); 1848 str(scratch2, MemOperand(result, kDoubleSize / 2, PostIndex));
1841 bind(&aligned); 1849 bind(&aligned);
1842 } 1850 }
1843 1851
1844 // Calculate new top and bail out if new space is exhausted. Use result 1852 // Calculate new top and bail out if new space is exhausted. Use result
1845 // to calculate the new top. Object size may be in words so a shift is 1853 // to calculate the new top. Object size may be in words so a shift is
1846 // required to get the number of bytes. 1854 // required to get the number of bytes.
1847 if ((flags & SIZE_IN_WORDS) != 0) { 1855 if ((flags & SIZE_IN_WORDS) != 0) {
1848 add(scratch2, result, Operand(object_size, LSL, kPointerSizeLog2), SetCC); 1856 add(scratch2, result, Operand(object_size, LSL, kPointerSizeLog2), SetCC);
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3874 void CodePatcher::EmitCondition(Condition cond) { 3882 void CodePatcher::EmitCondition(Condition cond) {
3875 Instr instr = Assembler::instr_at(masm_.pc_); 3883 Instr instr = Assembler::instr_at(masm_.pc_);
3876 instr = (instr & ~kCondMask) | cond; 3884 instr = (instr & ~kCondMask) | cond;
3877 masm_.emit(instr); 3885 masm_.emit(instr);
3878 } 3886 }
3879 3887
3880 3888
3881 } } // namespace v8::internal 3889 } } // namespace v8::internal
3882 3890
3883 #endif // V8_TARGET_ARCH_ARM 3891 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698