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

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

Issue 3961005: Implement --noinline-new flag fully on x64 and ia32 platforms. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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/stub-cache-ia32.cc ('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 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 } 1884 }
1885 } 1885 }
1886 1886
1887 1887
1888 void MacroAssembler::AllocateInNewSpace(int object_size, 1888 void MacroAssembler::AllocateInNewSpace(int object_size,
1889 Register result, 1889 Register result,
1890 Register result_end, 1890 Register result_end,
1891 Register scratch, 1891 Register scratch,
1892 Label* gc_required, 1892 Label* gc_required,
1893 AllocationFlags flags) { 1893 AllocationFlags flags) {
1894 if (!FLAG_inline_new) {
1895 if (FLAG_debug_code) {
1896 // Trash the registers to simulate an allocation failure.
1897 movl(result, Immediate(0x7091));
1898 if (result_end.is_valid()) {
1899 movl(result_end, Immediate(0x7191));
1900 }
1901 if (scratch.is_valid()) {
1902 movl(scratch, Immediate(0x7291));
1903 }
1904 }
1905 jmp(gc_required);
1906 return;
1907 }
1894 ASSERT(!result.is(result_end)); 1908 ASSERT(!result.is(result_end));
1895 1909
1896 // Load address of new object into result. 1910 // Load address of new object into result.
1897 LoadAllocationTopHelper(result, result_end, scratch, flags); 1911 LoadAllocationTopHelper(result, result_end, scratch, flags);
1898 1912
1899 // Calculate new top and bail out if new space is exhausted. 1913 // Calculate new top and bail out if new space is exhausted.
1900 ExternalReference new_space_allocation_limit = 1914 ExternalReference new_space_allocation_limit =
1901 ExternalReference::new_space_allocation_limit_address(); 1915 ExternalReference::new_space_allocation_limit_address();
1902 1916
1903 Register top_reg = result_end.is_valid() ? result_end : result; 1917 Register top_reg = result_end.is_valid() ? result_end : result;
(...skipping 24 matching lines...) Expand all
1928 1942
1929 1943
1930 void MacroAssembler::AllocateInNewSpace(int header_size, 1944 void MacroAssembler::AllocateInNewSpace(int header_size,
1931 ScaleFactor element_size, 1945 ScaleFactor element_size,
1932 Register element_count, 1946 Register element_count,
1933 Register result, 1947 Register result,
1934 Register result_end, 1948 Register result_end,
1935 Register scratch, 1949 Register scratch,
1936 Label* gc_required, 1950 Label* gc_required,
1937 AllocationFlags flags) { 1951 AllocationFlags flags) {
1952 if (!FLAG_inline_new) {
1953 if (FLAG_debug_code) {
1954 // Trash the registers to simulate an allocation failure.
1955 movl(result, Immediate(0x7091));
1956 movl(result_end, Immediate(0x7191));
1957 if (scratch.is_valid()) {
1958 movl(scratch, Immediate(0x7291));
1959 }
1960 // Register element_count is not modified by the function.
1961 }
1962 jmp(gc_required);
1963 return;
1964 }
1938 ASSERT(!result.is(result_end)); 1965 ASSERT(!result.is(result_end));
1939 1966
1940 // Load address of new object into result. 1967 // Load address of new object into result.
1941 LoadAllocationTopHelper(result, result_end, scratch, flags); 1968 LoadAllocationTopHelper(result, result_end, scratch, flags);
1942 1969
1943 // Calculate new top and bail out if new space is exhausted. 1970 // Calculate new top and bail out if new space is exhausted.
1944 ExternalReference new_space_allocation_limit = 1971 ExternalReference new_space_allocation_limit =
1945 ExternalReference::new_space_allocation_limit_address(); 1972 ExternalReference::new_space_allocation_limit_address();
1946 lea(result_end, Operand(result, element_count, element_size, header_size)); 1973 lea(result_end, Operand(result, element_count, element_size, header_size));
1947 movq(kScratchRegister, new_space_allocation_limit); 1974 movq(kScratchRegister, new_space_allocation_limit);
1948 cmpq(result_end, Operand(kScratchRegister, 0)); 1975 cmpq(result_end, Operand(kScratchRegister, 0));
1949 j(above, gc_required); 1976 j(above, gc_required);
1950 1977
1951 // Update allocation top. 1978 // Update allocation top.
1952 UpdateAllocationTopHelper(result_end, scratch); 1979 UpdateAllocationTopHelper(result_end, scratch);
1953 1980
1954 // Tag the result if requested. 1981 // Tag the result if requested.
1955 if ((flags & TAG_OBJECT) != 0) { 1982 if ((flags & TAG_OBJECT) != 0) {
1956 addq(result, Immediate(kHeapObjectTag)); 1983 addq(result, Immediate(kHeapObjectTag));
1957 } 1984 }
1958 } 1985 }
1959 1986
1960 1987
1961 void MacroAssembler::AllocateInNewSpace(Register object_size, 1988 void MacroAssembler::AllocateInNewSpace(Register object_size,
1962 Register result, 1989 Register result,
1963 Register result_end, 1990 Register result_end,
1964 Register scratch, 1991 Register scratch,
1965 Label* gc_required, 1992 Label* gc_required,
1966 AllocationFlags flags) { 1993 AllocationFlags flags) {
1994 if (!FLAG_inline_new) {
1995 if (FLAG_debug_code) {
1996 // Trash the registers to simulate an allocation failure.
1997 movl(result, Immediate(0x7091));
1998 movl(result_end, Immediate(0x7191));
1999 if (scratch.is_valid()) {
2000 movl(scratch, Immediate(0x7291));
2001 }
2002 // object_size is left unchanged by this function.
2003 }
2004 jmp(gc_required);
2005 return;
2006 }
2007 ASSERT(!result.is(result_end));
2008
1967 // Load address of new object into result. 2009 // Load address of new object into result.
1968 LoadAllocationTopHelper(result, result_end, scratch, flags); 2010 LoadAllocationTopHelper(result, result_end, scratch, flags);
1969 2011
1970 // Calculate new top and bail out if new space is exhausted. 2012 // Calculate new top and bail out if new space is exhausted.
1971 ExternalReference new_space_allocation_limit = 2013 ExternalReference new_space_allocation_limit =
1972 ExternalReference::new_space_allocation_limit_address(); 2014 ExternalReference::new_space_allocation_limit_address();
1973 if (!object_size.is(result_end)) { 2015 if (!object_size.is(result_end)) {
1974 movq(result_end, object_size); 2016 movq(result_end, object_size);
1975 } 2017 }
1976 addq(result_end, result); 2018 addq(result_end, result);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 CPU::FlushICache(address_, size_); 2265 CPU::FlushICache(address_, size_);
2224 2266
2225 // Check that the code was patched as expected. 2267 // Check that the code was patched as expected.
2226 ASSERT(masm_.pc_ == address_ + size_); 2268 ASSERT(masm_.pc_ == address_ + size_);
2227 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2269 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2228 } 2270 }
2229 2271
2230 } } // namespace v8::internal 2272 } } // namespace v8::internal
2231 2273
2232 #endif // V8_TARGET_ARCH_X64 2274 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698