OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 if (scratch.is(no_reg)) { | 2045 if (scratch.is(no_reg)) { |
2046 movq(kScratchRegister, new_space_allocation_top); | 2046 movq(kScratchRegister, new_space_allocation_top); |
2047 movq(Operand(kScratchRegister, 0), result_end); | 2047 movq(Operand(kScratchRegister, 0), result_end); |
2048 } else { | 2048 } else { |
2049 movq(Operand(scratch, 0), result_end); | 2049 movq(Operand(scratch, 0), result_end); |
2050 } | 2050 } |
2051 } | 2051 } |
2052 } | 2052 } |
2053 | 2053 |
2054 | 2054 |
2055 void MacroAssembler::AllocateObjectInNewSpace(int object_size, | 2055 void MacroAssembler::AllocateInNewSpace(int object_size, |
2056 Register result, | 2056 Register result, |
2057 Register result_end, | 2057 Register result_end, |
2058 Register scratch, | 2058 Register scratch, |
2059 Label* gc_required, | 2059 Label* gc_required, |
2060 AllocationFlags flags) { | 2060 AllocationFlags flags) { |
2061 ASSERT(!result.is(result_end)); | 2061 ASSERT(!result.is(result_end)); |
2062 | 2062 |
2063 // Load address of new object into result. | 2063 // Load address of new object into result. |
2064 LoadAllocationTopHelper(result, result_end, scratch, flags); | 2064 LoadAllocationTopHelper(result, result_end, scratch, flags); |
2065 | 2065 |
2066 // Calculate new top and bail out if new space is exhausted. | 2066 // Calculate new top and bail out if new space is exhausted. |
2067 ExternalReference new_space_allocation_limit = | 2067 ExternalReference new_space_allocation_limit = |
2068 ExternalReference::new_space_allocation_limit_address(); | 2068 ExternalReference::new_space_allocation_limit_address(); |
2069 lea(result_end, Operand(result, object_size)); | 2069 lea(result_end, Operand(result, object_size)); |
2070 movq(kScratchRegister, new_space_allocation_limit); | 2070 movq(kScratchRegister, new_space_allocation_limit); |
2071 cmpq(result_end, Operand(kScratchRegister, 0)); | 2071 cmpq(result_end, Operand(kScratchRegister, 0)); |
2072 j(above, gc_required); | 2072 j(above, gc_required); |
2073 | 2073 |
2074 // Update allocation top. | 2074 // Update allocation top. |
2075 UpdateAllocationTopHelper(result_end, scratch); | 2075 UpdateAllocationTopHelper(result_end, scratch); |
2076 | 2076 |
2077 // Tag the result if requested. | 2077 // Tag the result if requested. |
2078 if ((flags & TAG_OBJECT) != 0) { | 2078 if ((flags & TAG_OBJECT) != 0) { |
2079 addq(result, Immediate(kHeapObjectTag)); | 2079 addq(result, Immediate(kHeapObjectTag)); |
2080 } | 2080 } |
2081 } | 2081 } |
2082 | 2082 |
2083 | 2083 |
2084 void MacroAssembler::AllocateObjectInNewSpace(int header_size, | 2084 void MacroAssembler::AllocateInNewSpace(int header_size, |
2085 ScaleFactor element_size, | 2085 ScaleFactor element_size, |
2086 Register element_count, | 2086 Register element_count, |
2087 Register result, | 2087 Register result, |
2088 Register result_end, | 2088 Register result_end, |
2089 Register scratch, | 2089 Register scratch, |
2090 Label* gc_required, | 2090 Label* gc_required, |
2091 AllocationFlags flags) { | 2091 AllocationFlags flags) { |
2092 ASSERT(!result.is(result_end)); | 2092 ASSERT(!result.is(result_end)); |
2093 | 2093 |
2094 // Load address of new object into result. | 2094 // Load address of new object into result. |
2095 LoadAllocationTopHelper(result, result_end, scratch, flags); | 2095 LoadAllocationTopHelper(result, result_end, scratch, flags); |
2096 | 2096 |
2097 // Calculate new top and bail out if new space is exhausted. | 2097 // Calculate new top and bail out if new space is exhausted. |
2098 ExternalReference new_space_allocation_limit = | 2098 ExternalReference new_space_allocation_limit = |
2099 ExternalReference::new_space_allocation_limit_address(); | 2099 ExternalReference::new_space_allocation_limit_address(); |
2100 lea(result_end, Operand(result, element_count, element_size, header_size)); | 2100 lea(result_end, Operand(result, element_count, element_size, header_size)); |
2101 movq(kScratchRegister, new_space_allocation_limit); | 2101 movq(kScratchRegister, new_space_allocation_limit); |
2102 cmpq(result_end, Operand(kScratchRegister, 0)); | 2102 cmpq(result_end, Operand(kScratchRegister, 0)); |
2103 j(above, gc_required); | 2103 j(above, gc_required); |
2104 | 2104 |
2105 // Update allocation top. | 2105 // Update allocation top. |
2106 UpdateAllocationTopHelper(result_end, scratch); | 2106 UpdateAllocationTopHelper(result_end, scratch); |
2107 | 2107 |
2108 // Tag the result if requested. | 2108 // Tag the result if requested. |
2109 if ((flags & TAG_OBJECT) != 0) { | 2109 if ((flags & TAG_OBJECT) != 0) { |
2110 addq(result, Immediate(kHeapObjectTag)); | 2110 addq(result, Immediate(kHeapObjectTag)); |
2111 } | 2111 } |
2112 } | 2112 } |
2113 | 2113 |
2114 | 2114 |
2115 void MacroAssembler::AllocateObjectInNewSpace(Register object_size, | 2115 void MacroAssembler::AllocateInNewSpace(Register object_size, |
2116 Register result, | 2116 Register result, |
2117 Register result_end, | 2117 Register result_end, |
2118 Register scratch, | 2118 Register scratch, |
2119 Label* gc_required, | 2119 Label* gc_required, |
2120 AllocationFlags flags) { | 2120 AllocationFlags flags) { |
2121 // Load address of new object into result. | 2121 // Load address of new object into result. |
2122 LoadAllocationTopHelper(result, result_end, scratch, flags); | 2122 LoadAllocationTopHelper(result, result_end, scratch, flags); |
2123 | 2123 |
2124 // Calculate new top and bail out if new space is exhausted. | 2124 // Calculate new top and bail out if new space is exhausted. |
2125 ExternalReference new_space_allocation_limit = | 2125 ExternalReference new_space_allocation_limit = |
2126 ExternalReference::new_space_allocation_limit_address(); | 2126 ExternalReference::new_space_allocation_limit_address(); |
2127 if (!object_size.is(result_end)) { | 2127 if (!object_size.is(result_end)) { |
2128 movq(result_end, object_size); | 2128 movq(result_end, object_size); |
2129 } | 2129 } |
2130 addq(result_end, result); | 2130 addq(result_end, result); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 // Indicate that code has changed. | 2170 // Indicate that code has changed. |
2171 CPU::FlushICache(address_, size_); | 2171 CPU::FlushICache(address_, size_); |
2172 | 2172 |
2173 // Check that the code was patched as expected. | 2173 // Check that the code was patched as expected. |
2174 ASSERT(masm_.pc_ == address_ + size_); | 2174 ASSERT(masm_.pc_ == address_ + size_); |
2175 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2175 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2176 } | 2176 } |
2177 | 2177 |
2178 | 2178 |
2179 } } // namespace v8::internal | 2179 } } // namespace v8::internal |
OLD | NEW |