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

Side by Side Diff: src/x64/macro-assembler-x64.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 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/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; 1882 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize;
1883 movq(scratch, FieldOperand(scratch, token_offset)); 1883 movq(scratch, FieldOperand(scratch, token_offset));
1884 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); 1884 cmpq(scratch, FieldOperand(kScratchRegister, token_offset));
1885 j(not_equal, miss); 1885 j(not_equal, miss);
1886 1886
1887 bind(&same_contexts); 1887 bind(&same_contexts);
1888 } 1888 }
1889 1889
1890 1890
1891 void MacroAssembler::LoadAllocationTopHelper(Register result, 1891 void MacroAssembler::LoadAllocationTopHelper(Register result,
1892 Register result_end,
1893 Register scratch, 1892 Register scratch,
1894 AllocationFlags flags) { 1893 AllocationFlags flags) {
1895 ExternalReference new_space_allocation_top = 1894 ExternalReference new_space_allocation_top =
1896 ExternalReference::new_space_allocation_top_address(); 1895 ExternalReference::new_space_allocation_top_address();
1897 1896
1898 // Just return if allocation top is already known. 1897 // Just return if allocation top is already known.
1899 if ((flags & RESULT_CONTAINS_TOP) != 0) { 1898 if ((flags & RESULT_CONTAINS_TOP) != 0) {
1900 // No use of scratch if allocation top is provided. 1899 // No use of scratch if allocation top is provided.
1901 ASSERT(!scratch.is_valid()); 1900 ASSERT(!scratch.is_valid());
1902 #ifdef DEBUG 1901 #ifdef DEBUG
1903 // Assert that result actually contains top on entry. 1902 // Assert that result actually contains top on entry.
1904 movq(kScratchRegister, new_space_allocation_top); 1903 movq(kScratchRegister, new_space_allocation_top);
1905 cmpq(result, Operand(kScratchRegister, 0)); 1904 cmpq(result, Operand(kScratchRegister, 0));
1906 Check(equal, "Unexpected allocation top"); 1905 Check(equal, "Unexpected allocation top");
1907 #endif 1906 #endif
1908 return; 1907 return;
1909 } 1908 }
1910 1909
1911 // Move address of new object to result. Use scratch register if available, 1910 // Move address of new object to result. Use scratch register if available,
1912 // and keep address in scratch until call to UpdateAllocationTopHelper. 1911 // and keep address in scratch until call to UpdateAllocationTopHelper.
1913 if (scratch.is_valid()) { 1912 if (scratch.is_valid()) {
1914 ASSERT(!scratch.is(result_end));
1915 movq(scratch, new_space_allocation_top); 1913 movq(scratch, new_space_allocation_top);
1916 movq(result, Operand(scratch, 0)); 1914 movq(result, Operand(scratch, 0));
1917 } else if (result.is(rax)) { 1915 } else if (result.is(rax)) {
1918 load_rax(new_space_allocation_top); 1916 load_rax(new_space_allocation_top);
1919 } else { 1917 } else {
1920 movq(kScratchRegister, new_space_allocation_top); 1918 movq(kScratchRegister, new_space_allocation_top);
1921 movq(result, Operand(kScratchRegister, 0)); 1919 movq(result, Operand(kScratchRegister, 0));
1922 } 1920 }
1923 } 1921 }
1924 1922
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 if (scratch.is_valid()) { 1963 if (scratch.is_valid()) {
1966 movl(scratch, Immediate(0x7291)); 1964 movl(scratch, Immediate(0x7291));
1967 } 1965 }
1968 } 1966 }
1969 jmp(gc_required); 1967 jmp(gc_required);
1970 return; 1968 return;
1971 } 1969 }
1972 ASSERT(!result.is(result_end)); 1970 ASSERT(!result.is(result_end));
1973 1971
1974 // Load address of new object into result. 1972 // Load address of new object into result.
1975 LoadAllocationTopHelper(result, result_end, scratch, flags); 1973 LoadAllocationTopHelper(result, scratch, flags);
1976 1974
1977 // Calculate new top and bail out if new space is exhausted. 1975 // Calculate new top and bail out if new space is exhausted.
1978 ExternalReference new_space_allocation_limit = 1976 ExternalReference new_space_allocation_limit =
1979 ExternalReference::new_space_allocation_limit_address(); 1977 ExternalReference::new_space_allocation_limit_address();
1980 1978
1981 Register top_reg = result_end.is_valid() ? result_end : result; 1979 Register top_reg = result_end.is_valid() ? result_end : result;
1982 1980
1983 if (top_reg.is(result)) { 1981 if (top_reg.is(result)) {
1984 addq(top_reg, Immediate(object_size)); 1982 addq(top_reg, Immediate(object_size));
1985 } else { 1983 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 movl(scratch, Immediate(0x7291)); 2020 movl(scratch, Immediate(0x7291));
2023 } 2021 }
2024 // Register element_count is not modified by the function. 2022 // Register element_count is not modified by the function.
2025 } 2023 }
2026 jmp(gc_required); 2024 jmp(gc_required);
2027 return; 2025 return;
2028 } 2026 }
2029 ASSERT(!result.is(result_end)); 2027 ASSERT(!result.is(result_end));
2030 2028
2031 // Load address of new object into result. 2029 // Load address of new object into result.
2032 LoadAllocationTopHelper(result, result_end, scratch, flags); 2030 LoadAllocationTopHelper(result, scratch, flags);
2033 2031
2034 // Calculate new top and bail out if new space is exhausted. 2032 // Calculate new top and bail out if new space is exhausted.
2035 ExternalReference new_space_allocation_limit = 2033 ExternalReference new_space_allocation_limit =
2036 ExternalReference::new_space_allocation_limit_address(); 2034 ExternalReference::new_space_allocation_limit_address();
2037 lea(result_end, Operand(result, element_count, element_size, header_size)); 2035 lea(result_end, Operand(result, element_count, element_size, header_size));
2038 movq(kScratchRegister, new_space_allocation_limit); 2036 movq(kScratchRegister, new_space_allocation_limit);
2039 cmpq(result_end, Operand(kScratchRegister, 0)); 2037 cmpq(result_end, Operand(kScratchRegister, 0));
2040 j(above, gc_required); 2038 j(above, gc_required);
2041 2039
2042 // Update allocation top. 2040 // Update allocation top.
(...skipping 21 matching lines...) Expand all
2064 movl(scratch, Immediate(0x7291)); 2062 movl(scratch, Immediate(0x7291));
2065 } 2063 }
2066 // object_size is left unchanged by this function. 2064 // object_size is left unchanged by this function.
2067 } 2065 }
2068 jmp(gc_required); 2066 jmp(gc_required);
2069 return; 2067 return;
2070 } 2068 }
2071 ASSERT(!result.is(result_end)); 2069 ASSERT(!result.is(result_end));
2072 2070
2073 // Load address of new object into result. 2071 // Load address of new object into result.
2074 LoadAllocationTopHelper(result, result_end, scratch, flags); 2072 LoadAllocationTopHelper(result, scratch, flags);
2075 2073
2076 // Calculate new top and bail out if new space is exhausted. 2074 // Calculate new top and bail out if new space is exhausted.
2077 ExternalReference new_space_allocation_limit = 2075 ExternalReference new_space_allocation_limit =
2078 ExternalReference::new_space_allocation_limit_address(); 2076 ExternalReference::new_space_allocation_limit_address();
2079 if (!object_size.is(result_end)) { 2077 if (!object_size.is(result_end)) {
2080 movq(result_end, object_size); 2078 movq(result_end, object_size);
2081 } 2079 }
2082 addq(result_end, result); 2080 addq(result_end, result);
2083 movq(kScratchRegister, new_space_allocation_limit); 2081 movq(kScratchRegister, new_space_allocation_limit);
2084 cmpq(result_end, Operand(kScratchRegister, 0)); 2082 cmpq(result_end, Operand(kScratchRegister, 0));
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 CPU::FlushICache(address_, size_); 2327 CPU::FlushICache(address_, size_);
2330 2328
2331 // Check that the code was patched as expected. 2329 // Check that the code was patched as expected.
2332 ASSERT(masm_.pc_ == address_ + size_); 2330 ASSERT(masm_.pc_ == address_ + size_);
2333 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2331 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2334 } 2332 }
2335 2333
2336 } } // namespace v8::internal 2334 } } // namespace v8::internal
2337 2335
2338 #endif // V8_TARGET_ARCH_X64 2336 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698