OLD | NEW |
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 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 // Remove the remaining fields. | 1534 // Remove the remaining fields. |
1535 addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); | 1535 addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); |
1536 } | 1536 } |
1537 | 1537 |
1538 | 1538 |
1539 void MacroAssembler::Ret() { | 1539 void MacroAssembler::Ret() { |
1540 ret(0); | 1540 ret(0); |
1541 } | 1541 } |
1542 | 1542 |
1543 | 1543 |
| 1544 void MacroAssembler::Ret(int bytes_dropped, Register scratch) { |
| 1545 if (is_uint16(bytes_dropped)) { |
| 1546 ret(bytes_dropped); |
| 1547 } else { |
| 1548 pop(scratch); |
| 1549 addq(rsp, Immediate(bytes_dropped)); |
| 1550 push(scratch); |
| 1551 ret(0); |
| 1552 } |
| 1553 } |
| 1554 |
| 1555 |
1544 void MacroAssembler::FCmp() { | 1556 void MacroAssembler::FCmp() { |
1545 fucomip(); | 1557 fucomip(); |
1546 fstp(0); | 1558 fstp(0); |
1547 } | 1559 } |
1548 | 1560 |
1549 | 1561 |
1550 void MacroAssembler::CmpObjectType(Register heap_object, | 1562 void MacroAssembler::CmpObjectType(Register heap_object, |
1551 InstanceType type, | 1563 InstanceType type, |
1552 Register map) { | 1564 Register map) { |
1553 movq(map, FieldOperand(heap_object, HeapObject::kMapOffset)); | 1565 movq(map, FieldOperand(heap_object, HeapObject::kMapOffset)); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 | 2103 |
2092 // Load address of new object into result. | 2104 // Load address of new object into result. |
2093 LoadAllocationTopHelper(result, scratch, flags); | 2105 LoadAllocationTopHelper(result, scratch, flags); |
2094 | 2106 |
2095 // Calculate new top and bail out if new space is exhausted. | 2107 // Calculate new top and bail out if new space is exhausted. |
2096 ExternalReference new_space_allocation_limit = | 2108 ExternalReference new_space_allocation_limit = |
2097 ExternalReference::new_space_allocation_limit_address(); | 2109 ExternalReference::new_space_allocation_limit_address(); |
2098 | 2110 |
2099 Register top_reg = result_end.is_valid() ? result_end : result; | 2111 Register top_reg = result_end.is_valid() ? result_end : result; |
2100 | 2112 |
2101 if (top_reg.is(result)) { | 2113 if (!top_reg.is(result)) { |
2102 addq(top_reg, Immediate(object_size)); | 2114 movq(top_reg, result); |
2103 } else { | |
2104 lea(top_reg, Operand(result, object_size)); | |
2105 } | 2115 } |
| 2116 addq(top_reg, Immediate(object_size)); |
| 2117 j(carry, gc_required); |
2106 movq(kScratchRegister, new_space_allocation_limit); | 2118 movq(kScratchRegister, new_space_allocation_limit); |
2107 cmpq(top_reg, Operand(kScratchRegister, 0)); | 2119 cmpq(top_reg, Operand(kScratchRegister, 0)); |
2108 j(above, gc_required); | 2120 j(above, gc_required); |
2109 | 2121 |
2110 // Update allocation top. | 2122 // Update allocation top. |
2111 UpdateAllocationTopHelper(top_reg, scratch); | 2123 UpdateAllocationTopHelper(top_reg, scratch); |
2112 | 2124 |
2113 if (top_reg.is(result)) { | 2125 if (top_reg.is(result)) { |
2114 if ((flags & TAG_OBJECT) != 0) { | 2126 if ((flags & TAG_OBJECT) != 0) { |
2115 subq(result, Immediate(object_size - kHeapObjectTag)); | 2127 subq(result, Immediate(object_size - kHeapObjectTag)); |
(...skipping 29 matching lines...) Expand all Loading... |
2145 return; | 2157 return; |
2146 } | 2158 } |
2147 ASSERT(!result.is(result_end)); | 2159 ASSERT(!result.is(result_end)); |
2148 | 2160 |
2149 // Load address of new object into result. | 2161 // Load address of new object into result. |
2150 LoadAllocationTopHelper(result, scratch, flags); | 2162 LoadAllocationTopHelper(result, scratch, flags); |
2151 | 2163 |
2152 // Calculate new top and bail out if new space is exhausted. | 2164 // Calculate new top and bail out if new space is exhausted. |
2153 ExternalReference new_space_allocation_limit = | 2165 ExternalReference new_space_allocation_limit = |
2154 ExternalReference::new_space_allocation_limit_address(); | 2166 ExternalReference::new_space_allocation_limit_address(); |
2155 lea(result_end, Operand(result, element_count, element_size, header_size)); | 2167 |
| 2168 // We assume that element_count*element_size + header_size does not |
| 2169 // overflow. |
| 2170 lea(result_end, Operand(element_count, element_size, header_size)); |
| 2171 addq(result_end, result); |
| 2172 j(carry, gc_required); |
2156 movq(kScratchRegister, new_space_allocation_limit); | 2173 movq(kScratchRegister, new_space_allocation_limit); |
2157 cmpq(result_end, Operand(kScratchRegister, 0)); | 2174 cmpq(result_end, Operand(kScratchRegister, 0)); |
2158 j(above, gc_required); | 2175 j(above, gc_required); |
2159 | 2176 |
2160 // Update allocation top. | 2177 // Update allocation top. |
2161 UpdateAllocationTopHelper(result_end, scratch); | 2178 UpdateAllocationTopHelper(result_end, scratch); |
2162 | 2179 |
2163 // Tag the result if requested. | 2180 // Tag the result if requested. |
2164 if ((flags & TAG_OBJECT) != 0) { | 2181 if ((flags & TAG_OBJECT) != 0) { |
2165 addq(result, Immediate(kHeapObjectTag)); | 2182 addq(result, Immediate(kHeapObjectTag)); |
(...skipping 25 matching lines...) Expand all Loading... |
2191 // Load address of new object into result. | 2208 // Load address of new object into result. |
2192 LoadAllocationTopHelper(result, scratch, flags); | 2209 LoadAllocationTopHelper(result, scratch, flags); |
2193 | 2210 |
2194 // Calculate new top and bail out if new space is exhausted. | 2211 // Calculate new top and bail out if new space is exhausted. |
2195 ExternalReference new_space_allocation_limit = | 2212 ExternalReference new_space_allocation_limit = |
2196 ExternalReference::new_space_allocation_limit_address(); | 2213 ExternalReference::new_space_allocation_limit_address(); |
2197 if (!object_size.is(result_end)) { | 2214 if (!object_size.is(result_end)) { |
2198 movq(result_end, object_size); | 2215 movq(result_end, object_size); |
2199 } | 2216 } |
2200 addq(result_end, result); | 2217 addq(result_end, result); |
| 2218 j(carry, gc_required); |
2201 movq(kScratchRegister, new_space_allocation_limit); | 2219 movq(kScratchRegister, new_space_allocation_limit); |
2202 cmpq(result_end, Operand(kScratchRegister, 0)); | 2220 cmpq(result_end, Operand(kScratchRegister, 0)); |
2203 j(above, gc_required); | 2221 j(above, gc_required); |
2204 | 2222 |
2205 // Update allocation top. | 2223 // Update allocation top. |
2206 UpdateAllocationTopHelper(result_end, scratch); | 2224 UpdateAllocationTopHelper(result_end, scratch); |
2207 | 2225 |
2208 // Tag the result if requested. | 2226 // Tag the result if requested. |
2209 if ((flags & TAG_OBJECT) != 0) { | 2227 if ((flags & TAG_OBJECT) != 0) { |
2210 addq(result, Immediate(kHeapObjectTag)); | 2228 addq(result, Immediate(kHeapObjectTag)); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 CPU::FlushICache(address_, size_); | 2490 CPU::FlushICache(address_, size_); |
2473 | 2491 |
2474 // Check that the code was patched as expected. | 2492 // Check that the code was patched as expected. |
2475 ASSERT(masm_.pc_ == address_ + size_); | 2493 ASSERT(masm_.pc_ == address_ + size_); |
2476 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2494 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2477 } | 2495 } |
2478 | 2496 |
2479 } } // namespace v8::internal | 2497 } } // namespace v8::internal |
2480 | 2498 |
2481 #endif // V8_TARGET_ARCH_X64 | 2499 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |