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

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

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

Powered by Google App Engine
This is Rietveld 408576698